Create one or more message producers for sending and publishing messages.
Beginning in version 6.0, EAServer provides a common message producer object that you can use for both sending and publishing messages.
The following code fragment creates a MessageProducer object called “mySender” using the previously created Session object mySession, and specifies the name of the message queue destination myQueue:
MessageProducer mySender = mySession.createProducer(myQueue);
When you create a message producer, you can specify default values for the following properties:
DeliveryMode – the mode of message delivery can be either:
PERSISTENT – messages are delivered once and only once. Saving messages to a data store provides consistent, nonduplicated message delivery.
NON_PERSISTENT – messages are delivered at most once. Messages are not saved to a data store. If the JMS provider fails, messages can be lost, but they are not delivered more than once. This mode requires less system overhead.
Priority – the priority of a message can range from 0 – 9, where 0 is the lowest priority. Typically, 0 – 4 are considered normal priority levels, and 5 – 9 are expedited priority levels.
Time-to-live – the number of milliseconds, which together with the GMT, defines a message expiration time.
When you no longer need a message producer, call MessageProducer.close to release its resources.