@Override public Set<String> scan(CamelContext camelContext) { if (useRecovery) { LOG.trace("Scanning for exchanges to recover in {} context", camelContext.getName()); Set<String> scanned = Collections.unmodifiableSet(persistedCache.keySet()); LOG.trace("Found {} keys for exchanges to recover in {} context", scanned.size(), camelContext.getName()); return scanned; } else { LOG.warn("What for to run recovery scans in {} context while repository {} is running in non-recoverable aggregation repository mode?!", camelContext.getName(), mapName); return Collections.emptySet(); } }
@Override public Set<String> scan(CamelContext camelContext) { LOG.trace("Scanning for exchanges to recover in {} context", camelContext.getName()); Set<String> scanned = Collections.unmodifiableSet(getKeys()); LOG.trace("Found {} keys for exchanges to recover in {} context", scanned.size(), camelContext.getName()); return scanned; }
@Override public Set<String> scan(CamelContext camelContext) { LOG.trace("Scanning for exchanges to recover in {} context", camelContext.getName()); Set<String> scanned = Collections.unmodifiableSet(cache.keySet()); LOG.trace("Found {} keys for exchanges to recover in {} context", scanned.size(), camelContext.getName()); return scanned; }
/** * Listen for event (observe using @Observes) when Camel is started. * <p/> * You can listen for any of the Camel events from org.apache.camel.management.event package. */ void onContextStarted(@Observes CamelContextStartedEvent event) { System.out.println("***************************************"); System.out.println("* Camel started " + event.getContext().getName()); System.out.println("***************************************"); } }
public static <T extends Registry> T getRegistry(CamelContext context, Class<T> type) throws Exception { T result = context.getRegistry(type); if (result == null) { throw new Exception(type.getName() + " not available in " + context.getName()); } return result; }
/** * Listen for event (observe using @Observes) when Camel is started. * <p/> * You can listen for any of the Camel events from org.apache.camel.management.event package. */ void onContextStarted(@Observes CamelContextStartedEvent event) { System.out.println("***************************************"); System.out.println("* Camel started " + event.getContext().getName()); System.out.println("***************************************"); } }
private String getModelUUID(CamelContext camelContext) { String uuid = camelContext.getProperty(BIS_CONTEXT_UUID_PROPERTY); if (StringUtils.isEmpty(uuid)) { throw new IllegalStateException("No modelUUID set for context " + camelContext.getName()); } return uuid; }
default Tags getTags(CamelContext camelContext) { return Tags.of( SERVICE_NAME, MicrometerEventNotifierService.class.getSimpleName(), CAMEL_CONTEXT_TAG, camelContext.getName(), EVENT_TYPE_TAG, AbstractRouteEvent.class.getSimpleName()); } }
private String createName(String type, String routeId, String id) { String name = camelContext.getManagementName() != null ? camelContext.getManagementName() : camelContext.getName(); String answer = namePattern; answer = answer.replaceFirst("##name##", name); answer = answer.replaceFirst("##routeId##", routeId); answer = answer.replaceFirst("##id##", id); answer = answer.replaceFirst("##type##", type); return answer; }
@Override public void start() throws Exception { // register mbean final String contextName = camelContext.getName(); final String name = String.format("io.syndesis.camel:context=%s,type=context,name=\"%s\"", contextName, contextName); final ObjectName instance = ObjectName.getInstance(name); camelContext.getManagementStrategy().manageNamedObject(this, instance); LOG.info("Registered mbean {}", instance); }
void bindCamelContexts(CamelContext camelContext) { if (camelContext != null) { if (LOG.isDebugEnabled()) { LOG.debug("Bind camelContext " + camelContext + " status: " + camelContext.getStatus()); } String id = camelContext.getName(); this.camelContexts.put(id, camelContext); clearCamelContextConfiguration(id); } }
void unbindCamelContexts(CamelContext camelContext) { if (camelContext != null) { if (LOG.isDebugEnabled()) { LOG.debug("Unbind camelContext " + camelContext + " status: " + camelContext.getStatus()); } String id = camelContext.getName(); this.camelContexts.remove(id); clearCamelContextConfiguration(id); } }
void unbindCamelContexts(CamelContext camelContext) { if (camelContext != null) { if (LOG.isDebugEnabled()) { LOG.debug("Unbind camelContext " + camelContext + " status: " + camelContext.getStatus()); } String id = camelContext.getName(); this.camelContexts.remove(id); clearCamelContextConfiguration(id); } }
void bindCamelContexts(CamelContext camelContext) { if (camelContext != null) { if (LOG.isDebugEnabled()) { LOG.debug("Bind camelContext " + camelContext + " status: " + camelContext.getStatus()); } String id = camelContext.getName(); this.camelContexts.put(id, camelContext); clearCamelContextConfiguration(id); } }
public static String getQuartzContextName(CamelContext camelContext) { // favour using the actual management name which was registered in JMX (if JMX is enabled) if (camelContext.getManagementName() != null) { return camelContext.getManagementName(); } else { // fallback as name return camelContext.getName(); } } }
@Override public void doExecute(TestContext context) { for (String routeId : routeIds) { String route = context.replaceDynamicContentInString(routeId); try { camelContext.startRoute(route); log.info(String.format("Started Camel route '%s' on context '%s'", route, camelContext.getName())); } catch (Exception e) { throw new CitrusRuntimeException("Failed to start Camel route: " + route, e); } } } }
@Override protected void camelContextStopped(CamelContextStoppedEvent event) { bisEventLogger.contextStopped(event.getContext().getName()); }
private String createName(String type) { CamelContext context = route.getRouteContext().getCamelContext(); String name = context.getManagementName() != null ? context.getManagementName() : context.getName(); String answer = namePattern; answer = answer.replaceFirst("##name##", name); answer = answer.replaceFirst("##routeId##", Matcher.quoteReplacement(route.getId())); answer = answer.replaceFirst("##type##", type); return answer; }
@Override public void dispose(T context) { super.dispose(context); if (!context.getStatus().isStopped()) { logger.info("Camel CDI is stopping Camel context [{}]", context.getName()); try { context.stop(); } catch (Exception cause) { throw wrapRuntimeCamelException(cause); } } }