51.3. Methods

The TopicPublisher interface inherits the fields and the methods of the interface javax.jms.MessageProducer. The following methods are defined in the interface javax.jms.TopicPublisher.

getTopic

public Topic getTopic()

Gets the topic associated with this TopicPublisher.

RETURNS:

this publisher's topic

THROWS:

JMSException if the JMS provider fails to get the topic for this TopicPublisher due to some internal error

publish(Message)

public void publish(Message message)

Publishes a message to the topic. Uses the TopicPublisher's default delivery mode, priority, and time to live.

PARAMETERS:

message the message to publish

THROWS:

JMSException if the JMS provider fails to publish the message due to some internal error
MessageFormatException ...

Get Java™ Message Service API Tutorial and Reference: Messaging for the J2EE™ Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.