Configure a Message Producer

A message producer can be configured to generate messages with default headers and properties that define how those messages are to be routed and delivered.

Specifically, you can:

  • Set the producer's default delivery mode.
  • Set whether message IDs are disabled.
  • Set whether message timestamps are disabled.
  • Set the producer's default priority.
  • Set the default length of time that a produced message should be retained by the message system.

For example, as described in the Message Delivery Modes, you can set the message deliver mode to either PERSISTENT, NON_PERSISTENT, or RELIABLE_DELIVERY.

  • Java

    Use the MessageProducer object’s setDeliveryMode() method to configure your Message Producer with a default delivery mode of RELIABLE_DELIVERY:

       QueueSender.setDeliveryMode(
            com.tibco.tibjms.Tibjms.RELIABLE_DELIVERY);

    To configure the Message Producer with a default delivery mode of NON_PERSISTENT:

       QueueSender.setDeliveryMode(
                javax.jms.DeliveryMode.NON_PERSISTENT);

    See the tibjmsMsgProducerPerf.java sample client for a working example.

Note: Delivery mode cannot be set by using the Message.setJMSDeliveryMode() method. According to the JMS specification, the publisher ignores the value of the JMSDeliveryMode header field when a message is being published.
  • C

    Use the tibemsMsgProducer_SetDeliveryMode function to configure your Message Producer to set a default delivery mode for each message it produces to RELIABLE_DELIVERY:

       tibems_int deliveryMode = TIBEMS_RELIABLE;
       status tibemsMsgProducer_SetDeliveryMode(QueueSender,
                                                deliveryMode);
  • C#

    Set the DeliveryMode on the MessageProducer object to RELIABLE_DELIVERY:

       QueueSender.DeliveryMode = DeliveryMode.RELIABLE_DELIVERY;

    See the csMsgProducerPerf.cs sample client for a working example.