Universal Messaging Developer Guide : The Enterprise Client APIs : Overview of Enterprise Developer Guide for C# : Messaging API : Universal Messaging C# .NET MyChannels.Universal Messaging API: Producers
Universal Messaging C# .NET MyChannels.Universal Messaging API: Producers
The sending of messages is exposed via the Producers feature, simplifying the message sending process across Topics, Queues and DataGroups by using an identical procedure for each.
Firstly, a Producer is created of the appropriate type, passing in the name of the DataGroup, Topic or Queue. Examples are included below for each of the three mechanisms. Obviously, in order to use DataGroups, they must first be enabled by setting the Session.DataGroups.Enable flag to true before initializing the session.

IProducer producer = session.DataGroups.CreateProducer("Group1");

IProducer producer = session.Queues.CreateProducer("Queue1");

IProducer producer = session.Topics.CreateProducer("Topic1");
In order to send a message, a Message object is first created, as shown below, then is passed into the Producer's Send() method. The Message constructor has various overloads to allow the specification of properties, tags and data.

// Creating a Message
string msgContents = "Hello World!";
Message msg = new Message(msgContents, new byte[] { }));
producer.Send(msg);
Copyright © 2013-2014 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback