uk.ac.soton.itinnovation.grid.utils.messaging
Interface PollingConsumer<T>

All Known Implementing Classes:
PollingConsumerImpl

public interface PollingConsumer<T>

Interface for a polling consumer. Message producers are added as Producer objects. Messages objects of class T are retrived from Producer objects and are processed by a MessageHandler. The message handler is set using the setHandler() method.


Method Summary
 void addProducer(Producer<T> p)
          Add a Producer to monitor
 List<Producer<T>> getallProducers()
          Get a copy of the list of producers.
 int getFetchSize()
           
 MessageHandler<T> getHandler()
           
 long getPollingInterval()
           
 void pollNow()
          Poll immediately.
 void removeAllProducers()
          Remove all Producers
 void removeProducer(Producer<T> p)
          Remove a Producer
 void setFetchSize(int fetchSize)
          Set the batch size for retrieving messages.
 void setHandler(MessageHandler<T> handler)
          Set the object (message handler) that will process usage reports
 void setPollingInterval(long intervalMillis)
           
 void start()
          Start retrieving mesages.
 void stop()
          Stop retrieving messages.
 void stopAndWait()
          Stop retrieving messages and wait for complete stop (ongoing message retrieval has completed)
 

Method Detail

addProducer

void addProducer(Producer<T> p)
Add a Producer to monitor


removeProducer

void removeProducer(Producer<T> p)
Remove a Producer


removeAllProducers

void removeAllProducers()
Remove all Producers


setPollingInterval

void setPollingInterval(long intervalMillis)

getPollingInterval

long getPollingInterval()

setFetchSize

void setFetchSize(int fetchSize)
Set the batch size for retrieving messages. No more than fetchSize number of messages will be retrieved at one time. A fetchSize value of -1 indicates no maximum fetch size.


getFetchSize

int getFetchSize()

setHandler

void setHandler(MessageHandler<T> handler)
Set the object (message handler) that will process usage reports


getHandler

MessageHandler<T> getHandler()

start

void start()
Start retrieving mesages.


stop

void stop()
Stop retrieving messages. This is non-blocking. After calling this method message retrieval will stop at the next opportunity, but this method returns immediately and possibly before the final round of message retrieval.


stopAndWait

void stopAndWait()
Stop retrieving messages and wait for complete stop (ongoing message retrieval has completed)


pollNow

void pollNow()
Poll immediately. This terminates the pause between polling for the next immediate polling session only.


getallProducers

List<Producer<T>> getallProducers()
Get a copy of the list of producers.



Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.