Java Code Examples for org.apache.camel.ExtendedCamelContext#addInterceptStrategy()
The following examples show how to use
org.apache.camel.ExtendedCamelContext#addInterceptStrategy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntegrationLoggingContextCustomizer.java From syndesis with Apache License 2.0 | 6 votes |
@Override public void apply(CamelContext camelContext) { // Lets generates always incrementing lexically sortable unique // uuids. These uuids are also more compact than the camel default // and contain an embedded timestamp. camelContext.setUuidGenerator(KeyGenerator::createKey); if(activityTracker == null) { activityTracker = new ActivityTracker.SysOut(); } camelContext.getRegistry().bind("activityTracker", activityTracker); camelContext.getRegistry().bind("bodyLogger", new BodyLogger.Default()); ActivityTrackingInterceptStrategy atis = new ActivityTrackingInterceptStrategy(activityTracker); camelContext.getRegistry().bind("integrationLoggingInterceptStrategy", atis); // Log listener if (camelContext instanceof ExtendedCamelContext) { ExtendedCamelContext ecc = (ExtendedCamelContext) camelContext; ecc.addLogListener(new IntegrationLoggingListener(activityTracker)); ecc.addInterceptStrategy(atis); } LOGGER.info("Added IntegrationLoggingListener with {} to CamelContext.", activityTracker.getClass()); }
Example 2
Source File: IntegrationTracingContextCustomizer.java From syndesis with Apache License 2.0 | 6 votes |
@Override public void apply(CamelContext camelContext) { // Lets generates always incrementing lexically sortable unique // uuids. These uuids are also more compact than the camel default // and contain an embedded timestamp. camelContext.setUuidGenerator(KeyGenerator::createKey); Tracer tracer = Configuration.fromEnv(serviceName).getTracer(); camelContext.getRegistry().bind("tracer", tracer); camelContext.getRegistry().bind("bodyLogger", new BodyLogger.Default()); TracingInterceptStrategy tis = new TracingInterceptStrategy(tracer); camelContext.getRegistry().bind("integrationLoggingInterceptStrategy", tis); if (camelContext instanceof ExtendedCamelContext) { ExtendedCamelContext ecc = (ExtendedCamelContext) camelContext; ecc.addInterceptStrategy(tis); // Log listener ecc.addLogListener(new TracingLogListener(tracer)); } LOGGER.info("Added opentracing to CamelContext."); }