Menu Search

2.3. .NET Binding Class Mapping to Underlying C++ Messaging API

This chapter describes the specific mappings between classes in the .NET Binding and the underlying C++ Messaging API.

2.3.1. .NET Binding for the C++ Messaging API Class: Address

Table 2.9. .NET Binding for the C++ Messaging API Class: Address

.NET Binding Class: Address
LanguageSyntax
C++class Address
.NETpublic ref class Address
Constructor
C++Address();
.NETpublic Address();
Constructor
C++Address(const std::string& address);
.NETpublic Address(string address);
Constructor
C++Address(const std::string& name, const std::string& subject, const qpid::types::Variant::Map& options, const std::string& type = "");
.NETpublic Address(string name, string subject, Dictionary<string, object> options);
.NETpublic Address(string name, string subject, Dictionary<string, object> options, string type);
Copy constructor
C++Address(const Address& address);
.NETpublic Address(Address address);
Destructor
C++~Address();
.NET~Address();
Finalizer
C++n/a
.NET!Address();
Copy assignment operator
C++Address& operator=(const Address&);
.NETpublic Address op_Assign(Address rhs);
Property: Name
C++const std::string& getName() const;
C++void setName(const std::string&);
.NETpublic string Name { get; set; }
Property: Subject
C++const std::string& getSubject() const;
C++void setSubject(const std::string&);
.NETpublic string Subject { get; set; }
Property: Options
C++const qpid::types::Variant::Map& getOptions() const;
C++qpid::types::Variant::Map& getOptions();
C++void setOptions(const qpid::types::Variant::Map&);
.NETpublic Dictionary<string, object> Options { get; set; }
Property: Type
C++std::string getType() const;
C++void setType(const std::string&);
.NETpublic string Type { get; set; }
Miscellaneous
C++std::string str() const;
.NETpublic string ToStr();
Miscellaneous
C++operator bool() const;
.NETn/a
Miscellaneous
C++bool operator !() const;
.NETn/a

2.3.2. .NET Binding for the C++ Messaging API Class: Connection

Table 2.10. .NET Binding for the C++ Messaging API Class: Connection

.NET Binding Class: Connection
LanguageSyntax
C++class Connection : public qpid::messaging::Handle<ConnectionImpl>
.NETpublic ref class Connection
Constructor
C++Connection(ConnectionImpl* impl);
.NETn/a
Constructor
C++Connection();
.NETn/a
Constructor
C++Connection(const std::string& url, const qpid::types::Variant::Map& options = qpid::types::Variant::Map());
.NETpublic Connection(string url);
.NETpublic Connection(string url, Dictionary<string, object> options);
Constructor
C++Connection(const std::string& url, const std::string& options);
.NETpublic Connection(string url, string options);
Copy Constructor
C++Connection(const Connection&);
.NETpublic Connection(Connection connection);
Destructor
C++~Connection();
.NET~Connection();
Finalizer
C++n/a
.NET!Connection();
Copy assignment operator
C++Connection& operator=(const Connection&);
.NETpublic Connection op_Assign(Connection rhs);
Method: SetOption
C++void setOption(const std::string& name, const qpid::types::Variant& value);
.NETpublic void SetOption(string name, object value);
Method: open
C++void open();
.NETpublic void Open();
Property: isOpen
C++bool isOpen();
.NETpublic bool IsOpen { get; }
Method: close
C++void close();
.NETpublic void Close();
Method: createTransactionalSession
C++Session createTransactionalSession(const std::string& name = std::string());
.NETpublic Session CreateTransactionalSession();
.NETpublic Session CreateTransactionalSession(string name);
Method: createSession
C++Session createSession(const std::string& name = std::string());
.NETpublic Session CreateSession();
.NETpublic Session CreateSession(string name);
Method: getSession
C++Session getSession(const std::string& name) const;
.NETpublic Session GetSession(string name);
Property: AuthenticatedUsername
C++std::string getAuthenticatedUsername();
.NETpublic string GetAuthenticatedUsername();

2.3.3. .NET Binding for the C++ Messaging API Class: Duration

Table 2.11. .NET Binding for the C++ Messaging API Class: Duration

.NET Binding Class: Duration
LanguageSyntax
C++class Duration
.NETpublic ref class Duration
Constructor
C++explicit Duration(uint64_t milliseconds);
.NETpublic Duration(ulong mS);
Copy constructor
C++n/a
.NETpublic Duration(Duration rhs);
Destructor
C++default
.NETdefault
Finalizer
C++n/a
.NETdefault
Property: Milliseconds
C++uint64_t getMilliseconds() const;
.NETpublic ulong Milliseconds { get; }
Operator: *
C++Duration operator*(const Duration& duration, uint64_t multiplier);
.NETpublic static Duration operator *(Duration dur, ulong multiplier);
.NETpublic static Duration Multiply(Duration dur, ulong multiplier);
C++Duration operator*(uint64_t multiplier, const Duration& duration);
.NETpublic static Duration operator *(ulong multiplier, Duration dur);
.NETpublic static Duration Multiply(ulong multiplier, Duration dur);
Constants
C++static const Duration FOREVER;
C++static const Duration IMMEDIATE;
C++static const Duration SECOND;
C++static const Duration MINUTE;
.NETpublic sealed class DurationConstants
.NETpublic static Duration FORVER;
.NETpublic static Duration IMMEDIATE;
.NETpublic static Duration MINUTE;
.NETpublic static Duration SECOND;

2.3.4. .NET Binding for the C++ Messaging API Class: FailoverUpdates

Table 2.12. .NET Binding for the C++ Messaging API Class: FailoverUpdates

.NET Binding Class: FailoverUpdates
LanguageSyntax
C++class FailoverUpdates
.NETpublic ref class FailoverUpdates
Constructor
C++FailoverUpdates(Connection& connection);
.NETpublic FailoverUpdates(Connection connection);
Destructor
C++~FailoverUpdates();
.NET~FailoverUpdates();
Finalizer
C++n/a
.NET!FailoverUpdates();

2.3.5. .NET Binding for the C++ Messaging API Class: Message

Table 2.13. .NET Binding for the C++ Messaging API Class: Message

.NET Binding Class: Message
LanguageSyntax
C++class Message
.NETpublic ref class Message
Constructor
C++Message(const std::string& bytes = std::string());
.NETMessage();
.NETMessage(System::String ^ theStr);
.NETMessage(System::Object ^ theValue);
.NETMessage(array<System::Byte> ^ bytes);
Constructor
C++Message(const char*, size_t);
.NETpublic Message(byte[] bytes, int offset, int size);
Copy constructor
C++Message(const Message&);
.NETpublic Message(Message message);
Copy assignment operator
C++Message& operator=(const Message&);
.NETpublic Message op_Assign(Message rhs);
Destructor
C++~Message();
.NET~Message();
Finalizer
C++n/a
.NET!Message()
Property: ReplyTo
C++void setReplyTo(const Address&);
C++const Address& getReplyTo() const;
.NETpublic Address ReplyTo { get; set; }
Property: Subject
C++void setSubject(const std::string&);
C++const std::string& getSubject() const;
.NETpublic string Subject { get; set; }
Property: ContentType
C++void setContentType(const std::string&);
C++const std::string& getContentType() const;
.NETpublic string ContentType { get; set; }
Property: MessageId
C++void setMessageId(const std::string&);
C++const std::string& getMessageId() const;
.NETpublic string MessageId { get; set; }
Property: UserId
C++void setUserId(const std::string&);
C++const std::string& getUserId() const;
.NETpublic string UserId { get; set; }
Property: CorrelationId
C++void setCorrelationId(const std::string&);
C++const std::string& getCorrelationId() const;
.NETpublic string CorrelationId { get; set; }
Property: Priority
C++void setPriority(uint8_t);
C++uint8_t getPriority() const;
.NETpublic byte Priority { get; set; }
Property: Ttl
C++void setTtl(Duration ttl);
C++Duration getTtl() const;
.NETpublic Duration Ttl { get; set; }
Property: Durable
C++void setDurable(bool durable);
C++bool getDurable() const;
.NETpublic bool Durable { get; set; }
Property: Redelivered
C++bool getRedelivered() const;
C++void setRedelivered(bool);
.NETpublic bool Redelivered { get; set; }
Method: SetProperty
C++void setProperty(const std::string&, const qpid::types::Variant&);
.NETpublic void SetProperty(string name, object value);
Property: Properties
C++const qpid::types::Variant::Map& getProperties() const;
C++qpid::types::Variant::Map& getProperties();
.NETpublic Dictionary<string, object> Properties { get; set; }
Method: SetContent
C++void setContent(const std::string&);
C++void setContent(const char* chars, size_t count);
.NETpublic void SetContent(byte[] bytes);
.NETpublic void SetContent(string content);
.NETpublic void SetContent(byte[] bytes, int offset, int size);
Method: GetContent
C++std::string getContent() const;
.NETpublic string GetContent();
.NETpublic void GetContent(byte[] arr);
.NETpublic void GetContent(Collection<object> __p1);
.NETpublic void GetContent(Dictionary<string, object> dict);
Method: GetContentPtr
C++const char* getContentPtr() const;
.NETn/a
Property: ContentSize
C++size_t getContentSize() const;
.NETpublic ulong ContentSize { get; }
Struct: EncodingException
C++struct EncodingException : qpid::types::Exception
.NETn/a
Method: decode
C++void decode(const Message& message, qpid::types::Variant::Map& map, const std::string& encoding = std::string());
C++void decode(const Message& message, qpid::types::Variant::List& list, const std::string& encoding = std::string());
.NETn/a
Method: encode
C++void encode(const qpid::types::Variant::Map& map, Message& message, const std::string& encoding = std::string());
C++void encode(const qpid::types::Variant::List& list, Message& message, const std::string& encoding = std::string());
.NETn/a
Method: AsString
C++n/a
.NETpublic string AsString(object obj);
.NETpublic string ListAsString(Collection<object> list);
.NETpublic string MapAsString(Dictionary<string, object> dict);

2.3.6. .NET Binding for the C++ Messaging API Class: Receiver

Table 2.14. .NET Binding for the C++ Messaging API Class: Receiver

.NET Binding Class: Receiver
LanguageSyntax
C++class Receiver
.NETpublic ref class Receiver
Constructor
.NETConstructed object is returned by Session.CreateReceiver
Copy constructor
C++Receiver(const Receiver&);
.NETpublic Receiver(Receiver receiver);
Destructor
C++~Receiver();
.NET~Receiver();
Finalizer
C++n/a
.NET!Receiver()
Copy assignment operator
C++Receiver& operator=(const Receiver&);
.NETpublic Receiver op_Assign(Receiver rhs);
Method: Get
C++bool get(Message& message, Duration timeout=Duration::FOREVER);
.NETpublic bool Get(Message mmsgp);
.NETpublic bool Get(Message mmsgp, Duration durationp);
Method: Get
C++Message get(Duration timeout=Duration::FOREVER);
.NETpublic Message Get();
.NETpublic Message Get(Duration durationp);
Method: Fetch
C++bool fetch(Message& message, Duration timeout=Duration::FOREVER);
.NETpublic bool Fetch(Message mmsgp);
.NETpublic bool Fetch(Message mmsgp, Duration duration);
Method: Fetch
C++Message fetch(Duration timeout=Duration::FOREVER);
.NETpublic Message Fetch();
.NETpublic Message Fetch(Duration durationp);
Property: Capacity
C++void setCapacity(uint32_t);
C++uint32_t getCapacity();
.NETpublic uint Capacity { get; set; }
Property: Available
C++uint32_t getAvailable();
.NETpublic uint Available { get; }
Property: Unsettled
C++uint32_t getUnsettled();
.NETpublic uint Unsettled { get; }
Method: Close
C++void close();
.NETpublic void Close();
Property: IsClosed
C++bool isClosed() const;
.NETpublic bool IsClosed { get; }
Property: Name
C++const std::string& getName() const;
.NETpublic string Name { get; }
Property: Session
C++Session getSession() const;
.NETpublic Session Session { get; }

2.3.7. .NET Binding for the C++ Messaging API Class: Sender

Table 2.15. .NET Binding for the C++ Messaging API Class: Sender

.NET Binding Class: Sender
LanguageSyntax
C++class Sender
.NETpublic ref class Sender
Constructor
.NETConstructed object is returned by Session.CreateSender
Copy constructor
C++Sender(const Sender&);
.NETpublic Sender(Sender sender);
Destructor
C++~Sender();
.NET~Sender();
Finalizer
C++n/a
.NET!Sender()
Copy assignment operator
C++Sender& operator=(const Sender&);
.NETpublic Sender op_Assign(Sender rhs);
Method: Send
C++void send(const Message& message, bool sync=false);
.NETpublic void Send(Message mmsgp);
.NETpublic void Send(Message mmsgp, bool sync);
Method: Close
C++void close();
.NETpublic void Close();
Property: Capacity
C++void setCapacity(uint32_t);
C++uint32_t getCapacity();
.NETpublic uint Capacity { get; set; }
Property: Available
C++uint32_t getAvailable();
.NETpublic uint Available { get; }
Property: Unsettled
C++uint32_t getUnsettled();
.NETpublic uint Unsettled { get; }
Property: Name
C++const std::string& getName() const;
.NETpublic string Name { get; }
Property: Session
C++Session getSession() const;
.NETpublic Session Session { get; }

2.3.8. .NET Binding for the C++ Messaging API Class: Session

Table 2.16. .NET Binding for the C++ Messaging API Class: Session

.NET Binding Class: Session
LanguageSyntax
C++class Session
.NETpublic ref class Session
Constructor
.NETConstructed object is returned by Connection.CreateSession
Copy constructor
C++Session(const Session&);
.NETpublic Session(Session session);
Destructor
C++~Session();
.NET~Session();
Finalizer
C++n/a
.NET!Session()
Copy assignment operator
C++Session& operator=(const Session&);
.NETpublic Session op_Assign(Session rhs);
Method: Close
C++void close();
.NETpublic void Close();
Method: Commit
C++void commit();
.NETpublic void Commit();
Method: Rollback
C++void rollback();
.NETpublic void Rollback();
Method: Acknowledge
C++void acknowledge(bool sync=false);
C++void acknowledge(Message&, bool sync=false);
.NETpublic void Acknowledge();
.NETpublic void Acknowledge(bool sync);
.NETpublic void Acknowledge(Message __p1);
.NETpublic void Acknowledge(Message __p1, bool __p2);
Method: Reject
C++void reject(Message&);
.NETpublic void Reject(Message __p1);
Method: Release
C++void release(Message&);
.NETpublic void Release(Message __p1);
Method: Sync
C++void sync(bool block=true);
.NETpublic void Sync();
.NETpublic void Sync(bool block);
Property: Receivable
C++uint32_t getReceivable();
.NETpublic uint Receivable { get; }
Property: UnsettledAcks
C++uint32_t getUnsettledAcks();
.NETpublic uint UnsetledAcks { get; }
Method: NextReceiver
C++bool nextReceiver(Receiver&, Duration timeout=Duration::FOREVER);
.NETpublic bool NextReceiver(Receiver rcvr);
.NETpublic bool NextReceiver(Receiver rcvr, Duration timeout);
Method: NextReceiver
C++Receiver nextReceiver(Duration timeout=Duration::FOREVER);
.NETpublic Receiver NextReceiver();
.NETpublic Receiver NextReceiver(Duration timeout);
Method: CreateSender
C++Sender createSender(const Address& address);
.NETpublic Sender CreateSender(Address address);
Method: CreateSender
C++Sender createSender(const std::string& address);
.NETpublic Sender CreateSender(string address);
Method: CreateReceiver
C++Receiver createReceiver(const Address& address);
.NETpublic Receiver CreateReceiver(Address address);
Method: CreateReceiver
C++Receiver createReceiver(const std::string& address);
.NETpublic Receiver CreateReceiver(string address);
Method: GetSender
C++Sender getSender(const std::string& name) const;
.NETpublic Sender GetSender(string name);
Method: GetReceiver
C++Receiver getReceiver(const std::string& name) const;
.NETpublic Receiver GetReceiver(string name);
Property: Connection
C++Connection getConnection() const;
.NETpublic Connection Connection { get; }
Property: HasError
C++bool hasError();
.NETpublic bool HasError { get; }
Method: CheckError
C++void checkError();
.NETpublic void CheckError();

2.3.9. .NET Binding Class: SessionReceiver

The SessionReceiver class provides a convenient callback mechanism for Messages received by all Receivers on a given Session.

using Org.Apache.Qpid.Messaging;
using System;

namespace Org.Apache.Qpid.Messaging.SessionReceiver
{
    public interface ISessionReceiver
    {
        void SessionReceiver(Receiver receiver, Message message);
    }

    public class CallbackServer
    {
        public CallbackServer(Session session, ISessionReceiver callback);

        public void Close();
    }
}

	

To use this class a client program includes references to both Org.Apache.Qpid.Messaging and Org.Apache.Qpid.Messaging.SessionReceiver. The calling program creates a function that implements the ISessionReceiver interface. This function will be called whenever message is received by the session. The callback process is started by creating a CallbackServer and will continue to run until the client program calls the CallbackServer.Close function.

A complete operating example of using the SessionReceiver callback is contained in cpp/bindings/qpid/dotnet/examples/csharp.map.callback.receiver.