org.jboss.jms.client
Class JBossProducer

java.lang.Object
  extended byorg.jboss.jms.client.JBossProducer
All Implemented Interfaces:
MessageProducer (src) , QueueSender (src) , TopicPublisher (src)

public class JBossProducer
extends java.lang.Object
implements MessageProducer (src) , QueueSender (src) , TopicPublisher (src)

A producer


Constructor Summary
JBossProducer(ProducerDelegate (src)  delegate, Destination (src)  destination)
          Create a new JBossProducer
 
Method Summary
 void close()
          Closes the message producer.
 int getDeliveryMode()
          Gets the producer's default delivery mode.
 Destination (src) getDestination()
          Gets the destination associated with this MessageProducer.
 boolean getDisableMessageID()
          Gets an indication of whether message IDs are disabled.
 boolean getDisableMessageTimestamp()
          Gets an indication of whether message timestamps are disabled.
 int getPriority()
          Gets the producer's default priority.
 Queue (src) getQueue()
          Gets the queue associated with this QueueSender.
 long getTimeToLive()
          Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
 Topic (src) getTopic()
          Gets the topic associated with this TopicPublisher.
 void publish(Message (src)  message)
          Publishes a message to the topic.
 void publish(Message (src)  message, int deliveryMode, int priority, long timeToLive)
          Publishes a message to the topic, specifying delivery mode, priority, and time to live.
 void publish(Topic (src)  topic, Message (src)  message)
          Publishes a message to a topic for an unidentified message producer.
 void publish(Topic (src)  topic, Message (src)  message, int deliveryMode, int priority, long timeToLive)
          Publishes a message to a topic for an unidentified message producer, specifying delivery mode, priority and time to live.
 void send(Destination (src)  destination, Message (src)  message)
          Sends a message to a destination for an unidentified message producer.
 void send(Destination (src)  destination, Message (src)  message, int deliveryMode, int priority, long timeToLive)
          Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live.
 void send(Message (src)  message)
          Sends a message using the MessageProducer's default delivery mode, priority, and time to live.
 void send(Message (src)  message, int deliveryMode, int priority, long timeToLive)
          Sends a message to the destination, specifying delivery mode, priority, and time to live.
 void send(Queue (src)  queue, Message (src)  message)
          Sends a message to a queue for an unidentified message producer.
 void send(Queue (src)  queue, Message (src)  message, int deliveryMode, int priority, long timeToLive)
          Sends a message to a queue for an unidentified message producer, specifying delivery mode, priority and time to live.
 void setDeliveryMode(int deliveryMode)
          Sets the producer's default delivery mode.
 void setDisableMessageID(boolean value)
          Sets whether message IDs are disabled.
 void setDisableMessageTimestamp(boolean value)
          Sets whether message timestamps are disabled.
 void setPriority(int defaultPriority)
          Sets the producer's default priority.
 void setTimeToLive(long timeToLive)
          Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossProducer

public JBossProducer(ProducerDelegate (src)  delegate,
                     Destination (src)  destination)
              throws JMSException (src) 
Create a new JBossProducer

Parameters:
delegate - the delegate
destination - the destination
Throws:
JMSException (src) - for any error
Method Detail

close

public void close()
           throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Closes the message producer.

Since a provider may allocate some resources on behalf of a MessageProducer outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

Specified by:
close in interface MessageProducer (src)
Throws:
JMSException (src) - if the JMS provider fails to close the producer due to some internal error.

getDeliveryMode

public int getDeliveryMode()
                    throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Gets the producer's default delivery mode.

Specified by:
getDeliveryMode in interface MessageProducer (src)
Returns:
the message delivery mode for this message producer
Throws:
JMSException (src) - if the JMS provider fails to get the delivery mode due to some internal error.
See Also:
MessageProducer.setDeliveryMode(int)

getDestination

public Destination (src)  getDestination()
                           throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Gets the destination associated with this MessageProducer.

Specified by:
getDestination in interface MessageProducer (src)
Returns:
this producer's Destination/
Throws:
JMSException (src) - if the JMS provider fails to get the destination for this MessageProducer due to some internal error.

getDisableMessageID

public boolean getDisableMessageID()
                            throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Gets an indication of whether message IDs are disabled.

Specified by:
getDisableMessageID in interface MessageProducer (src)
Returns:
an indication of whether message IDs are disabled
Throws:
JMSException (src) - if the JMS provider fails to determine if message IDs are disabled due to some internal error.

getDisableMessageTimestamp

public boolean getDisableMessageTimestamp()
                                   throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Gets an indication of whether message timestamps are disabled.

Specified by:
getDisableMessageTimestamp in interface MessageProducer (src)
Returns:
an indication of whether message timestamps are disabled
Throws:
JMSException (src) - if the JMS provider fails to determine if timestamps are disabled due to some internal error.

getPriority

public int getPriority()
                throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Gets the producer's default priority.

Specified by:
getPriority in interface MessageProducer (src)
Returns:
the message priority for this message producer
Throws:
JMSException (src) - if the JMS provider fails to get the priority due to some internal error.
See Also:
MessageProducer.setPriority(int)

getTimeToLive

public long getTimeToLive()
                   throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.

Specified by:
getTimeToLive in interface MessageProducer (src)
Returns:
the message time to live in milliseconds; zero is unlimited
Throws:
JMSException (src) - if the JMS provider fails to get the time to live due to some internal error.
See Also:
MessageProducer.setTimeToLive(long)

send

public void send(Destination (src)  destination,
                 Message (src)  message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live.

Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.

Specified by:
send in interface MessageProducer (src)
Parameters:
destination - the destination to send 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 (src) - if the JMS provider fails to send the message due to some internal error.
See Also:
Session.createProducer(javax.jms.Destination)

send

public void send(Destination (src)  destination,
                 Message (src)  message)
          throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sends a message to a destination for an unidentified message producer. Uses the MessageProducer's default delivery mode, priority, and time to live.

Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.

Specified by:
send in interface MessageProducer (src)
Parameters:
destination - the destination to send this message to
message - the message to send
Throws:
JMSException (src) - if the JMS provider fails to send the message due to some internal error.
See Also:
Session.createProducer(javax.jms.Destination), MessageProducer (src)

send

public void send(Message (src)  message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sends a message to the destination, specifying delivery mode, priority, and time to live.

Specified by:
send in interface MessageProducer (src)
Parameters:
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 (src) - if the JMS provider fails to send the message due to some internal error.
See Also:
Session.createProducer(javax.jms.Destination)

send

public void send(Message (src)  message)
          throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sends a message using the MessageProducer's default delivery mode, priority, and time to live.

Specified by:
send in interface MessageProducer (src)
Parameters:
message - the message to send
Throws:
JMSException (src) - if the JMS provider fails to send the message due to some internal error.
See Also:
Session.createProducer(javax.jms.Destination), MessageProducer (src)

setDeliveryMode

public void setDeliveryMode(int deliveryMode)
                     throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sets the producer's default delivery mode.

Delivery mode is set to PERSISTENT by default.

Specified by:
setDeliveryMode in interface MessageProducer (src)
Parameters:
deliveryMode - the message delivery mode for this message producer; legal values are DeliveryMode.NON_PERSISTENT and DeliveryMode.PERSISTENT
Throws:
JMSException (src) - if the JMS provider fails to set the delivery mode due to some internal error.
See Also:
MessageProducer.getDeliveryMode(), DeliveryMode.NON_PERSISTENT, DeliveryMode.PERSISTENT, Message.DEFAULT_DELIVERY_MODE

setDisableMessageID

public void setDisableMessageID(boolean value)
                         throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sets whether message IDs are disabled.

Since message IDs take some effort to create and increase a message's size, some JMS providers may be able to optimize message overhead if they are given a hint that the message ID is not used by an application. By calling the setDisableMessageID method on this message producer, a JMS client enables this potential optimization for all messages sent by this message producer. If the JMS provider accepts this hint, these messages must have the message ID set to null; if the provider ignores the hint, the message ID must be set to its normal unique value.

Message IDs are enabled by default.

Specified by:
setDisableMessageID in interface MessageProducer (src)
Parameters:
value - indicates if message IDs are disabled
Throws:
JMSException (src) - if the JMS provider fails to set message ID to disabled due to some internal error.

setDisableMessageTimestamp

public void setDisableMessageTimestamp(boolean value)
                                throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sets whether message timestamps are disabled.

Since timestamps take some effort to create and increase a message's size, some JMS providers may be able to optimize message overhead if they are given a hint that the timestamp is not used by an application. By calling the setDisableMessageTimestamp method on this message producer, a JMS client enables this potential optimization for all messages sent by this message producer. If the JMS provider accepts this hint, these messages must have the timestamp set to zero; if the provider ignores the hint, the timestamp must be set to its normal value.

Message timestamps are enabled by default.

Specified by:
setDisableMessageTimestamp in interface MessageProducer (src)
Parameters:
value - indicates if message timestamps are disabled
Throws:
JMSException (src) - if the JMS provider fails to set timestamps to disabled due to some internal error.

setPriority

public void setPriority(int defaultPriority)
                 throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sets the producer's default priority.

The JMS API defines ten levels of priority value, with 0 as the lowest priority and 9 as the highest. Clients should consider priorities 0-4 as gradations of normal priority and priorities 5-9 as gradations of expedited priority. Priority is set to 4 by default.

Specified by:
setPriority in interface MessageProducer (src)
Parameters:
defaultPriority - the message priority for this message producer; must be a value between 0 and 9
Throws:
JMSException (src) - if the JMS provider fails to set the priority due to some internal error.
See Also:
MessageProducer.getPriority(), Message.DEFAULT_PRIORITY

setTimeToLive

public void setTimeToLive(long timeToLive)
                   throws JMSException (src) 
Description copied from interface: MessageProducer (src)
Sets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.

Time to live is set to zero by default.

Specified by:
setTimeToLive in interface MessageProducer (src)
Parameters:
timeToLive - the message time to live in milliseconds; zero is unlimited
Throws:
JMSException (src) - if the JMS provider fails to set the time to live due to some internal error.
See Also:
MessageProducer.getTimeToLive(), Message.DEFAULT_TIME_TO_LIVE

getQueue

public Queue (src)  getQueue()
               throws JMSException (src) 
Description copied from interface: QueueSender (src)
Gets the queue associated with this QueueSender.

Specified by:
getQueue in interface QueueSender (src)
Returns:
this sender's queue
Throws:
JMSException (src) - if the JMS provider fails to get the queue for this QueueSender due to some internal error.

send

public void send(Queue (src)  queue,
                 Message (src)  message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException (src) 
Description copied from interface: QueueSender (src)
Sends a message to a queue for an unidentified message producer, specifying delivery mode, priority and time to live.

Typically, a message producer is assigned a queue at creation time; however, the JMS API also supports unidentified message producers, which require that the queue be supplied every time a message is sent.

Specified by:
send in interface QueueSender (src)
Parameters:
queue - the queue to send 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 (src) - if the JMS provider fails to send the message due to some internal error.

send

public void send(Queue (src)  queue,
                 Message (src)  message)
          throws JMSException (src) 
Description copied from interface: QueueSender (src)
Sends a message to a queue for an unidentified message producer. Uses the QueueSender's default delivery mode, priority, and time to live.

Typically, a message producer is assigned a queue at creation time; however, the JMS API also supports unidentified message producers, which require that the queue be supplied every time a message is sent.

Specified by:
send in interface QueueSender (src)
Parameters:
queue - the queue to send this message to
message - the message to send
Throws:
JMSException (src) - if the JMS provider fails to send the message due to some internal error.
See Also:
MessageProducer.getDeliveryMode(), MessageProducer.getTimeToLive(), MessageProducer.getPriority()

getTopic

public Topic (src)  getTopic()
               throws JMSException (src) 
Description copied from interface: TopicPublisher (src)
Gets the topic associated with this TopicPublisher.

Specified by:
getTopic in interface TopicPublisher (src)
Returns:
this publisher's topic
Throws:
JMSException (src) - if the JMS provider fails to get the topic for this TopicPublisher due to some internal error.

publish

public void publish(Message (src)  message,
                    int deliveryMode,
                    int priority,
                    long timeToLive)
             throws JMSException (src) 
Description copied from interface: TopicPublisher (src)
Publishes a message to the topic, specifying delivery mode, priority, and time to live.

Specified by:
publish in interface TopicPublisher (src)
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 (src) - if the JMS provider fails to publish the message due to some internal error.

publish

public void publish(Message (src)  message)
             throws JMSException (src) 
Description copied from interface: TopicPublisher (src)
Publishes a message to the topic. Uses the TopicPublisher's default delivery mode, priority, and time to live.

Specified by:
publish in interface TopicPublisher (src)
Parameters:
message - the message to publish
Throws:
JMSException (src) - if the JMS provider fails to publish the message due to some internal error.
See Also:
MessageProducer.getDeliveryMode(), MessageProducer.getTimeToLive(), MessageProducer.getPriority()

publish

public void publish(Topic (src)  topic,
                    Message (src)  message,
                    int deliveryMode,
                    int priority,
                    long timeToLive)
             throws JMSException (src) 
Description copied from interface: TopicPublisher (src)
Publishes a message to a topic for an unidentified message producer, specifying delivery mode, priority and time to live.

Typically, a message producer is assigned a topic at creation time; however, the JMS API also supports unidentified message producers, which require that the topic be supplied every time a message is published.

Specified by:
publish in interface TopicPublisher (src)
Parameters:
topic - the topic to publish this message to
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 (src) - if the JMS provider fails to publish the message due to some internal error.

publish

public void publish(Topic (src)  topic,
                    Message (src)  message)
             throws JMSException (src) 
Description copied from interface: TopicPublisher (src)
Publishes a message to a topic for an unidentified message producer. Uses the TopicPublisher's default delivery mode, priority, and time to live.

Typically, a message producer is assigned a topic at creation time; however, the JMS API also supports unidentified message producers, which require that the topic be supplied every time a message is published.

Specified by:
publish in interface TopicPublisher (src)
Parameters:
topic - the topic to publish this message to
message - the message to publish
Throws:
JMSException (src) - if the JMS provider fails to publish the message due to some internal error.
See Also:
MessageProducer.getDeliveryMode(), MessageProducer.getTimeToLive(), MessageProducer.getPriority()