Oracle® Streams Advanced Queuing Java API Reference
Release 1 (10.1)

B12023-01

oracle.jms
Class AQjmsConsumer

java.lang.Object
  |
  +--oracle.jms.AQjmsObject
        |
        +--oracle.jms.AQjmsConsumer
All Implemented Interfaces:
AQjmsQueueReceiver, AQjmsTopicReceiver, AQjmsTopicSubscriber, MessageConsumer, QueueReceiver, javax.naming.Referenceable, TopicReceiver, TopicSubscriber

public class AQjmsConsumer
extends oracle.jms.AQjmsObject
implements AQjmsQueueReceiver, AQjmsTopicSubscriber, AQjmsTopicReceiver, javax.naming.Referenceable

Oracle class implementing oracle.jms.AQjmsQueueReceiver, oracle.jms.AQjmsTopicSubscriber, oracle.jms.AQjmsTopicReceiver


Method Summary
 void close()
          Closes the message consumer.
 javax.jms.MessageListener getMessageListener()
          Get the message consumer's MessageListener.
 java.lang.String getMessageSelector()
          Get this message consumer's message selector expression.
 int getNavigationMode()
          Get the navigation mode for the consumer
 boolean getNoLocal()
          Get the NoLocal attribute for this TopicSubscriber.
 javax.jms.Queue getQueue()
          Get the queue associated with this queue receiver.
 javax.naming.Reference getReference()
           
 javax.jms.Topic getTopic()
          Get the topic associated with this subscriber.
 java.lang.String getTransformation()
          Get the transformation used by this consumer
 javax.jms.Message receive()
          Receive the next message produced for this message consumer.
 javax.jms.Message receive(long timeout)
          Receive the next message if available within the specified timeout
 void receiveNoData()
          Consume the message without returning it to the user.
 void receiveNoData(long timeout)
          Consume the message without returning it to the user.
 javax.jms.Message receiveNoWait()
          Receive the next message if one is immediately available.
 void setMessageListener(javax.jms.MessageListener myListener)
          Set the message consumer's MessageListener.
 void setNavigationMode(int mode)
          Set the navigation mode for the consumer
 void setTransformation(java.lang.String transformation)
          Set the transformation for this consumer

 

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

 

Methods inherited from interface oracle.jms.AQjmsTopicSubscriber
receive

 

Methods inherited from interface oracle.jms.AQjmsTopicReceiver
receive, receive, receiveSignature, receiveSignature

 

Method Detail

getMessageSelector

public java.lang.String getMessageSelector()
                                    throws JMSException
Get this message consumer's message selector expression.
Specified by:
getMessageSelector in interface MessageConsumer
Returns:
this message consumer's message selector
Throws:
JMSException - if JMS fails to get message selector due to some JMS error

getReference

public javax.naming.Reference getReference()
Specified by:
getReference in interface javax.naming.Referenceable

getMessageListener

public javax.jms.MessageListener getMessageListener()
                                             throws JMSException
Get the message consumer's MessageListener.
Specified by:
getMessageListener in interface MessageConsumer
Returns:
the listener for the message consumer, or null if this isn't one set.
Throws:
JMSException - if JMS fails to get message listener due to some JMS error
See Also:
MessageConsumer.setMessageListener(javax.jms.MessageListener)

setMessageListener

public void setMessageListener(javax.jms.MessageListener myListener)
                        throws JMSException
Set the message consumer's MessageListener. The onMessage method of this object is called when there are messages for this consumer.
Specified by:
setMessageListener in interface MessageConsumer
Parameters:
myListener - set the consumer's message listener
Returns:
none
Throws:
JMSException - if JMS fails to set message listener due to some JMS error
See Also:
MessageConsumer.getMessageListener()

receive

public javax.jms.Message receive()
                          throws JMSException
Receive the next message produced for this message consumer.

This call blocks indefinitely until a message is produced.

Specified by:
receive in interface MessageConsumer
Returns:
the next message produced for this message consumer.
Throws:
JMSException - if JMS fails to receive the next message due to some error.

receiveNoWait

public javax.jms.Message receiveNoWait()
                                throws JMSException
Receive the next message if one is immediately available.
Specified by:
receiveNoWait in interface MessageConsumer
Returns:
the next message produced for this message consumer, or null if one is not available.
Throws:
JMSException - if JMS fails to receive the next message due to some error.

receive

public javax.jms.Message receive(long timeout)
                          throws JMSException
Receive the next message if available within the specified timeout
Specified by:
receive in interface MessageConsumer
Parameters:
timeout - the timeout value (in milliseconds)
Returns:
the next message produced for this message consumer, or null if one is not available.
Throws:
JMSException - if JMS fails to receive the next message due to some error.

close

public void close()
           throws JMSException
Description copied from interface: MessageConsumer
Closes the message consumer.

Since a provider may allocate some resources on behalf of a MessageConsumer 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.

This call blocks until a receive or message listener in progress has completed. A blocked message consumer receive call returns null when this message consumer is closed.

Specified by:
close in interface MessageConsumer
Overrides:
close in class oracle.jms.AQjmsObject
Throws:
JMSException - if the JMS provider fails to close the consumer due to some internal error.

getQueue

public javax.jms.Queue getQueue()
                         throws JMSException
Get the queue associated with this queue receiver.
Specified by:
getQueue in interface QueueReceiver
Returns:
the queue
Throws:
JMSException - if JMS fails to get queue for this queue receiver due to some internal error.

getTopic

public javax.jms.Topic getTopic()
                         throws JMSException
Get the topic associated with this subscriber.
Specified by:
getTopic in interface TopicSubscriber
Returns:
this subscriber's topic
Throws:
JMSException - if JMS fails to get topic for this topic subscriber due to some internal error.

getNoLocal

public boolean getNoLocal()
                   throws JMSException
Get the NoLocal attribute for this TopicSubscriber. The default value for this attribute is false.
Specified by:
getNoLocal in interface TopicSubscriber
Returns:
set to true if locally published messages are being inhibited.
Throws:
JMSException - if JMS fails to get noLocal attribute for this topic subscriber due to some internal error.

getNavigationMode

public int getNavigationMode()
                      throws JMSException
Get the navigation mode for the consumer
Specified by:
getNavigationMode in interface AQjmsQueueReceiver
Returns:
the navigation mode of the consumer
Throws:
JMSException - if there was an error in getting the navigation mode

setNavigationMode

public void setNavigationMode(int mode)
                       throws JMSException
Set the navigation mode for the consumer
Specified by:
setNavigationMode in interface AQjmsQueueReceiver
Parameters:
mode - the navigation mode of the consumer
Throws:
JMSException - if the navigation mode could not be set

setTransformation

public void setTransformation(java.lang.String transformation)
Set the transformation for this consumer
Specified by:
setTransformation in interface AQjmsQueueReceiver
Parameters:
transformation - the transformation used when getting messages

getTransformation

public java.lang.String getTransformation()
Get the transformation used by this consumer
Specified by:
getTransformation in interface AQjmsQueueReceiver

receiveNoData

public void receiveNoData()
                   throws JMSException
Consume the message without returning it to the user. This call will avoid the overhead of fetching the message from the database. It can be used as an optimization by jms clients who have already read the message, for example using a queue browser.
Specified by:
receiveNoData in interface AQjmsQueueReceiver
Throws:
JMSException - if the message could not be received due to an error

receiveNoData

public void receiveNoData(long timeout)
                   throws JMSException
Consume the message without returning it to the user. This call will avoid the overhead of fetching the message from the database. It can be used as an optimization by jms clients who have already read the message, for example using a queue browser. This call will block until a message arrives or the timeout expires
Specified by:
receiveNoData in interface AQjmsQueueReceiver
Parameters:
timeout - the timeout value in milliseconds
Throws:
JMSException - if the message could not be received due to an error

Oracle® Streams Advanced Queuing Java API Reference
Release 1 (10.1)

B12023-01

Copyright © 2003, Oracle. All Rights Reserved.