MessageProducer


public interface MessageProducer


Subinterfaces: QueueSender and TopicPublisher

WebSphere MQ class: MQMessageProducer



java.lang.Object
   |
   +----com.ibm.mq.jms.MQMessageProducer

A client uses a message producer to send messages to a Destination.

WebSphere MQ constructors

MQMessageProducer
public MQMessageProducer()

Methods

close
public void close() throws JMSException

Because a provider may allocate some resources outside of the JVM on behalf of a MessageProducer, clients should close them when they are not needed. You cannot rely on garbage collection to reclaim these resources eventually, because this may 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:
the 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 a produced message should be retained by the message system.

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.

Delivery mode 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.

Message IDs 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.

Message timestamps 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.

Priority is set to 4, by default.

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 a produced message should be retained by the message system.

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



© IBM Corporation 1997, 2002. All Rights Reserved