org.apache.camel.spring.SpringRouteBuilder Java Examples
The following examples show how to use
org.apache.camel.spring.SpringRouteBuilder.
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: TXToNonTXTest.java From camelinaction with Apache License 2.0 | 7 votes |
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new SpringRouteBuilder() { @Override public void configure() throws Exception { from("activemq:queue:a") .transacted() .to("direct:quote") .to("activemq:queue:b"); from("direct:quote") .choice() .when(body().contains("Camel")) .transform(constant("Camel rocks")) .when(body().contains("Donkey")) .throwException(new IllegalArgumentException("Donkeys not allowed")) .otherwise() .transform(body().prepend("Hello ")); } }; }
Example #2
Source File: StubRunnerCamelConfiguration.java From spring-cloud-contract with Apache License 2.0 | 5 votes |
@Bean public RoutesBuilder myRouter(final BatchStubRunner batchStubRunner) { return new SpringRouteBuilder() { @Override public void configure() throws Exception { Map<StubConfiguration, Collection<Contract>> contracts = batchStubRunner .getContracts(); for (Map.Entry<StubConfiguration, Collection<Contract>> entry : contracts .entrySet()) { Collection<Contract> value = entry.getValue(); MultiValueMap<String, Contract> map = new LinkedMultiValueMap<>(); for (Contract dsl : value) { if (dsl == null) { continue; } if (dsl.getInput() != null && dsl.getInput().getMessageFrom() != null && StringUtils.hasText(dsl.getInput().getMessageFrom() .getClientValue())) { String from = dsl.getInput().getMessageFrom() .getClientValue(); map.add(from, dsl); } } for (Map.Entry<String, List<Contract>> entries : map.entrySet()) { from(entries.getKey()) .filter(new StubRunnerCamelPredicate(entries.getValue())) .process(new StubRunnerCamelProcessor()) .dynamicRouter(header( StubRunnerCamelConfiguration.STUBRUNNER_DESTINATION_URL_HEADER_NAME)); } } } }; }
Example #3
Source File: JpaTest.java From camelinaction with Apache License 2.0 | 5 votes |
@Override protected RouteBuilder createRouteBuilder() { return new SpringRouteBuilder() { public void configure() { from("jms:accounting") .to("jpa:camelinaction.PurchaseOrder") .to("mock:result"); } }; }