Universal Messaging 9.7 | Universal Messaging Developer Guide | Enterprise APIs | Enterprise Developer's Guide for C# | Messaging API | MyChannels.Universal Messaging API: Producers
 
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-2015 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.