Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


oracle.jms
Class AQjmsProducer

java.lang.Object
  extended byoracle.jms.AQjmsObject
      extended byoracle.jms.AQjmsProducer

All Implemented Interfaces:
AQjmsQueueSender, AQjmsTopicPublisher, MessageProducer, QueueSender, TopicPublisher

public class AQjmsProducer
extends oracle.jms.AQjmsObject
implements AQjmsQueueSender, AQjmsTopicPublisher

This is an Oracle class which implements oracle.jms.AQjmsQueueSender and oracle.jms.AQjmsTopicPublisher.

See Also:
AQjmsQueueSender, AQjmsTopicPublisher

Method Summary
void bufferPublish(Topic topic, Message message, int priority, long timeToLive)
Publishes a non-persistent message to an in-memory portion of the topic for an unidentified message producer, specifying delivery mode, priority and time-to-live.
void bufferSend(Destination destination, Message message, int priority, long timeToLive)
Sends a non-persistent message to an in-memory portion of the destination for an unidentified message producer, specifying priority and time-to-live.
void bufferSend(Queue queue, Message message, int priority, long timeToLive)
Sends a non-persistent message to an in-memory portion of the queue for an unidentified message producer, specifying delivery mode, priority and time-to-live.
void close()
Closes the message producer.
int getDeliveryMode()
Gets this producer's default delivery mode.
Destination 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 this producer's default priority.
Queue getQueue()
Gets the queue associated with this queue sender.
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 getTopic()
Gets the topic associated with this publisher.
java.lang.String getTransformation()
Gets this producer's transformation.
void publish(Message message)
Publishes a message.
void publish(Message message, oracle.jms.AQjmsAgent[] recipientList)
Publishes a message to a specific list of recipients
void publish(Message message, oracle.jms.AQjmsAgent[] recipientList, int deliveryMode, int priority, long timeToLive)
Publishes a message to a topic by specifying a list of recipients, delivery mode, priority and time-to-live
void publish(Message message, int deliveryMode, int priority, long timeToLive)
Publishes a message to the topic specifying delivery mode, priority and time-to-live.
void publish(Topic topic, Message message)
Publishes a message to a topic for an unidentified message producer.
void publish(Topic topic, Message message, oracle.jms.AQjmsAgent[] recipientList)
Publishes a message to a topic by specifying a list of recipients.
void publish(Topic topic, Message message, oracle.jms.AQjmsAgent[] recipientList, int deliveryMode, int priority, long timeToLive)
Publishes a message to a topic by specifying a list of recipients, delivery mode, priority and time-to-live
void publish(Topic topic, Message 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 destination, Message message)
Sends a message to a destination for an unidentified message producer.
void send(Destination destination, Message 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 message)
Sends a message.
void send(Message message, int deliveryMode, int priority, long timeToLive)
Sends a message.
void send(Queue queue, Message message)
Sends a message.
void send(Queue queue, Message message, int deliveryMode, int priority, long timeToLive)
Sends a message.
void setDeliveryMode(int deliveryMode)
Sets this producer's default delivery mode.
void setDisableMessageID(boolean value)
Sets whether message IDs can be disabled.
void setDisableMessageTimestamp(boolean value)
Sets whether message timestamps can be disabled.
void setPriority(int priority)
Sets this 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.
void setTransformation(java.lang.String transformation)
Sets this producer's transformation.

Methods inherited from class oracle.jms.AQjmsObject
checkClosed, children, finalize, getID, getParent, isOpen, localClose, preClose

Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

setDisableMessageID

public void setDisableMessageID(boolean value)
                         throws JMSException
Sets whether message IDs can be disabled.

Since message ID's take some effort to create and increase a message's size, some JMS providers may be able to reduce message overhead if they are given a hint that message IDs are not used by an application. When a client sets a Producer to disable message IDs, it is saying that no one depends on the message IDs of the messages it produces. Produced messages must then either have message ID set to null or, if the hint is ignored, have message ID set to its normal unique value.

Message IDs are enabled by default.

Specified by:
setDisableMessageID in interface MessageProducer
Parameters:
value - hint that message IDs can be disabled
Throws:
JMSException - if the disable message IDs hint is not set due to some error.

getDisableMessageID

public boolean getDisableMessageID()
                            throws JMSException
Gets an indication of whether message IDs are disabled.

Note that the returned value reflects the client-provided hint and can therefore only be used to determine whether or not message IDs might be set to null, not if they are being set to null.

Specified by:
getDisableMessageID in interface MessageProducer
Returns:
an indication of whether message IDs are disabled
Throws:
JMSException - if the disable message IDs hint is not retrieved due to some error.

setDisableMessageTimestamp

public void setDisableMessageTimestamp(boolean value)
                                throws JMSException
Sets whether message timestamps can be disabled.

Message timestamps are enabled by default.

Specified by:
setDisableMessageTimestamp in interface MessageProducer
Parameters:
value - hint that message timestamps can be disabled
Throws:
JMSException - if the disable message timestamp hint is not set due to some error.

getDisableMessageTimestamp

public boolean getDisableMessageTimestamp()
                                   throws JMSException
Gets an indication of whether message timestamps are disabled.

Note that the returned value reflects the client-provided hint and can therefore only be used to determine whether or not message timestamps might be set to zero, not if they are being set to zero.

Specified by:
getDisableMessageTimestamp in interface MessageProducer
Returns:
an indication of whether message IDs are disabled
Throws:
JMSException - if the disable message timestamp hint is not retrieved due to some error.

setDeliveryMode

public void setDeliveryMode(int deliveryMode)
                     throws JMSException
Sets this producer's default delivery mode.

Delivery mode is set to PERSISTENT by default.

Specified by:
setDeliveryMode in interface MessageProducer
Parameters:
deliveryMode - the message delivery mode for this message producer (PERSISTENT or NON_PERSISTENT)
Throws:
JMSException - if the delivery mode is not set due to some error.
See Also:
MessageProducer.getDeliveryMode(), DeliveryMode.NON_PERSISTENT, DeliveryMode.PERSISTENT, Message.DEFAULT_DELIVERY_MODE

getDeliveryMode

public int getDeliveryMode()
                    throws JMSException
Gets this producer's default delivery mode.
Specified by:
getDeliveryMode in interface MessageProducer
Returns:
the message delivery mode
Throws:
JMSException - if the delivery mode is not retrieved due to some error.
See Also:
MessageProducer.setDeliveryMode(int)

setPriority

public void setPriority(int priority)
                 throws JMSException
Sets this producer's default priority. JMS defines a ten level priority value with 0 as the lowest priority and 9 as the highest. Priority is set to 4 by default.
Specified by:
setPriority in interface MessageProducer
Parameters:
priority - the message priority for this message producer
Throws:
JMSException - if the priority is not set due to some error.
See Also:
MessageProducer.getPriority(), Message.DEFAULT_PRIORITY

getPriority

public int getPriority()
                throws JMSException
Gets this producer's default priority. JMS defines a ten level priority value with 0 as the lowest priority and 9 as the highest.
Specified by:
getPriority in interface MessageProducer
Returns:
the message priority
Throws:
JMSException - if the priority is not retrieved due to some error.
See Also:
MessageProducer.setPriority(int)

setTimeToLive

public void setTimeToLive(long timeToLive)
                   throws JMSException
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
Parameters:
timeToLive - the message time-to-live in milliseconds; zero is unlimited
Throws:
JMSException - if time-to-live is not set due to some error.
See Also:
MessageProducer.getTimeToLive(), Message.DEFAULT_TIME_TO_LIVE

getTimeToLive

public long getTimeToLive()
                   throws JMSException
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
Returns:
the message time-to-live in milliseconds; zero is unlimited
Throws:
JMSException - if time-to-live is not retrieved due to some error.
See Also:
MessageProducer.setTimeToLive(long)

getQueue

public Queue getQueue()
               throws JMSException
Gets the queue associated with this queue sender.
Specified by:
getQueue in interface QueueSender
Returns:
the queue
Throws:
JMSException - if the queue is not retrieved due to some error.

setTransformation

public void setTransformation(java.lang.String transformation)
Sets this producer's transformation.
Specified by:
setTransformation in interface AQjmsQueueSender
Parameters:
transformation - the transformation to use when sending messages

getTransformation

public java.lang.String getTransformation()
Gets this producer's transformation.
Specified by:
getTransformation in interface AQjmsQueueSender
Returns:
the transformation used when sending messages

send

public void send(Message message)
          throws JMSException
Sends a message.
Specified by:
send in interface QueueSender
Parameters:
message - the message to send
Throws:
JMSException - if the message is not sent due to some error.
See Also:
MessageProducer.getDeliveryMode(), MessageProducer.getTimeToLive(), MessageProducer.getPriority()

send

public void send(Message message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException
Sends a message.
Specified by:
send in interface QueueSender
Parameters:
message - the message to send
deliveryMode - the delivery mode for message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not sent due to some error.

send

public void send(Queue queue,
                 Message message)
          throws JMSException
Sends a message.
Specified by:
send in interface QueueSender
Parameters:
queue - The destination queue where the message has to be sent. This overrides the default queue of the Message Producer.
message - the message to send
Throws:
JMSException - if the message is not sent due to some error.
See Also:
MessageProducer.getDeliveryMode(), MessageProducer.getTimeToLive(), MessageProducer.getPriority()

send

public void send(Queue queue,
                 Message message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException
Sends a message.
Specified by:
send in interface QueueSender
Parameters:
queue - The destination queue where the message has to be sent. This overrides the default queue of the Message Producer.
message - the message to send
deliveryMode - the delivery mode for message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not sent due to some error.

bufferSend

public void bufferSend(Queue queue,
                       Message message,
                       int priority,
                       long timeToLive)
                throws JMSException
Sends a non-persistent message to an in-memory portion of the queue for an unidentified message producer, specifying delivery mode, priority and time-to-live. When the in-memory queue is used, the enqueue operation is required to be in immediate visibility mode. (This requirement might be removed in a later release.)
Parameters:
queue - The destination queue where the message has to be sent. This overrides the default queue of the Message Producer.
message - the message to send
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not sent due to some error.

getTopic

public Topic getTopic()
               throws JMSException
Gets the topic associated with this publisher.
Specified by:
getTopic in interface TopicPublisher
Returns:
this publisher's topic
Throws:
JMSException - if the topic is not retrieved due to some error.

publish

public void publish(Message message)
             throws JMSException
Publishes a message.
Specified by:
publish in interface TopicPublisher
Parameters:
message - the message to publish
Throws:
JMSException - if the message is not published due to some error.
See Also:
MessageProducer.getDeliveryMode(), MessageProducer.getTimeToLive(), MessageProducer.getPriority()

publish

public void publish(Message message,
                    int deliveryMode,
                    int priority,
                    long timeToLive)
             throws JMSException
Publishes a message to the topic specifying delivery mode, priority and time-to-live.
Specified by:
publish in interface TopicPublisher
Parameters:
message - the message to publish
deliveryMode - the delivery mode for message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not published due to some error.

publish

public void publish(Topic topic,
                    Message message)
             throws JMSException
Publishes a message to a topic for an unidentified message producer. Uses the producer's default delivery mode, time-to-live and priority.
Specified by:
publish in interface TopicPublisher
Parameters:
topic - The topic to which to publish the message. This overrides the default topic of the Message Producer.
message - the message to publish
Throws:
JMSException - if message is not published due to some error.
See Also:
MessageProducer.getDeliveryMode(), MessageProducer.getTimeToLive(), MessageProducer.getPriority()

publish

public void publish(Topic topic,
                    Message message,
                    int deliveryMode,
                    int priority,
                    long timeToLive)
             throws JMSException
Publishes a message to a topic for an unidentified message producer, specifying delivery mode, priority and time-to-live.
Specified by:
publish in interface TopicPublisher
Parameters:
topic - The topic to which to publish the message. This overrides the default topic of the Message Producer.
message - the message to publish
deliveryMode - the delivery mode for message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not published due to some error.

bufferPublish

public void bufferPublish(Topic topic,
                          Message message,
                          int priority,
                          long timeToLive)
                   throws JMSException
Publishes a non-persistent message to an in-memory portion of the topic for an unidentified message producer, specifying delivery mode, priority and time-to-live. When the in-memory queue is used, the enqueue operation is required to be in immediate visibility mode. (This requirement might be removed in a later release.)
Parameters:
topic - The topic to which to publish the message. This overrides the default topic of the Message Producer.
message - the message to publish
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not published due to some error.

publish

public void publish(Message message,
                    oracle.jms.AQjmsAgent[] recipientList)
             throws JMSException
Publishes a message to a specific list of recipients
Specified by:
publish in interface AQjmsTopicPublisher
Parameters:
message - the message to publish
recipientList - the list of recipients to which the message is to be published
Throws:
JMSException - if the message is not published due to some error.

publish

public void publish(Topic topic,
                    Message message,
                    oracle.jms.AQjmsAgent[] recipientList)
             throws JMSException
Publishes a message to a topic by specifying a list of recipients.
Specified by:
publish in interface AQjmsTopicPublisher
Parameters:
topic - The topic to which to publish the message. This overrides the default topic of the Message Producer.
message - the message to publish
recipientList - the list of recipients to which the message is to be published
Throws:
JMSException - if the message is not published due to some error.

publish

public void publish(Message message,
                    oracle.jms.AQjmsAgent[] recipientList,
                    int deliveryMode,
                    int priority,
                    long timeToLive)
             throws JMSException
Publishes a message to a topic by specifying a list of recipients, delivery mode, priority and time-to-live
Specified by:
publish in interface AQjmsTopicPublisher
Parameters:
message - the message to publish
recipientList - the list of recipients to which the message is to be published
deliveryMode - the delivery mode for message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not published due to some error.

publish

public void publish(Topic topic,
                    Message message,
                    oracle.jms.AQjmsAgent[] recipientList,
                    int deliveryMode,
                    int priority,
                    long timeToLive)
             throws JMSException
Publishes a message to a topic by specifying a list of recipients, delivery mode, priority and time-to-live
Specified by:
publish in interface AQjmsTopicPublisher
Parameters:
topic - The topic to which to publish the message. This overrides the default topic of the Message Producer.
message - the message to publish
recipientList - the list of recipients to which the message is to be published
deliveryMode - the delivery mode for message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not published due to some error.

close

public void close()
           throws JMSException
Description copied from interface: MessageProducer
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
Throws:
JMSException

getDestination

public Destination getDestination()
                           throws JMSException
Gets the destination associated with this MessageProducer.
Specified by:
getDestination in interface MessageProducer
Returns:
this producer's Destination/
Throws:
JMSException - if the destination is not retrieved due to some error.
Since:
1.1

send

public void send(Destination destination,
                 Message message)
          throws JMSException
Sends a message to a destination for an unidentified message producer. Uses this 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
Parameters:
destination - the destination to send this message to
message - the message to send
Throws:
JMSException - if the message is not sent due to some error.
MessageFormatException - if an invalid message is specified.
InvalidDestinationException - if a client uses this method with an invalid destination.
java.lang.UnsupportedOperationException - if a client uses this method with a MessageProducer that specified a destination at creation time.
Since:
1.1
See Also:
Session.createProducer(javax.jms.Destination), MessageProducer

send

public void send(Destination destination,
                 Message message,
                 int deliveryMode,
                 int priority,
                 long timeToLive)
          throws JMSException
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
Parameters:
destination - the destination to send this message to
message - the message to send
deliveryMode - the delivery mode for message (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT)
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not sent due to some error.
MessageFormatException - if an invalid message is specified.
InvalidDestinationException - if a client uses this method with an invalid destination.
Since:
1.1
See Also:
Session.createProducer(javax.jms.Destination)

bufferSend

public void bufferSend(Destination destination,
                       Message message,
                       int priority,
                       long timeToLive)
                throws JMSException
Sends a non-persistent message to an in-memory portion of the destination for an unidentified message producer, specifying priority and time-to-live. When the in-memory queue is used, the enqueue operation is required to be in immediate visibility mode. (This requirement might be removed in a later release.)
Parameters:
destination - the destination to send this message to
message - the message to send
priority - the priority for message (JMS defines 0 as lowest and 9 as highest)
timeToLive - the time-to-live for message (milliseconds; 0 means no limit)
Throws:
JMSException - if the message is not sent due to some error.
MessageFormatException - if an invalid message is specified.
InvalidDestinationException - if a client uses this method with an invalid destination.
See Also:
Session.createProducer(javax.jms.Destination)

Oracle® Streams Advanced Queuing Java API Reference
10g Release 2 (10.2)

B14291-01


Copyright © 2003, 2005, Oracle. All rights reserved.