MQMessageProducer

public class MQMessageProducer
extends Object
implements MessageProducer
java.lang.Object
   |
   +----com.ibm.mq.jms.MQMessageProducer
          

A client uses an MQMessageProducer to send messages to a destination.

Methods

close

public void close() throws JMSException;

Closes the message producer. 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 because this might not occur soon enough.

Exceptions

getDeliveryMode

public int getDeliveryMode() throws JMSException;

Gets the producer's default delivery mode.

Returns
Exceptions

getDestination

public Destination getDestination() throws JMSException;

Gets the destination associated with the message producer.

Returns
Exceptions

getDisableMessageID

public boolean getDisableMessageID() throws JMSException;

Indicates whether message IDs are disabled.

Returns
Exceptions

getDisableMessageTimestamp

public boolean getDisableMessageTimestamp() throws JMSException;

Indicates whether message timestamps are disabled.

Returns
Exceptions

getPriority

public int getPriority() throws JMSException;

Gets the producer's default priority.

Returns
Exceptions

getTimeToLive

public long getTimeToLive() throws JMSException;

Gets the default length of time that a produced message will be retained by the message system.

Returns
Exceptions

send

public void send(Destination destination, Message message) 
              throws JMSException;

Sends a message to a destination if you are using a message producer for which no destination was specified when the message producer was created. The method uses the message producer's default delivery mode, default priority, and default message lifetime. Typically, you specify a destination when you create a message producer but, if you do not, you must specify a destination every time you send a message.

Parameters
Exceptions

send

public void send(Destination destination, Message message, 
                 int deliveryMode, int priority, long timeToLive) 
              throws JMSException;

Sends a message to a destination if you are using a message producer for which no destination was specified when the message producer was created. The method specifies a delivery mode, a priority, and message lifetime. Typically, you specify a destination when you create a message producer but, if do not, you must specify a destination every time you send a message.

Parameters
Exceptions

send

public void send(Message message) throws JMSException;

Sends a message. Uses the message producer's default delivery mode, default priority, and default time to live.

Parameters
Exceptions

send

public void send(Message message, int deliveryMode, int priority, 
                 long timeToLive) throws JMSException;

Sends a message specifying a delivery mode, a priority, and the lifetime of the message.

Parameters
Exceptions

setDeliveryMode

public void setDeliveryMode(int deliveryMode) throws JMSException;

Sets the producer's default delivery mode.

Parameters
Exceptions

setDisableMessageID

public void setDisableMessageID(boolean value) throws JMSException;

Sets whether message IDs are disabled.

Note: This method is ignored in the WebSphere MQ classes for Java Message Service implementation.

Parameters
Exceptions

setDisableMessageTimestamp

public void setDisableMessageTimestamp(boolean value) throws JMSException;

Sets 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
Exceptions

setPriority

public void setPriority(int priority) throws JMSException;

Sets the producer's default priority.

Parameters
Exceptions

setTimeToLive

public void setTimeToLive(long timeToLive) throws JMSException;

Sets the default length of time that the message system retains a produced message.

Note that this method throws a JMSException if set to other than 0 when you make a direct connection to a broker.

Parameters
Exceptions