|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A client uses a TopicPublisher for publishing messages on a topic. TopicPublisher is the Pub/Sub variant of a JMS message producer.
Normally the Topic is specified when a TopicPublisher is created and in this case, attempting to use the methods for an unidentified TopicPublisher will throws an UnsupportedOperationException.
In the case that the TopicPublisher with an unidentified Topic is created, the methods that assume the Topic has been identified throw an UnsupportedOperationException.
TopicSession.createPublisher(Topic)
Method Summary | |
Topic |
getTopic()
Get the topic associated with this publisher. |
void |
publish(Message message)
Publish a Message to the topic Use the topics default delivery mode, timeToLive and priority. |
void |
publish(Message message,
int deliveryMode,
int priority,
long timeToLive)
Publish a Message to the topic specifying delivery mode, priority and time to live to the topic. |
void |
publish(Topic topic,
Message message)
Publish a Message to a topic for an unidentified message producer. |
void |
publish(Topic topic,
Message message,
int deliveryMode,
int priority,
long timeToLive)
Publish a Message to a topic for an unidentified message producer, specifying delivery mode, priority and time to live. |
Methods inherited from interface javax.jms.MessageProducer |
close, getDeliveryMode, getDisableMessageID, getDisableMessageTimestamp, getPriority, getTimeToLive, setDeliveryMode, setDisableMessageID, setDisableMessageTimestamp, setPriority, setTimeToLive |
Method Detail |
public Topic getTopic() throws JMSException
JMSException
- if JMS fails to get topic for
this topic publisher
due to some internal error.public void publish(Message message) throws JMSException
message
- the message to publishJMSException
- if JMS fails to publish the message
due to some internal error.MessageFormatException
- if invalid message specifiedInvalidDestinationException
- if a client uses
this method with a Topic Publisher with
an invalid topic.public void publish(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
message
- the message to publishdeliveryMode
- the delivery mode to usepriority
- the priority for this messagetimeToLive
- the message's lifetime (in milliseconds).JMSException
- if JMS fails to publish the message
due to some internal error.MessageFormatException
- if invalid message specifiedInvalidDestinationException
- if a client uses
this method with a Topic Publisher with
an invalid topic.public void publish(Topic topic, Message message) throws JMSException
Typically a JMS message producer is assigned a topic at creation time; however, JMS also supports unidentified message producers which require that the topic be supplied on every message publish.
topic
- the topic to publish this message tomessage
- the message to sendJMSException
- if JMS fails to publish the message
due to some internal error.MessageFormatException
- if invalid message specifiedInvalidDestinationException
- if a client uses
this method with an invalid topic.public void publish(Topic topic, Message message, int deliveryMode, int priority, long timeToLive) throws JMSException
Typically a JMS message producer is assigned a topic at creation time; however, JMS also supports unidentified message producers which require that the topic be supplied on every message publish.
topic
- the topic to publish this message tomessage
- the message to senddeliveryMode
- the delivery mode to usepriority
- the priority for this messagetimeToLive
- the message's lifetime (in milliseconds).JMSException
- if JMS fails to publish the message
due to some internal error.MessageFormatException
- if invalid message specifiedInvalidDestinationException
- if a client uses
this method with an invalid topic.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |