本文整理汇总了Java中org.apache.camel.impl.ScheduledPollConsumer类的典型用法代码示例。如果您正苦于以下问题:Java ScheduledPollConsumer类的具体用法?Java ScheduledPollConsumer怎么用?Java ScheduledPollConsumer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScheduledPollConsumer类属于org.apache.camel.impl包,在下文中一共展示了ScheduledPollConsumer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ignoreDeprecatedApiError
import org.apache.camel.impl.ScheduledPollConsumer; //导入依赖的package包/类
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);
}
});
}
}
示例2: getManagedObjectForConsumer
import org.apache.camel.impl.ScheduledPollConsumer; //导入依赖的package包/类
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;
}
示例3: ManagedScheduledPollConsumer
import org.apache.camel.impl.ScheduledPollConsumer; //导入依赖的package包/类
public ManagedScheduledPollConsumer(CamelContext context, ScheduledPollConsumer consumer) {
super(context, consumer);
this.consumer = consumer;
}
示例4: getConsumer
import org.apache.camel.impl.ScheduledPollConsumer; //导入依赖的package包/类
public ScheduledPollConsumer getConsumer() {
return consumer;
}