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


Java Route.getId方法代码示例

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


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

示例1: execute

import org.apache.camel.Route; //导入方法依赖的package包/类
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    LOG.debug("Running ScheduledJob: jobExecutionContext={}", jobExecutionContext);

    SchedulerContext schedulerContext = getSchedulerContext(jobExecutionContext);
    ScheduledJobState state = (ScheduledJobState) schedulerContext.get(jobExecutionContext.getJobDetail().getKey().toString());
    Action storedAction = state.getAction(); 
    Route storedRoute = state.getRoute();
    
    List<RoutePolicy> policyList = storedRoute.getRouteContext().getRoutePolicyList();
    for (RoutePolicy policy : policyList) {
        try {
            if (policy instanceof ScheduledRoutePolicy) {
                ((ScheduledRoutePolicy)policy).onJobExecute(storedAction, storedRoute);
            }
        } catch (Exception e) {
            throw new JobExecutionException("Failed to execute Scheduled Job for route " + storedRoute.getId()
                    + " with trigger name: " + jobExecutionContext.getTrigger().getKey(), e);
        }
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:ScheduledJob.java

示例2: removeWrappedProcessorsForRoutes

import org.apache.camel.Route; //导入方法依赖的package包/类
/**
 * Removes the wrapped processors for the given routes, as they are no longer in use.
 * <p/>
 * This is needed to avoid accumulating memory, if a lot of routes is being added and removed.
 *
 * @param routes the routes
 */
private void removeWrappedProcessorsForRoutes(Collection<Route> routes) {
    // loop the routes, and remove the route associated wrapped processors, as they are no longer in use
    for (Route route : routes) {
        String id = route.getId();

        Iterator<KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor>> it = wrappedProcessors.values().iterator();
        while (it.hasNext()) {
            KeyValueHolder<ProcessorDefinition<?>, InstrumentationProcessor> holder = it.next();
            RouteDefinition def = ProcessorDefinitionHelper.getRoute(holder.getKey());
            if (def != null && id.equals(def.getId())) {
                it.remove();
            }
        }
    }
    
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:DefaultManagementLifecycleStrategy.java

示例3: getObjectNameForRoute

import org.apache.camel.Route; //导入方法依赖的package包/类
public ObjectName getObjectNameForRoute(Route route) throws MalformedObjectNameException {
    Endpoint ep = route.getEndpoint();
    String id = route.getId();

    StringBuilder buffer = new StringBuilder();
    buffer.append(domainName).append(":");
    buffer.append(KEY_CONTEXT + "=").append(getContextId(ep.getCamelContext())).append(",");
    buffer.append(KEY_TYPE + "=" + TYPE_ROUTE + ",");
    buffer.append(KEY_NAME + "=").append(ObjectName.quote(id));
    return createObjectName(buffer);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:12,代码来源:DefaultManagementNamingStrategy.java

示例4: getRouteIdFromEndpoint

import org.apache.camel.Route; //导入方法依赖的package包/类
/**
 * Gets the route id for the given endpoint in which there is a consumer listening.
 *
 * @param endpoint the endpoint
 * @return the route id, or <tt>null</tt> if none found
 */
public static String getRouteIdFromEndpoint(Endpoint endpoint) {
    if (endpoint == null || endpoint.getCamelContext() == null) {
        return null;
    }

    List<Route> routes = endpoint.getCamelContext().getRoutes();
    for (Route route : routes) {
        if (route.getEndpoint().equals(endpoint)
                || route.getEndpoint().getEndpointKey().equals(endpoint.getEndpointKey())) {
            return route.getId();
        }
    }
    return null;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:EndpointHelper.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

示例6: createTrigger

import org.apache.camel.Route; //导入方法依赖的package包/类
@Override
protected Trigger createTrigger(Action action, Route route) throws Exception {
    Trigger trigger = null;

    CronScheduleBuilder scheduleBuilder = null;
    String triggerPrefix = null;
    if (action == Action.START) {
        scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteStartTime());
        triggerPrefix = TRIGGER_START;
    } else if (action == Action.STOP) {
        scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteStopTime());
        triggerPrefix = TRIGGER_STOP;
    } else if (action == Action.SUSPEND) {
        scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteSuspendTime());
        triggerPrefix = TRIGGER_SUSPEND;
    } else if (action == Action.RESUME) {
        scheduleBuilder = CronScheduleBuilder.cronSchedule(getRouteResumeTime());
        triggerPrefix = TRIGGER_RESUME;
    }

    if (scheduleBuilder != null) {
        if (timeZone != null) {
            scheduleBuilder.inTimeZone(timeZone);
        }

        TriggerKey triggerKey = new TriggerKey(triggerPrefix + route.getId(), TRIGGER_GROUP + route.getId());
        trigger = TriggerBuilder.newTrigger()
            .withIdentity(triggerKey)
            .withSchedule(scheduleBuilder)
            .build();
    }
    
    return trigger;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:35,代码来源:CronScheduledRoutePolicy.java

示例7: createJobDetail

import org.apache.camel.Route; //导入方法依赖的package包/类
protected JobDetail createJobDetail(Action action, Route route) throws Exception {
    JobDetail jobDetail = null;
    
    if (action == Action.START) {
        jobDetail = new JobDetail(JOB_START + route.getId(), JOB_GROUP + route.getId(), ScheduledJob.class);
    } else if (action == Action.STOP) {
        jobDetail = new JobDetail(JOB_STOP + route.getId(), JOB_GROUP + route.getId(), ScheduledJob.class);
    } else if (action == Action.SUSPEND) {
        jobDetail = new JobDetail(JOB_SUSPEND + route.getId(), JOB_GROUP + route.getId(), ScheduledJob.class);
    } else if (action == Action.RESUME) {
        jobDetail = new JobDetail(JOB_RESUME + route.getId(), JOB_GROUP + route.getId(), ScheduledJob.class);
    }
    
    return jobDetail;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:ScheduledRoutePolicy.java

示例8: MetricsStatistics

import org.apache.camel.Route; //导入方法依赖的package包/类
private MetricsStatistics(Route route, Timer responses) {
    this.routeId = route.getId();
    this.responses = responses;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:MetricsRoutePolicy.java


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