@Override public Optional<ProcessorDefinition<?>> handle(Step step, ProcessorDefinition<?> route, IntegrationRouteBuilder builder, String flowIndex, String stepIndex) { final String message = createMessage(step); if (message.isEmpty()) { return Optional.empty(); } if (step.getId().isPresent()) { String stepId = step.getId().get(); return Optional.of(route.log(LoggingLevel.INFO, (String) null, stepId, message)); } return Optional.of(route.log(LoggingLevel.INFO, message)); }
@Override public Optional<ProcessorDefinition> handle(Log step, ProcessorDefinition route, SyndesisRouteBuilder routeBuilder) { LoggingLevel loggingLevel = LoggingLevel.INFO; if (step.getLoggingLevel() != null) { loggingLevel = LoggingLevel.valueOf(step.getLoggingLevel()); } return Optional.of(route.log(loggingLevel, step.getLogger(), step.getMarker(), step.getMessage())); } }
@Override public Optional<ProcessorDefinition<?>> configure(CamelContext context, ProcessorDefinition<?> definition, Map<String, Object> parameters) { return Optional.of(definition.log(LoggingLevel.INFO, definition.getId(), definition.getId(), "Got ${body}")); } }
@Override public void configure() throws Exception { from("direct:start") .hystrix() // protect calling the counter service using Hystrix .to("bean:counter") // notice you can have more Camel EIPs/nodes here // .to("bean:anotherBean") .end() // run outside hystrix .log("After calling counter service: ${body}"); } }
@Override public void configure() throws Exception { from("direct:start") .hystrix() // protect calling the counter service using Hystrix .to("bean:counter") // notice you can have more Camel EIPs/nodes here // .to("bean:anotherBean") .onFallback() // use a constant message as fallback .transform(constant("No Counter")) .end() // run outside hystrix .log("After calling counter service: ${body}"); } }
@Test public void shouldAddLogProcessorWithCustomMessageAndStepId() { final Step step = new Step.Builder().id("step-id") .putConfiguredProperty("customText", "Log me baby one more time").build(); assertThat(handler.handle(step, route, NOT_USED, "1", "2")).contains(route); verify(route).log(LoggingLevel.INFO, (String) null, "step-id", "Log me baby one more time"); }
@Test public void shouldAddLogProcessorWithCustomMessage() { final Step step = new Step.Builder().putConfiguredProperty("customText", "Log me baby one more time").build(); assertThat(handler.handle(step, route, NOT_USED, "1", "2")).contains(route); verify(route).log(LoggingLevel.INFO, "Log me baby one more time"); }
@Override public void configure() throws Exception { from("timer:trigger?period=2000") .serviceCall() // use the http4 component to call the service .component("http4") // `hello-service` = name of service // `/camel/hello` is used in uri templating which // means this is used in the context-path of the actual http4 uri .name("hello-service/camel/hello") // add the static list of servers .staticServiceDiscovery() // the syntax is name@hostname:port // and you can separate multiple servers by comma .servers("hello-service@localhost:8081,hello-service@localhost:8082") .end() // end static list .end() // end service call .log("Response ${body}"); } }
@Override public void configure() throws Exception { // use http4 with rest dsl producer restConfiguration().producerComponent("http4") // to call rest service on localhost:8080 (the REST service from GeoRestController) .host("localhost").port(8080); // trigger the route every 5th second from("timer:foo?period=5000") // set a random city to use .setHeader("city", RestProducerRoute::randomCity) // use the rest producer to call the rest service .to("rest:get:country/{city}") // transform the response to grab a nice human readable .transform().jsonpath("$.results[0].formattedAddress") // print the response .log("${body}"); }
.log(LoggingLevel.DEBUG, "Endpoint ${property.endpointUri} returning back to the client body: ${body}, headers: ${headers}") .end();
@Override public void configure() { from(timerEP).routeId("timerToDirect") .setHeader("context") .constant("simple") .setBody() .constant("Camel CDI Example 1") .log("Message received : ${body} for the Context : ${header.context}") .setHeader("header.message") .simple("properties:header.message") .log("Message received : ${body} for the header : ${header.header.message}") .to(directEP); from(directEP).routeId("directToBean") .setBody() .constant("CDI") .bean(helloBean, "sayHello") .log(">> Response : ${body}"); } }
loggingLevel = LoggingLevel.valueOf(step.getLoggingLevel()); route.log(loggingLevel, step.getLogger(), step.getMarker(), step.getMessage()); } else { throw new IllegalStateException("Unknown step kind: " + item + " of class: " + item.getClass().getName());
.toD("https4://secure-sso-sso.${headers.openshiftappurl}/auth/admin/realms/${headers.userid}/clients/${headers.idClientAdmin}/client-secret?sslContextParameters=#ssl&bridgeEndpoint=true") .setHeader("secret").jsonpath("value") .log("return----> ${headers.secret}")