|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.camel.impl.DefaultPollingConsumerPollStrategy
org.apache.camel.impl.LimitedPollingConsumerPollStrategy
public class LimitedPollingConsumerPollStrategy
A PollingConsumerPollStrategy
which supports suspending consumers if they
failed for X number of times in a row.
Field Summary |
---|
Fields inherited from class org.apache.camel.impl.DefaultPollingConsumerPollStrategy |
---|
log |
Constructor Summary | |
---|---|
LimitedPollingConsumerPollStrategy()
|
Method Summary | |
---|---|
void |
commit(Consumer consumer,
Endpoint endpoint,
int polledMessages)
Called when poll is completed successfully |
int |
getLimit()
|
protected boolean |
onRollback(Consumer consumer,
Endpoint endpoint)
Rollback occurred. |
protected void |
onSuspend(Consumer consumer,
Endpoint endpoint)
The consumer is to be suspended because it exceeded the limit |
boolean |
rollback(Consumer consumer,
Endpoint endpoint,
int retryCounter,
java.lang.Exception cause)
Called when poll failed |
void |
setLimit(int limit)
Sets the limit for how many straight rollbacks causes this strategy to suspend the fault consumer. |
void |
start()
Starts the service |
void |
stop()
Stops the service |
Methods inherited from class org.apache.camel.impl.DefaultPollingConsumerPollStrategy |
---|
begin |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LimitedPollingConsumerPollStrategy()
Method Detail |
---|
public int getLimit()
public void setLimit(int limit)
limit
- the limitpublic void commit(Consumer consumer, Endpoint endpoint, int polledMessages)
PollingConsumerPollStrategy
commit
in interface PollingConsumerPollStrategy
commit
in class DefaultPollingConsumerPollStrategy
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, java.lang.Exception cause) throws java.lang.Exception
PollingConsumerPollStrategy
rollback
in interface PollingConsumerPollStrategy
rollback
in class DefaultPollingConsumerPollStrategy
consumer
- the consumerendpoint
- the endpoint being consumedretryCounter
- current retry attempt, starting from 0.cause
- the caused exception
java.lang.Exception
- 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.protected void onSuspend(Consumer consumer, Endpoint endpoint) throws java.lang.Exception
consumer
- the consumerendpoint
- the endpoint
java.lang.Exception
- is thrown if error suspending the consumerprotected boolean onRollback(Consumer consumer, Endpoint endpoint) throws java.lang.Exception
consumer
- the consumerendpoint
- the endpoint
java.lang.Exception
- can be thrown in case something goes wrongpublic void start() throws java.lang.Exception
Service
start
in interface Service
java.lang.Exception
- is thrown if starting failedpublic void stop() throws java.lang.Exception
Service
stop
in interface Service
java.lang.Exception
- is thrown if stopping failed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |