QueueSender
public interface QueueSender
extends MessageProducer
WebSphere MQ class: MQQueueSender
java.lang.Object | +----com.ibm.mq.jms.MQMessageProducer | +----com.ibm.mq.jms.MQQueueSenderA client uses a QueueSender to send messages to a queue.
A QueueSender is normally associated with a particular queue. However, it is possible to create an unidentified QueueSender that is not associated with any given queue.
See also: MessageProducer
Methods
- close *
public void close() throws JMSException
Because a provider can allocate some resources outside the JVM on behalf of a QueueSender, 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 some error.
- Overrides:
- Close in class MQMessageProducer.
- getQueue
public Queue getQueue() throws JMSException
Get the queue associated with this queue sender.
- Returns:
- The queue.
- Throws:
- JMSException if JMS fails to get the queue for this queue sender because of an internal error.
- send
public void send(Message message) throws JMSException
Send a message to the queue. Use the QueueSender's default delivery mode, time-to-live, and priority.
- Parameters:
- message: the message to be sent.
- Throws:
- JMSException if JMS fails to send the message because of an error.
- MessageFormatException if a non valid message is specified.
- InvalidDestinationException if a client uses this method with a queue sender with a non valid queue.
- send
public void send(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
Send a message specifying delivery mode, priority, and time-to-live to the queue.
- Parameters:
- message: the message to be sent.
- deliveryMode: the delivery mode to use.
- priority: the priority for this message.
- timeToLive: the message's lifetime (in milliseconds).
- Throws:
- JMSException if JMS fails to send the message because of an internal error.
- MessageFormatException if a non valid message is specified.
- InvalidDestinationException if a client uses this method with a queue sender with a non valid queue.
- send
public void send(Queue queue, Message message) throws JMSException
Send a message to the specified queue with the QueueSender's default delivery mode, time-to-live, and priority.
- Note:
- This method can be used only with unidentified QueueSenders.
- Parameters:
- queue:- the queue that this message should be sent to.
- message: the message to be sent.
- Throws:
- JMSException if JMS fails to send the message because of an internal error.
- MessageFormatException if a non valid message is specified.
- InvalidDestinationException if a client uses this method with a non valid queue.
- send
public void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
Send a message to the specified queue with delivery mode, priority, and time-to-live.
- Note:
- This method can be used only with unidentified QueueSenders.
- Parameters:
- queue: the queue that this message should be sent to.
- message: the message to be sent.
- deliveryMode: the delivery mode to use.
- priority: the priority for this message.
- timeToLive: the message's lifetime (in milliseconds).
- Throws:
- JMSException if JMS fails to send the message because of an internal error.
- MessageFormatException if a non valid message is specified.
- InvalidDestinationException if a client uses this method with a non valid queue.
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.