Java 类org.apache.camel.impl.ScheduledPollConsumer 实例源码

项目:Camel    文件:FacebookComponentConsumerTest.java   
private void ignoreDeprecatedApiError() {
    for (final Route route : context().getRoutes()) {
        ((ScheduledPollConsumer)route.getConsumer()).setPollStrategy(new DefaultPollingConsumerPollStrategy() {
            @Override
            public boolean rollback(Consumer consumer, Endpoint endpoint, int retryCounter, Exception e) throws Exception {
                if (e.getCause() instanceof FacebookException) {
                    FacebookException facebookException = (FacebookException) e.getCause();
                    if (facebookException.getErrorCode() == 11 || facebookException.getErrorCode() == 12 || facebookException.getErrorCode() == 1) {
                        context().stopRoute(route.getId());
                        String method = ((FacebookEndpoint) route.getEndpoint()).getMethod();
                        MockEndpoint mock = getMockEndpoint("mock:consumeQueryResult" + method);
                        mock.expectedMinimumMessageCount(0);
                        MockEndpoint mock2 = getMockEndpoint("mock:consumeResult" + method);
                        mock2.expectedMinimumMessageCount(0);
                        log.warn("Ignoring failed Facebook deprecated API call", facebookException);
                    }
                }
                return super.rollback(consumer, endpoint, retryCounter, e);
            }
        });
    }
}
项目:Camel    文件:DefaultManagementObjectStrategy.java   
public Object getManagedObjectForConsumer(CamelContext context, Consumer consumer) {
    ManagedConsumer mc;
    if (consumer instanceof ScheduledPollConsumer) {
        mc = new ManagedScheduledPollConsumer(context, (ScheduledPollConsumer) consumer);
    } else {
        mc = new ManagedConsumer(context, consumer);
    }
    mc.init(context.getManagementStrategy());
    return mc;
}
项目:Camel    文件:ManagedScheduledPollConsumer.java   
public ManagedScheduledPollConsumer(CamelContext context, ScheduledPollConsumer consumer) {
    super(context, consumer);
    this.consumer = consumer;
}
项目:Camel    文件:ManagedScheduledPollConsumer.java   
public ScheduledPollConsumer getConsumer() {
    return consumer;
}