MessageProducer
public interface MessageProducer
Subinterfaces: QueueSender and TopicPublisher
WebSphere MQ class: MQMessageProducer
java.lang.Object | +----com.ibm.mq.jms.MQMessageProducerA client uses a MessageProducer to send messages to a destination.
WebSphere MQ constructors
- MQMessageProducer
public MQMessageProducer()
Methods
- close
public void close() throws JMSException
Because a provider can allocate some resources outside the JVM on behalf of a MessageProducer, clients must close them when they are not needed. You cannot rely on garbage collection to reclaim these resources eventually, because this might not occur soon enough.
- Throws:
- JMSException if JMS fails to close the producer because of an error.
- getDeliveryMode
public int getDeliveryMode() throws JMSException
Get the producer's default delivery mode.
- Returns:
- The message delivery mode for this message producer.
- Throws:
- JMSException if JMS fails to get the delivery mode because of an internal error.
- See also:
- setDeliveryMode
- getDisableMessageID
public boolean getDisableMessageID() throws JMSException
Get an indication of whether message IDs are disabled.
- Returns:
- An indication of whether message IDs are disabled.
- Throws:
- JMSException if JMS fails to get the disabled message ID because of an internal error.
- getDisableMessageTimestamp
public boolean getDisableMessageTimestamp() throws JMSException
Get an indication of whether message timestamps are disabled.
- Returns:
- An indication of whether message IDs are disabled.
- Throws:
- JMSException if JMS fails to get the disabled message timestamp because of an internal error.
- getPriority
public int getPriority() throws JMSException
Get the producer's default priority.
- Returns:
- Te message priority for this message producer.
- Throws:
- JMSException if JMS fails to get the priority because of an internal error.
- See also:
- setPriority
- getTimeToLive
public long getTimeToLive() throws JMSException
Get the default length of time in milliseconds from its dispatch time that the message system retains a produced message.
- Returns:
- The message time-to-live in milliseconds; zero is unlimited.
- Throws:
- JMSException if JMS fails to get the time-to-live because of an internal error.
- See also:
- setTimeToLive
- setDeliveryMode
public void setDeliveryMode(int deliveryMode) throws JMSException
Set the producer's default delivery mode; it is set to DeliveryMode.PERSISTENT by default.
- Parameters:
- deliveryMode: the message delivery mode for this message producer.
- Throws:
- JMSException if JMS fails to set the delivery mode because of an internal error.
- See also:
- getDeliveryMode, DeliveryMode.NON_PERSISTENT, DeliveryMode.PERSISTENT
- setDisableMessageID
public void setDisableMessageID(boolean value) throws JMSException
Set whether message IDs are disabled; they are enabled by default.
- Note:
- This method is ignored in the WebSphere MQ classes for Java Message Service implementation.
- Parameters:
- value: indicates whether message IDs are disabled.
- Throws:
- JMSException if JMS fails to set the disabled message ID because of an internal error.
- setDisableMessageTimestamp
public void setDisableMessageTimestamp(boolean value) throws JMSException
Set whether message timestamps are disabled; they are enabled by default.
- Note:
- This method is ignored in the WebSphere MQ classes for Java Message Service implementation.
- Parameters:
- value: indicates whether message timestamps are disabled.
- Throws:
- JMSException if JMS fails to set the disabled message timestamp because of an internal error.
- setPriority
public void setPriority(int priority) throws JMSException
Set the producer's default priority (default 4).
- Parameters:
- priority: the message priority for this message producer.
- Throws:
- JMSException if JMS fails to set the priority because of an internal error.
- See also:
- getPriority
- setTimeToLive
public void setTimeToLive(long timeToLive) throws JMSException
Set the default length of time, in milliseconds from its dispatch time, that the message system retains a produced message.
Time-to-live is set to zero by default.
WebSphere MQ Event Broker note This method throws a JMSException if set to other than 0 when you make a direct connection to WebSphere MQ Event Broker.
- Parameters:
- timeToLive: the message time to live in milliseconds; zero is unlimited.
- Throws:
- JMSException if JMS fails to set the time-to-live because of an internal error.
- See also:
- getTimeToLive
WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.