当前位置: 首页>>代码示例>>Java>>正文


Java ScheduledPollConsumer类代码示例

本文整理汇总了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);
            }
        });
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:FacebookComponentConsumerTest.java

示例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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:DefaultManagementObjectStrategy.java

示例3: ManagedScheduledPollConsumer

import org.apache.camel.impl.ScheduledPollConsumer; //导入依赖的package包/类
public ManagedScheduledPollConsumer(CamelContext context, ScheduledPollConsumer consumer) {
    super(context, consumer);
    this.consumer = consumer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:ManagedScheduledPollConsumer.java

示例4: getConsumer

import org.apache.camel.impl.ScheduledPollConsumer; //导入依赖的package包/类
public ScheduledPollConsumer getConsumer() {
    return consumer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:ManagedScheduledPollConsumer.java


注:本文中的org.apache.camel.impl.ScheduledPollConsumer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。