All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.jms.TopicPublisher Maven / Gradle / Ivy

The newest version!
/**
 * Copyright 2013 ScalAgent Distributed Technologies
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  ---------------------------------------------------------------------
 *  $Id: TopicPublisher.java 6347 2013-03-13 08:52:02Z tachker $
 *  ---------------------------------------------------------------------
 */

package javax.jms;

/**
 * A client uses a {@code TopicPublisher} object to publish messages on a topic.
 * A {@code TopicPublisher} object is the publish-subscribe form of a message
 * producer.
 * 
 * @see Session#createProducer(Destination)
 * @see TopicSession#createPublisher(Topic)
 * 
 * @version JMS 2.0
 * @since JMS 1.0
 * 
 */

public interface TopicPublisher extends MessageProducer {

  /**
   * Gets the topic associated with this {@code TopicPublisher}.
   * 
   * @return this publisher's topic
   * 
   * @exception JMSException
   *              if the JMS provider fails to get the topic for this
   *              {@code TopicPublisher} due to some internal error.
   */

  Topic getTopic() throws JMSException;

  /**
   * Publishes a message to the topic. Uses the {@code TopicPublisher}'s default
   * delivery mode, priority, and time to live.
   * 
   * @param message
   *          the message to publish
   * 
   * @exception JMSException
   *              if the JMS provider fails to publish the message due to some
   *              internal error.
   * @exception MessageFormatException
   *              if an invalid message is specified.
   * @exception InvalidDestinationException
   *              if a client uses this method with a {@code TopicPublisher}
   *              with an invalid topic.
   * @exception java.lang.UnsupportedOperationException
   *              if a client uses this method with a {@code TopicPublisher}
   *              that did not specify a topic at creation time.
   * 
   * @see javax.jms.MessageProducer#getDeliveryMode()
   * @see javax.jms.MessageProducer#getTimeToLive()
   * @see javax.jms.MessageProducer#getPriority()
   */

  void publish(Message message) throws JMSException;

  /**
   * Publishes a message to the topic, specifying delivery mode, priority, and
   * time to live.
   * 
   * @param message
   *          the message to publish
   * @param deliveryMode
   *          the delivery mode to use
   * @param priority
   *          the priority for this message
   * @param timeToLive
   *          the message's lifetime (in milliseconds)
   * 
   * @exception JMSException
   *              if the JMS provider fails to publish the message due to some
   *              internal error.
   * @exception MessageFormatException
   *              if an invalid message is specified.
   * @exception InvalidDestinationException
   *              if a client uses this method with a {@code TopicPublisher}
   *              with an invalid topic.
   * @exception java.lang.UnsupportedOperationException
   *              if a client uses this method with a {@code TopicPublisher}
   *              that did not specify a topic at creation time.
   */

  void publish(Message message, int deliveryMode, int priority, long timeToLive)
      throws JMSException;

  /**
   * Publishes a message to a topic for an unidentified message producer. Uses
   * the {@code TopicPublisher}'s default delivery mode, priority, and time to
   * live.
   * 
   * @param topic
   *          the topic to publish this message to
   * @param message
   *          the message to publish
   * 
   * @exception JMSException
   *              if the JMS provider fails to publish the message due to some
   *              internal error.
   * @exception MessageFormatException
   *              if an invalid message is specified.
   * @exception InvalidDestinationException
   *              if a client uses this method with an invalid topic.
   * 
   * @see javax.jms.MessageProducer#getDeliveryMode()
   * @see javax.jms.MessageProducer#getTimeToLive()
   * @see javax.jms.MessageProducer#getPriority()
   */

  void publish(Topic topic, Message message) throws JMSException;

  /**
   * Publishes a message to a topic for an unidentified message producer,
   * specifying delivery mode, priority and time to live.
   * 
   * @param topic
   *          the topic to publish this message to
   * @param message
   *          the message to publish
   * @param deliveryMode
   *          the delivery mode to use
   * @param priority
   *          the priority for this message
   * @param timeToLive
   *          the message's lifetime (in milliseconds)
   * 
   * @exception JMSException
   *              if the JMS provider fails to publish the message due to some
   *              internal error.
   * @exception MessageFormatException
   *              if an invalid message is specified.
   * @exception InvalidDestinationException
   *              if a client uses this method with an invalid topic.
   */

  void publish(Topic topic, Message message, int deliveryMode, int priority,
      long timeToLive) throws JMSException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy