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.
- close *
-
public void close() throws JMSException
Because a provider may allocate some resources outside of the JVM on behalf
of a QueueSender, 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 due to 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 only be used 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 only be used 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.