com.localmatters.collector.queue.consumer
Class ConsumerBean

java.lang.Object
  extended by com.localmatters.collector.queue.consumer.ConsumerBean
All Implemented Interfaces:
ConsumerLocal, ConsumerRemote, ConsumerService

public class ConsumerBean
extends java.lang.Object
implements ConsumerRemote, ConsumerLocal

The collector consumer bean.

Author:
Daniel Cavalcanti

Constructor Summary
ConsumerBean()
          Creates a new instance of ConsumerBean.
 
Method Summary
 java.lang.String retrieve()
          Retrieves a message from the queue.
 java.lang.String retrieveImmediate()
          Retrieves a message from the queue.
 java.lang.String retrieveTimed(long timeout)
          Retrieves a message from the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumerBean

public ConsumerBean()
Creates a new instance of ConsumerBean.

Method Detail

retrieve

public java.lang.String retrieve()
                          throws CollectorQueueException
Description copied from interface: ConsumerService
Retrieves a message from the queue. If there are no messages in the queue, blocks until a message becomes available.

Specified by:
retrieve in interface ConsumerService
Returns:
The message.
Throws:
CollectorQueueException

retrieveTimed

public java.lang.String retrieveTimed(long timeout)
                               throws CollectorQueueException
Description copied from interface: ConsumerService
Retrieves a message from the queue. If there are no messages in the queue, blocks until a message becomes available, or the timeout expires.

Specified by:
retrieveTimed in interface ConsumerService
Parameters:
timeout - The message timeout period in milliseconds.
Returns:
The message if one was available; otherwise, null.
Throws:
CollectorQueueException

retrieveImmediate

public java.lang.String retrieveImmediate()
                                   throws CollectorQueueException
Description copied from interface: ConsumerService
Retrieves a message from the queue. If there are no messages in the queue, the call does not block but returns a null immediately.

Specified by:
retrieveImmediate in interface ConsumerService
Returns:
The message if one was available; otherwise, null.
Throws:
CollectorQueueException