Create a Message Producer
A Message Producer is an EMS client that either publishes messages to a topic or sends messages to a queue. When working with topics, a Message Producer is commonly referred to as a Publisher.
Optionally, when creating a Message Producer, you can set the destination to NULL and specify the destination when you send or publish a message, as described in Send Messages.
You must have send permission on a queue to create a message producer that sends messages to that queue. You must have durable permission on the topic to create a new durable subscriber for that topic, and have at least use_durable permission on the topic to attach to an existing durable subscriber for the topic. See User Permissions for details.
The following examples create a message producer that sends messages to the queue that was dynamically created in Dynamically Create Topics and Queues.
- Java
Use the
Sessionobject’screateProducer()method to create aMessageProducerobject:MessageProducer QueueSender = session.createProducer(queue);See the
tibjmsMsgProducer.javasample client for a working example. - C
Use the
tibemsSession_CreateProducerfunction to create a message producer of typetibemsMsgProducer:tibemsMsgProducer QueueSender = NULL;status = tibemsSession_CreateProducer(session,&QueueSender,queue);See the
tibemsMsgProducer.csample client for a working example. - C#
Use the
Session.CreateProducermethod to create aMessageProducerobject:MessageProducer QueueSender = session.CreateProducer(queue);See the
csMsgProducer.cssample client for a working example.