public class DefaultPollingConsumerPollStrategy extends Object implements PollingConsumerPollStrategy
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
DefaultPollingConsumerPollStrategy() |
Modifier and Type | Method and Description |
---|---|
boolean |
begin(Consumer consumer,
Endpoint endpoint)
Called when poll is about to begin
|
void |
commit(Consumer consumer,
Endpoint endpoint,
int polledMessages)
Called when poll is completed successfully
|
boolean |
rollback(Consumer consumer,
Endpoint endpoint,
int retryCounter,
Exception e)
Called when poll failed
|
public boolean begin(Consumer consumer, Endpoint endpoint)
PollingConsumerPollStrategy
begin
in interface PollingConsumerPollStrategy
consumer
- the consumerendpoint
- the endpoint being consumedpublic void commit(Consumer consumer, Endpoint endpoint, int polledMessages)
PollingConsumerPollStrategy
commit
in interface PollingConsumerPollStrategy
consumer
- the consumerendpoint
- the endpoint being consumedpolledMessages
- number of messages polled, will be 0 if no message was polled at all.public boolean rollback(Consumer consumer, Endpoint endpoint, int retryCounter, Exception e) throws Exception
PollingConsumerPollStrategy
rollback
in interface PollingConsumerPollStrategy
consumer
- the consumerendpoint
- the endpoint being consumedretryCounter
- current retry attempt, starting from 0.e
- the caused exceptionException
- can be used to rethrow the caused exception. Notice that thrown an exception will
terminate the scheduler and thus Camel will not trigger again. So if you want to let the scheduler
to continue to run then do not throw any exception from this method.Apache Camel