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


Java Route.getConsumer方法代码示例

本文整理汇总了Java中org.apache.camel.Route.getConsumer方法的典型用法代码示例。如果您正苦于以下问题:Java Route.getConsumer方法的具体用法?Java Route.getConsumer怎么用?Java Route.getConsumer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.Route的用法示例。


在下文中一共展示了Route.getConsumer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: logRouteState

import org.apache.camel.Route; //导入方法依赖的package包/类
protected void logRouteState(Route route, String state) {
    if (log.isInfoEnabled()) {
        if (route.getConsumer() != null) {
            log.info("Route: {} is {}, was consuming from: {}", new Object[]{route.getId(), state, route.getConsumer().getEndpoint()});
        } else {
            log.info("Route: {} is {}.", route.getId(), state);
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:DefaultCamelContext.java

示例2: onExchangeDone

import org.apache.camel.Route; //导入方法依赖的package包/类
public void onExchangeDone(Route route, Exchange exchange) {
    // only stop it at first run
    if (counter++ == 0) {
        try {
            super.stopConsumer(route.getConsumer());
        } catch (Exception e) {
            handleException(e);
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:ManagedSuspendedServiceTest.java

示例3: onExchangeDone

import org.apache.camel.Route; //导入方法依赖的package包/类
public void onExchangeDone(Route route, Exchange exchange) {
    this.consumer = route.getConsumer();
    // only stop it at first run
    if (counter++ == 0) {
        try {
            super.stopConsumer(consumer);
        } catch (Exception e) {
            handleException(e);
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:FileConsumerSuspendAndResumeTest.java

示例4: execute

import org.apache.camel.Route; //导入方法依赖的package包/类
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
    LOG.trace("Execute job: {}", context);

    CamelContext camelContext = getCamelContext(context);

    Runnable task = (Runnable) context.getJobDetail().getJobDataMap().get("task");

    if (task == null) {
        // if not task then use the route id to lookup the consumer to be used as the task
        String routeId = (String) context.getJobDetail().getJobDataMap().get("routeId");
        if (routeId != null && camelContext != null) {
            // find the consumer
            for (Route route : camelContext.getRoutes()) {
                if (route.getId().equals(routeId)) {
                    Consumer consumer = route.getConsumer();
                    if (consumer instanceof Runnable) {
                        task = (Runnable) consumer;
                        break;
                    }
                }
            }
        }
    }

    if (task != null) {
        LOG.trace("Running task: {}", task);
        task.run();
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:31,代码来源:QuartzScheduledPollConsumerJob.java

示例5: onInit

import org.apache.camel.Route; //导入方法依赖的package包/类
@Override
public void onInit(Consumer consumer) {
    this.consumer = consumer;
    // find the route of the consumer
    for (Route route : consumer.getEndpoint().getCamelContext().getRoutes()) {
        if (route.getConsumer() == consumer) {
            this.routeId = route.getId();
            break;
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:QuartzScheduledPollConsumerScheduler.java


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