com.ibm.mq.jms

Class MQQueueSender

  • All Implemented Interfaces:
    JmsMessageProducer, JmsPropertyContext, JmsQueueSender, JmsReadablePropertyContext, java.io.Serializable, java.lang.AutoCloseable, java.util.Map<java.lang.String,java.lang.Object>, javax.jms.MessageProducer, javax.jms.QueueSender


    public class MQQueueSender
    extends MQMessageProducer
    implements javax.jms.QueueSender, JmsQueueSender
    A client uses an MQQueueSender 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, Serialized Form
    • Method Detail

      • close

        public void close()
                   throws javax.jms.JMSException
        Close the sender. Releases underlying resources associated with this sender.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface javax.jms.MessageProducer
        Overrides:
        close in class MQMessageProducer
        Throws:
        javax.jms.JMSException - if underlying MQ calls fail.
      • getQueue

        public javax.jms.Queue getQueue()
                                 throws javax.jms.JMSException
        Gets the Queue associated with this sender.
        Specified by:
        getQueue in interface javax.jms.QueueSender
        Returns:
        the queue
        Throws:
        javax.jms.JMSException - if the operation fails
      • send

        public void send(javax.jms.Queue queue,
                javax.jms.Message message)
                  throws javax.jms.JMSException
        Sends 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.

        Specified by:
        send in interface javax.jms.QueueSender
        Parameters:
        queue - the queue that this message should be sent to
        message - the message to be sent
        Throws:
        javax.jms.JMSException - if the operation fails
      • send

        public void send(javax.jms.Queue queue,
                javax.jms.Message message,
                int deliveryMode,
                int priority,
                long timeToLive)
                  throws javax.jms.JMSException
        Sends 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.

        Specified by:
        send in interface javax.jms.QueueSender
        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:
        javax.jms.JMSException - if the operation fails
(c) Copyright IBM Corp. 2008, 2015. All Rights Reserved.