use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class MultiCamelContextTest method configureCamelContexts.
@Test
@InSequence(2)
public void configureCamelContexts() throws Exception {
secondCamelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("direct:inbound").setHeader("context").constant("second").to("mock:outbound");
}
});
secondCamelContext.startAllRoutes();
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class MultiContextPropertyInjectTest method configureCamelContexts.
@Test
@InSequence(1)
public void configureCamelContexts() throws Exception {
defaultCamelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("direct:in").bean(PropertyInjectBean.class).to("mock:out");
}
});
firstCamelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("direct:in").bean(FirstCamelContextPropertyInjectBean.class).to("mock:out");
}
});
secondCamelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("direct:in").bean(SecondCamelContextPropertyInjectBean.class).to("mock:out");
}
});
secondCamelContext.startAllRoutes();
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class SslContextParametersCometdProducerConsumerTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource("jsse/localhost.ks");
ksp.setPassword("changeit");
KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyPassword("changeit");
kmp.setKeyStore(ksp);
TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(ksp);
SSLContextParameters sslContextParameters = new SSLContextParameters();
sslContextParameters.setKeyManagers(kmp);
sslContextParameters.setTrustManagers(tmp);
CometdComponent component = (CometdComponent) context.getComponent("cometds");
component.setSslContextParameters(sslContextParameters);
from("direct:input").to(uri);
from(uri).to("mock:test");
}
};
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class ConsulRoutePolicyMain method main.
public static void main(final String[] args) throws Exception {
Main main = new Main();
main.addRouteBuilder(new RouteBuilder() {
public void configure() {
ConsulRoutePolicy policy = new ConsulRoutePolicy();
policy.setConsulUrl(ConsulConstants.CONSUL_DEFAULT_URL);
policy.setServiceName(args[0]);
policy.setTtl(15);
from("file:///tmp/camel?delete=true").routeId(args[1]).routePolicy(policy).setHeader("ConsulRouteID", simple("${routeId}")).setHeader("ConsulServiceName", constant(args[0])).to("log:org.apache.camel.component.consul?level=INFO&showAll=true");
}
});
main.run();
}
use of org.apache.camel.builder.RouteBuilder in project camel by apache.
the class CometdProducerConsumerInOutInteractiveMain method createRouteBuilder.
private RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
CometdComponent component = (CometdComponent) context.getComponent("cometds");
component.setSslPassword(pwd);
component.setSslKeyPassword(pwd);
File file = new File("./src/test/resources/jsse/localhost.ks");
URI keyStoreUrl = file.toURI();
component.setSslKeystore(keyStoreUrl.getPath());
from(URI, URIS).setExchangePattern(ExchangePattern.InOut).process(new Processor() {
public void process(Exchange exchange) throws Exception {
Message out = new DefaultMessage();
out.setBody("reply: " + exchange.getIn().getBody());
exchange.setOut(out);
}
});
}
};
}
Aggregations