org.mule.streaming
Interface Consumer<T>
- All Superinterfaces:
- Closeable, ProvidesTotalHint
- All Known Implementing Classes:
- AbstractConsumer, ListConsumer, SimpleConsumer
public interface Consumer<T>
- extends Closeable, ProvidesTotalHint
General interface for components able to consume data from any specific resource
or stream, following the Producer-Consumer design pattern. Implementing this
interface does not guarantee thread safeness. Check each particular implementation
for information about that
- Since:
- 3.5.0
Method Summary |
T |
consume()
Retrieves the next available item. |
boolean |
isConsumed()
Returns true if no more items are available or if the consumer
was closed. |
consume
T consume()
throws NoSuchElementException
- Retrieves the next available item.
- Returns:
- an object of type T if available.
null
otherwise
- Throws:
{@link
- ClosedConsumerException} if the consumer is already closed
NoSuchElementException
isConsumed
boolean isConsumed()
- Returns
true
if no more items are available or if the consumer
was closed. When this method returns true
, implementors of this
class are require to invoke the Closeable.close()
method before
returning in order to release resources as quickly as possible. Users of this
component who no longer need this require before it is fully consumed are also
required to close it.
- Returns:
true
if no more items are available. false
otherwise
Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.