TopicPublisher


public interface TopicPublisher
extends MessageProducer

WebSphere MQ class: MQTopicPublisher



java.lang.Object
   |
   +----com.ibm.mq.jms.MQMessageProducer
           |
           +----com.ibm.mq.jms.MQTopicPublisher

A client uses a TopicPublisher for publishing messages on a topic. TopicPublisher is the Pub/Sub variant of a JMS message producer.

Methods

close *
public void close() throws JMSException

Because a provider may allocate some resources outside of the JVM on behalf of a TopicPublisher, 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 because of an error.

Overrides:
close in class MQMessageProducer.

getTopic
public Topic getTopic() throws JMSException

Get the topic associated with this publisher.

Returns:
this publisher's topic

Throws:
JMSException - if JMS fails to get the topic for this topic publisher because of an internal error.

publish
public void publish(Message message) throws JMSException

Publish a Message to the topic Use the topic's default delivery mode, time to live, and priority.

Parameters:
message - the message to publish

Throws:
  • JMSException - if JMS fails to publish the message because of an internal error.
  • MessageFormatException - if a non valid message is specified.
  • InvalidDestinationException - if a client uses this method with a Topic Publisher with a non valid topic.

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

Publish a Message to the topic specifying delivery mode, priority, and time to live to the topic.

WebSphere MQ Event Broker note

If deliveryMode is PERSISTENT or timeToLive is greater than 0, this method throws a JMSException when you have a direct connection to WebSphere MQ Event Broker.

Parameters:
  • message - the message to publish.
  • 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 publish the message because of an internal error.
  • MessageFormatException - if a non valid message is specified.
  • InvalidDestinationException - if a client uses this method with a Topic Publisher with a non valid topic.

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

Publish a Message to a topic for an unidentified message producer. Use the topic's default delivery mode, time to live, and priority.

Parameters:
  • topic - the topic to publish this message to.
  • message - the message to send.

Throws:
  • JMSException - if JMS fails to publish 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 topic.

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

Publish a Message to a topic for an unidentified message producer, specifying delivery mode, priority, and time to live.

WebSphere MQ Event Broker note

If deliveryMode is PERSISTENT or timeToLive is greater than 0, this method throws a JMSException when you have a direct connection to WebSphere MQ Event Broker.

Parameters:
  • topic - the topic to publish this message to.
  • message - the message to send.
  • 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 publish 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 topic.



© IBM Corporation 1997, 2002. All Rights Reserved