public interface StreamConsumer extends Closeable, co.cask.tephra.TransactionAware
poll(int, long, java.util.concurrent.TimeUnit),
it will try ro read from stream starting from where it get initialized with or from what last poll left off.
On transaction rollback, all events that are read by poll calls will be reverted so that when poll is issued on a
new transaction afterwards, it will start giving stream events from the where last committed poll ended.| Modifier and Type | Method and Description |
|---|---|
ConsumerConfig |
getConsumerConfig() |
Id.Stream |
getStreamId() |
DequeueResult<co.cask.cdap.api.flow.flowlet.StreamEvent> |
poll(int maxEvents,
long timeout,
TimeUnit timeoutUnit)
Retrieves up to
maxEvents of StreamEvent from the stream. |
Id.Stream getStreamId()
ConsumerConfig getConsumerConfig()
DequeueResult<co.cask.cdap.api.flow.flowlet.StreamEvent> poll(int maxEvents, long timeout, TimeUnit timeoutUnit) throws IOException, InterruptedException
maxEvents of StreamEvent from the stream.maxEvents - Maximum number of events to retrievetimeout - Maximum of time to spend on trying to read up to maxEventstimeoutUnit - Unit for the timeoutDequeueResult which carries StreamEvents inside.IOException - If there is error while reading eventsInterruptedException - If interrupted while waitingCopyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.