com.ibm.mq.jms

Class MQMessageProducer

    • Method Detail

      • close

        public void close()
                   throws javax.jms.JMSException
        Closes the message producer. Because a provider can allocate some resources outside the JVM on behalf of message producers, clients must close them when they are not needed. You cannot rely on garbage collection to reclaim these resources because this might not occur soon enough.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException - if the operation does not succeed
      • getDeliveryMode

        public int getDeliveryMode()
                            throws javax.jms.JMSException
        Gets the producer's default delivery mode.
        Specified by:
        getDeliveryMode in interface javax.jms.MessageProducer
        Returns:
        the message delivery mode for this message producer.
        Throws:
        javax.jms.JMSException - if the operation fails.
        See Also:
        setDeliveryMode(int)
      • getDestination

        public javax.jms.Destination getDestination()
                                             throws javax.jms.JMSException
        Gets the destination associated with the message producer.
        Specified by:
        getDestination in interface javax.jms.MessageProducer
        Returns:
        the message destination.
        Throws:
        javax.jms.JMSException - if the operation fails
      • getDisableMessageID

        public boolean getDisableMessageID()
                                    throws javax.jms.JMSException
        Indicates whether message IDs are disabled.
        Specified by:
        getDisableMessageID in interface javax.jms.MessageProducer
        Returns:
        true if message IDs are disabled.
        Throws:
        javax.jms.JMSException - if the operation fails
      • getDisableMessageTimestamp

        public boolean getDisableMessageTimestamp()
                                           throws javax.jms.JMSException
        Indicates whether message timestamps are disabled.
        Specified by:
        getDisableMessageTimestamp in interface javax.jms.MessageProducer
        Returns:
        true indicates that timestamps are disabled.
        Throws:
        javax.jms.JMSException - if the operation fails
      • getPriority

        public int getPriority()
                        throws javax.jms.JMSException
        Gets the producer's default priority.
        Specified by:
        getPriority in interface javax.jms.MessageProducer
        Returns:
        the message priority for this message producer.
        Throws:
        javax.jms.JMSException - if the operation fails
        See Also:
        setPriority(int)
      • getTimeToLive

        public long getTimeToLive()
                           throws javax.jms.JMSException
        Gets the default length of time that a produced message will be retained by the message system.
        Specified by:
        getTimeToLive in interface javax.jms.MessageProducer
        Returns:
        the length of time from its dispatch that a message is retained by default (milliseconds).
        Throws:
        javax.jms.JMSException - if the operation fails
        See Also:
        setTimeToLive(long)
      • send

        public void send(javax.jms.Message message)
                  throws javax.jms.JMSException
        Sends a message. Uses the message producer's default delivery mode, default priority, and default time to live.
        Specified by:
        send in interface javax.jms.MessageProducer
        Parameters:
        message - the message to be sent.
        Throws:
        javax.jms.JMSException - if the operation fails
      • send

        public void send(javax.jms.Message message,
                int deliveryMode,
                int priority,
                long timeToLive)
                  throws javax.jms.JMSException
        Sends a message specifying a delivery mode, a priority, and the lifetime of the message.
        Specified by:
        send in interface javax.jms.MessageProducer
        Parameters:
        message - the message to send.
        deliveryMode - the delivery mode to use.
        priority - the priority for the message
        timeToLive - the lifetime of the message in milliseconds.
        Throws:
        javax.jms.JMSException - if the operation fails
      • setDeliveryMode

        public void setDeliveryMode(int deliveryMode)
                             throws javax.jms.JMSException
        Sets the producer's default delivery mode.
        Specified by:
        setDeliveryMode in interface javax.jms.MessageProducer
        Parameters:
        deliveryMode - the message delivery mode for this message producer. Possible values are:
        • DeliveryMode.NON_PERSISTENT
        • DeliveryMode.PERSISTENT, the default
        Throws:
        javax.jms.JMSException - if the operation fails
        See Also:
        getDeliveryMode(), Message.DEFAULT_DELIVERY_MODE
      • setDisableMessageID

        public void setDisableMessageID(boolean value)
                                 throws javax.jms.JMSException
        Sets whether message IDs are disabled.

        Note: This method is ignored in the WebSphere MQ Java Message Service extensions implementation.

        Specified by:
        setDisableMessageID in interface javax.jms.MessageProducer
        Parameters:
        value - true if message IDs are disabled. Message IDs are enabled by default.
        Throws:
        javax.jms.JMSException - if the operation fails
      • setDisableMessageTimestamp

        public void setDisableMessageTimestamp(boolean value)
                                        throws javax.jms.JMSException
        Sets whether message timestamps are disabled. They are enabled by default.

        Specified by:
        setDisableMessageTimestamp in interface javax.jms.MessageProducer
        Parameters:
        value - true indicates that timestamps are disabled.
        Throws:
        javax.jms.JMSException - if the operation fails
      • setPriority

        public void setPriority(int priority)
                         throws javax.jms.JMSException
        Sets the producer's default priority.
        Specified by:
        setPriority in interface javax.jms.MessageProducer
        Parameters:
        priority - the message priority for this message producer. Possible values are:
        Throws:
        javax.jms.JMSException - if the operation fails
        See Also:
        getPriority(), Message.DEFAULT_PRIORITY
      • setTimeToLive

        public void setTimeToLive(long timeToLive)
                           throws javax.jms.JMSException
        Sets the default length of time that the message system retains a produced message.

        Note that this method throws a JMSException if set to other than 0 when you make a real-time connection to a broker.

        Specified by:
        setTimeToLive in interface javax.jms.MessageProducer
        Parameters:
        timeToLive - the length of time from its dispatch that a message is retained by default (milliseconds). The default is zero which means unlimited time.
        Throws:
        javax.jms.JMSException - if the operation fails
        See Also:
        getTimeToLive(), Message.DEFAULT_TIME_TO_LIVE
      • getDeliveryDelay

        public long getDeliveryDelay()
                              throws javax.jms.JMSException
        Specified by:
        getDeliveryDelay in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
        See Also:
        MessageProducer.getDeliveryDelay()
      • send

        public void send(javax.jms.Message message,
                javax.jms.CompletionListener completionListener)
                  throws javax.jms.JMSException,
                         javax.jms.MessageFormatException,
                         javax.jms.InvalidDestinationException,
                         java.lang.IllegalArgumentException,
                         java.lang.UnsupportedOperationException
        Specified by:
        send in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
        javax.jms.MessageFormatException
        javax.jms.InvalidDestinationException
        java.lang.IllegalArgumentException
        java.lang.UnsupportedOperationException
      • send

        public void send(javax.jms.Destination destination,
                javax.jms.Message message,
                javax.jms.CompletionListener completionListener)
                  throws javax.jms.JMSException,
                         javax.jms.MessageFormatException,
                         javax.jms.InvalidDestinationException,
                         java.lang.IllegalArgumentException,
                         java.lang.UnsupportedOperationException
        Specified by:
        send in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
        javax.jms.MessageFormatException
        javax.jms.InvalidDestinationException
        java.lang.IllegalArgumentException
        java.lang.UnsupportedOperationException
      • send

        public void send(javax.jms.Message message,
                int deliveryMode,
                int priority,
                long timeToLive,
                javax.jms.CompletionListener completionListener)
                  throws javax.jms.JMSException,
                         javax.jms.MessageFormatException,
                         javax.jms.InvalidDestinationException,
                         java.lang.IllegalArgumentException,
                         java.lang.UnsupportedOperationException
        Specified by:
        send in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
        javax.jms.MessageFormatException
        javax.jms.InvalidDestinationException
        java.lang.IllegalArgumentException
        java.lang.UnsupportedOperationException
      • send

        public void send(javax.jms.Destination destination,
                javax.jms.Message message,
                int deliveryMode,
                int priority,
                long timeToLive,
                javax.jms.CompletionListener completionListener)
                  throws javax.jms.JMSException,
                         javax.jms.MessageFormatException,
                         javax.jms.InvalidDestinationException,
                         java.lang.IllegalArgumentException,
                         java.lang.UnsupportedOperationException
        Specified by:
        send in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
        javax.jms.MessageFormatException
        javax.jms.InvalidDestinationException
        java.lang.IllegalArgumentException
        java.lang.UnsupportedOperationException
      • setDeliveryDelay

        public void setDeliveryDelay(long deliveryDelay)
                              throws javax.jms.JMSException
        Specified by:
        setDeliveryDelay in interface javax.jms.MessageProducer
        Throws:
        javax.jms.JMSException
        See Also:
        MessageProducer.setDeliveryDelay(long)
(c) Copyright IBM Corp. 2008, 2015. All Rights Reserved.