javax.jms
Interface QueueSender


public interface QueueSender
extends MessageProducer

A client uses a QueueSender to send messages to a queue.

Normally the Queue is specified when a QueueSender is created and in this case, attempting to use the methods for an unidentified QueueSender will throws an UnsupportedOperationException.

In the case that the QueueSender with an unidentified Queue is created, the methods that assume the Queue has been identified throw an UnsupportedOperationException.

See Also:
MessageProducer, QueueSession.createSender(Queue)

Method Summary
 Queue getQueue()
          Get the queue associated with this queue sender.
 void send(Message message)
          Send a message to the queue.
 void send(Message message, int deliveryMode, int priority, long timeToLive)
          Send a message specifying delivery mode, priority and time to live to the queue.
 void send(Queue queue, Message message)
          Send a message to a queue for an unidentified message producer.
 void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive)
          Send a message to a queue for an unidentified message producer, specifying delivery mode, priority and time to live.
 
Methods inherited from interface javax.jms.MessageProducer
close, getDeliveryMode, getDisableMessageID, getDisableMessageTimestamp, getPriority, getTimeToLive, setDeliveryMode, setDisableMessageID, setDisableMessageTimestamp, setPriority, setTimeToLive
 

Method Detail

getQueue

public Queue getQueue()
               throws JMSException
Get the queue associated with this queue sender.
Returns:
the queue
Throws:
JMSException - if JMS fails to get queue for this queue sender due to some internal error.

send

public void send(Message message)
          throws JMSException
Send a message to the queue. Use the QueueSender's default delivery mode, timeToLive and priority.
Parameters:
message - the message to be sent
Throws:
JMSException - if JMS fails to send the message due to some internal error.
MessageFormatException - if invalid message specified
InvalidDestinationException - if a client uses this method with a Queue sender with an invalid 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 due to some internal error.
MessageFormatException - if invalid message specified
InvalidDestinationException - if a client uses this method with a Queue sender with an invalid queue.

send

public void send(Queue queue,
                 Message message)
          throws JMSException
Send a message to a queue for an unidentified message producer. Use the QueueSender's default delivery mode, timeToLive and priority.

Typically a JMS message producer is assigned a queue at creation time; however, JMS also supports unidentified message producers which require that the queue be supplied on every message send.

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 due to some internal error.
MessageFormatException - if invalid message specified
InvalidDestinationException - if a client uses this method with an invalid queue.

send

public void send(Queue queue,
                 Message message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException
Send a message to a queue for an unidentified message producer, specifying delivery mode, priority and time to live.

Typically a JMS message producer is assigned a queue at creation time; however, JMS also supports unidentified message producers which require that the queue be supplied on every message send.

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 due to some internal error.
MessageFormatException - if invalid message specified
InvalidDestinationException - if a client uses this method with an invalid queue.