public interface DatabusPushConsumerListener<P>
DatabusPushConsumer instance. DatabusPushConsumer.pushAsync()
main loop read messages from an already-subscribed topic and send them
to onConsume(ConsumerRecords) method.
It will process messages and will return a DatabusPushConsumerListenerResponse.
According to it, DatabusPushConsumer will act accordingly.
DatabusPushConsumerListenerResponse.CONTINUE_AND_COMMIT
DatabusPushConsumerListenerResponse.RETRY
DatabusPushConsumerListenerResponse.STOP_AND_COMMIT
DatabusPushConsumerListenerResponse.STOP_NO_COMMIT
| Modifier and Type | Method and Description |
|---|---|
DatabusPushConsumerListenerResponse |
onConsume(ConsumerRecords<P> records)
It is called by
DatabusPushConsumer main loop in a separated thread. |
DatabusPushConsumerListenerResponse onConsume(ConsumerRecords<P> records)
DatabusPushConsumer main loop in a separated thread. It receives records read from
Databus and return a DatabusPushConsumerListenerResponse enum value.
The return value let DatabusPushConsumer main loop know which action take.
DatabusPushConsumerListenerResponse.CONTINUE_AND_COMMIT
states to commit records and continue from last topic-partition offset position
DatabusPushConsumerListenerResponse.RETRY
states do not commit and to get the same records already sent .
DatabusPushConsumerListenerResponse.STOP_AND_COMMIT
states commit records and stop DatabusPushConsumer main loop.
DatabusPushConsumerListenerResponse.STOP_NO_COMMIT
states do not commit records and stop DatabusPushConsumer main loop.
All exceptions should be managed inside this method. If a unexpected exception is thrown,
it will be logged by DatabusPushConsumer main loop, but it won't be rethrow.
records - pushed from DatabusDatabusPushConsumerListenerResponse enum value response to let DatabusPushConsumer
know how to proceed.