Here are the examples of the java api org.apache.camel.CamelContext.addRoutes() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
136 Examples
19
Source : NewApiListener.java
with Apache License 2.0
from rodrigoserracoelho
with Apache License 2.0
from rodrigoserracoelho
private void addRunTimeApi(Api api) {
try {
removeRunTimeApi(api);
if (api.getSwaggerEndpoint() == null) {
camelContext.addRoutes(new SimpleRestRouteRepublisher(camelContext, camelUtils, grafanaDashboardBuilder, throttlingManager, api));
} else {
camelContext.addRoutes(new SwaggerRoutePublisher(camelContext, camelUtils, grafanaDashboardBuilder, throttlingManager, swaggerParser, api));
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
19
Source : CamelVariableTransferTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startAllProperties").setProperty("property1", simple("sampleValueForProperty1")).setProperty("property2", simple("sampleValueForProperty2")).setProperty("property3", simple("sampleValueForProperty3")).transform(simple("sampleBody")).to("log:testVariables?showProperties=true").to("flowable:testPropertiesProcess?copyVariablesFromProperties=true");
from("direct:startNoProperties").setProperty("property1", simple("sampleValueForProperty1")).setProperty("property2", simple("sampleValueForProperty2")).setProperty("property3", simple("sampleValueForProperty3")).transform(simple("sampleBody")).to("log:testVariables?showProperties=true").to("flowable:testPropertiesProcess?copyVariablesFromProperties=false");
from("direct:startFilteredProperties").setProperty("property1", simple("sampleValueForProperty1")).setProperty("property2", simple("sampleValueForProperty2")).setProperty("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true").to("flowable:testPropertiesProcess?copyVariablesFromProperties=(property1|property2)");
from("direct:startAllHeaders").setHeader("property1", simple("sampleValueForProperty1")).setHeader("property2", simple("sampleValueForProperty2")).setHeader("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true");
from("direct:startNoHeaders").setHeader("property1", simple("sampleValueForProperty1")).setHeader("property2", simple("sampleValueForProperty2")).setHeader("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true").to("flowable:testPropertiesProcess?copyVariablesFromHeader=false");
from("direct:startFilteredHeaders").setHeader("property1", simple("sampleValueForProperty1")).setHeader("property2", simple("sampleValueForProperty2")).setHeader("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true").to("flowable:testPropertiesProcess?copyVariablesFromHeader=(property1|property2)");
}
});
}
19
Source : TestReturnValueFromFlowable.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startReturnResultTest").to("flowable:testResultProcess?var.return.exampleCamelReturnValue").to("mock:result");
}
});
}
19
Source : ParallelProcessRevisitedTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:parallelCamelProcessRevisited:serviceTaskAsync1").to("bean:sleepBean?method=sleep");
from("flowable:parallelCamelProcessRevisited:serviceTaskAsync2").to("bean:sleepBean?method=sleep");
}
});
}
19
Source : ParallelProcessTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:parallelCamelProcess:serviceTaskAsync1").to("seda:parallelQueue");
from("seda:parallelQueue").to("bean:sleepBean?method=sleep");
from("flowable:parallelCamelProcess:serviceTaskAsync2").to("seda:parallelQueue2");
from("seda:parallelQueue2").to("bean:sleepBean?method=sleep");
}
});
}
19
Source : MultipleInstanceRoute.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:multiInstanceCamelProcess:servicetask1").to("log:logMessage");
}
});
}
19
Source : SimpleCamelCallTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:SimpleCamelCallProcess:simpleCall").to("log: org.activiti.camel.examples.SimpleCamelCall");
}
});
}
19
Source : PingPongTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:PingPongProcess:ping").transform().simple("${property.input} World");
}
});
}
19
Source : MultiInstanceTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:miProcessExample:serviceTask1").to("seda:continueAsync1");
from("seda:continueAsync1").to("bean:sleepBean?method=sleep").to("flowable:miProcessExample:receive1");
}
});
}
19
Source : InitiatorCamelCallTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startWithInitiatorHeader").setHeader("CamelProcessInitiatorHeader", constant("kermit")).to("flowable:InitiatorCamelCallProcess?processInitiatorHeaderName=CamelProcessInitiatorHeader");
}
});
}
19
Source : ErrorMapExceptionTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@Deployment(resources = { "process/mapExceptionSingleMap.bpmn20.xml" })
public void testCamelSingleDirectMap() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:mapExceptionProcess:exceptionRoute").throwException(new MapExceptionParent("test exception"));
}
});
FlagJavaDelegate.reset();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("mapExceptionProcess");
replacedertTrue(FlagJavaDelegate.isFlagSet());
}
19
Source : ErrorMapExceptionTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@Deployment(resources = { "process/mapExceptionDefaultMap.bpmn20.xml" })
public void testCamelDefaultMap() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:mapExceptionDefaultProcess:exceptionRoute").throwException(new NullPointerException("test exception"));
}
});
FlagJavaDelegate.reset();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("mapExceptionDefaultProcess");
replacedertTrue(FlagJavaDelegate.isFlagSet());
}
19
Source : ErrorMapExceptionTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@Deployment(resources = { "process/mapExceptionParentMap.bpmn20.xml" })
public void testCamelParentMap() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:mapExceptionParentProcess:exceptionRoute").throwException(new MapExceptionChild("test exception"));
}
});
FlagJavaDelegate.reset();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("mapExceptionParentProcess");
replacedertTrue(FlagJavaDelegate.isFlagSet());
}
19
Source : EmptyProcessTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeClreplaced
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startEmpty").to("flowable:emptyProcess");
from("direct:startEmptyWithHeader").setHeader("MyVar", constant("Foo")).to("flowable:emptyProcess?copyVariablesFromHeader=true");
from("direct:startEmptyBodyreplacedtring").to("flowable:emptyProcess?copyBodyToCamelBodyreplacedtring=true");
}
});
}
19
Source : AsyncProcessTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:asyncCamelProcess:serviceTaskAsync1").setHeader("destination", constant("flowable:asyncCamelProcess:receive1")).to("seda:asyncQueue");
from("flowable:asyncCamelProcess:serviceTaskAsync2").setHeader("destination", constant("flowable:asyncCamelProcess:receive2")).to("seda:asyncQueue2");
from("seda:asyncQueue").to("bean:sleepBean?method=sleep").to("seda:receiveQueue");
from("seda:asyncQueue2").to("bean:sleepBean?method=sleep").to("seda:receiveQueue");
from("seda:receiveQueue").recipientList(header("destination"));
}
});
}
19
Source : AsyncPingTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:asyncPingProcess:serviceAsyncPing").to("seda:continueAsync");
from("seda:continueAsync").to("flowable:asyncPingProcess:receiveAsyncPing");
}
});
}
19
Source : CdiAsyncPingTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@Override
public void setUp() throws Exception {
super.setUp();
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:asyncPingProcess:serviceAsyncPing").to("seda:continueAsync");
from("seda:continueAsync").to("flowable:asyncPingProcess:receiveAsyncPing");
}
});
}
19
Source : ParallelProcessRevisitedTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeEach
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:parallelCamelProcessRevisited:serviceTaskAsync1").to("bean:sleepBean?method=sleep");
from("flowable:parallelCamelProcessRevisited:serviceTaskAsync2").to("bean:sleepBean?method=sleep");
}
});
}
19
Source : AsyncProcessRevisitedTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeEach
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:asyncCamelProcessRevisited:serviceTaskAsync1").to("bean:sleepBean?method=sleep").to("seda:continueAsync1");
from("seda:continueAsync1").to("flowable:asyncCamelProcessRevisited:receive1");
from("flowable:asyncCamelProcessRevisited:serviceTaskAsync2").to("bean:sleepBean?method=sleep").to("seda:continueAsync2");
from("seda:continueAsync2").to("flowable:asyncCamelProcessRevisited:receive2");
}
});
}
19
Source : MultipleInstanceRoute.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeEach
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:multiInstanceCamelProcess:servicetask1").to("log:logMessage");
}
});
}
19
Source : SimpleCamelCallTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeEach
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:SimpleCamelCallProcess:simpleCall").to("log: org.flowable.camel.examples.SimpleCamelCall");
}
});
}
19
Source : PingPongTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeEach
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:PingPongProcess:ping").transform().simple("${property.input} World");
}
});
}
19
Source : MultiInstanceTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeEach
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("flowable:miProcessExample:serviceTask1").to("seda:continueAsync1");
from("seda:continueAsync1").to("bean:sleepBean?method=sleep").to("flowable:miProcessExample:receive1");
}
});
}
19
Source : InitiatorCamelCallTest.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
@BeforeEach
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startWithInitiatorHeader").setHeader("CamelProcessInitiatorHeader", constant("kermit")).to("flowable:InitiatorCamelCallProcess?processInitiatorHeaderName=CamelProcessInitiatorHeader");
}
});
}
19
Source : CamelVariableTransferTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startAllProperties").setProperty("property1", simple("sampleValueForProperty1")).setProperty("property2", simple("sampleValueForProperty2")).setProperty("property3", simple("sampleValueForProperty3")).transform(simple("sampleBody")).to("log:testVariables?showProperties=true").to("activiti:testPropertiesProcess?copyVariablesFromProperties=true");
from("direct:startNoProperties").setProperty("property1", simple("sampleValueForProperty1")).setProperty("property2", simple("sampleValueForProperty2")).setProperty("property3", simple("sampleValueForProperty3")).transform(simple("sampleBody")).to("log:testVariables?showProperties=true").to("activiti:testPropertiesProcess?copyVariablesFromProperties=false");
from("direct:startFilteredProperties").setProperty("property1", simple("sampleValueForProperty1")).setProperty("property2", simple("sampleValueForProperty2")).setProperty("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true").to("activiti:testPropertiesProcess?copyVariablesFromProperties=(property1|property2)");
from("direct:startAllHeaders").setHeader("property1", simple("sampleValueForProperty1")).setHeader("property2", simple("sampleValueForProperty2")).setHeader("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true");
from("direct:startNoHeaders").setHeader("property1", simple("sampleValueForProperty1")).setHeader("property2", simple("sampleValueForProperty2")).setHeader("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true").to("activiti:testPropertiesProcess?copyVariablesFromHeader=false");
from("direct:startFilteredHeaders").setHeader("property1", simple("sampleValueForProperty1")).setHeader("property2", simple("sampleValueForProperty2")).setHeader("property3", simple("sampleValueForProperty3")).to("log:testVariables?showProperties=true").to("activiti:testPropertiesProcess?copyVariablesFromHeader=(property1|property2)");
}
});
}
19
Source : TestReturnValueFromActiviti.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startReturnResultTest").to("activiti:testResultProcess?var.return.exampleCamelReturnValue").to("mock:result");
}
});
}
19
Source : ParallelProcessRevisitedTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:parallelCamelProcessRevisited:serviceTaskAsync1").to("bean:sleepBean?method=sleep");
from("activiti:parallelCamelProcessRevisited:serviceTaskAsync2").to("bean:sleepBean?method=sleep");
}
});
}
19
Source : AsyncProcessRevisitedTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:asyncCamelProcessRevisited:serviceTaskAsync1").to("bean:sleepBean?method=sleep").to("seda:continueAsync1");
from("seda:continueAsync1").to("activiti:asyncCamelProcessRevisited:receive1");
from("activiti:asyncCamelProcessRevisited:serviceTaskAsync2").to("bean:sleepBean?method=sleep").to("bean:sleepBean?method=sleep").to("seda:continueAsync2");
from("seda:continueAsync2").to("activiti:asyncCamelProcessRevisited:receive2");
}
});
}
19
Source : ParallelProcessTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:parallelCamelProcess:serviceTaskAsync1").to("seda:parallelQueue");
from("seda:parallelQueue").to("bean:sleepBean?method=sleep");
from("activiti:parallelCamelProcess:serviceTaskAsync2").to("seda:parallelQueue2");
from("seda:parallelQueue2").to("bean:sleepBean?method=sleep");
}
});
}
19
Source : MultipleInstanceRoute.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:multiInstanceCamelProcess:servicetask1").to("log:logMessage");
}
});
}
19
Source : SimpleCamelCallTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:SimpleCamelCallProcess:simpleCall").to("log: org.activiti.camel.examples.SimpleCamelCall");
}
});
}
19
Source : PingPongTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:PingPongProcess:ping").transform().simple("${property.input} World");
}
});
}
19
Source : MultiInstanceTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:miProcessExample:serviceTask1").to("seda:continueAsync1");
from("seda:continueAsync1").to("bean:sleepBean?method=sleep").to("activiti:miProcessExample:receive1");
}
});
}
19
Source : InitiatorCamelCallTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startWithInitiatorHeader").setHeader("CamelProcessInitiatorHeader", constant("kermit")).to("activiti:InitiatorCamelCallProcess?processInitiatorHeaderName=CamelProcessInitiatorHeader");
}
});
}
19
Source : ErrorMapExceptionTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
@Deployment(resources = { "process/mapExceptionParentMap.bpmn20.xml" })
public void testCamelParentMap() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:mapExceptionParentProcess:exceptionRoute").throwException(new MapExceptionChild("test exception"));
}
});
FlagJavaDelegate.reset();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("mapExceptionParentProcess");
replacedertTrue(FlagJavaDelegate.isFlagSet());
}
19
Source : ErrorMapExceptionTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
@Deployment(resources = { "process/mapExceptionSingleMap.bpmn20.xml" })
public void testCamelSingleDirectMap() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:mapExceptionProcess:exceptionRoute").throwException(new MapExceptionParent("test exception"));
}
});
FlagJavaDelegate.reset();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("mapExceptionProcess");
replacedertTrue(FlagJavaDelegate.isFlagSet());
}
19
Source : EmptyProcessTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
@BeforeClreplaced
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:startEmpty").to("activiti:emptyProcess");
from("direct:startEmptyWithHeader").setHeader("MyVar", constant("Foo")).to("activiti:emptyProcess?copyVariablesFromHeader=true");
from("direct:startEmptyBodyreplacedtring").to("activiti:emptyProcess?copyBodyToCamelBodyreplacedtring=true");
}
});
}
19
Source : AsyncProcessTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:asyncCamelProcess:serviceTaskAsync1").setHeader("destination", constant("activiti:asyncCamelProcess:receive1")).to("seda:asyncQueue");
from("activiti:asyncCamelProcess:serviceTaskAsync2").setHeader("destination", constant("activiti:asyncCamelProcess:receive2")).to("seda:asyncQueue2");
from("seda:asyncQueue").to("bean:sleepBean?method=sleep").to("seda:receiveQueue");
from("seda:asyncQueue2").to("bean:sleepBean?method=sleep").to("seda:receiveQueue");
from("seda:receiveQueue").recipientList(header("destination"));
}
});
}
19
Source : AsyncPingTest.java
with Apache License 2.0
from dingziyang
with Apache License 2.0
from dingziyang
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:asyncPingProcess:serviceAsyncPing").to("seda:continueAsync");
from("seda:continueAsync").to("activiti:asyncPingProcess:receiveAsyncPing");
}
});
}
19
Source : EndpointConfiguration.java
with Apache License 2.0
from citrusframework
with Apache License 2.0
from citrusframework
@Bean
public CamelContext camelContext(ApplicationContext applicationContext) {
camelContext = new SpringCamelContext(applicationContext);
RouteBuilder routeBuilder = new RouteBuilder(camelContext) {
@Override
public void configure() throws Exception {
from("direct:echo").transform().simple("You just said: ${body}");
}
};
try {
camelContext.addRoutes(routeBuilder);
} catch (Exception e) {
throw new BeanCreationException("Failed to create Camel context", e);
}
return camelContext;
}
19
Source : CamelRoutesSetup.java
with Apache License 2.0
from brunobat
with Apache License 2.0
from brunobat
private void messageSender() throws Exception {
final RouteBuilder routeBuilder = new RouteBuilder(getCamelContex()) {
@Override
public void configure() throws Exception {
configMessageProducer();
}
private void configMessageProducer() {
final String toUri = "rabbitmq:" + "demo" + "?autoDelete=" + "false" + "&declare=false" + "&addresses=" + host + ":" + port + "&username=" + "rabbitmq" + "&preplacedword=" + "rabbitmq" + "&vhost=" + "/demo" + "&routingKey=" + "demo" + "&queue=" + "demo";
log.info("adding route: {}", toUri);
from("direct:rabbitMQ").routeId("MessageProducer").log("send message").to(toUri).autoStartup(autoStartRoutes());
}
};
camelContext.addRoutes(routeBuilder);
}
19
Source : CamelRoutesSetup.java
with Apache License 2.0
from brunobat
with Apache License 2.0
from brunobat
private void messageConsumer() throws Exception {
final RouteBuilder routeBuilder = new RouteBuilder(getCamelContex()) {
@Override
public void configure() throws Exception {
consumeMessages();
}
private void consumeMessages() throws Exception {
final String fromUri = "rabbitmq:" + "demo" + "?autoDelete=" + "false" + "&declare=false" + "&addresses=" + host + ":" + port + "&username=" + "rabbitmq" + "&preplacedword=" + "rabbitmq" + "&vhost=" + "/demo" + "&queue=" + "demoQueue";
from(fromUri).routeId("Consume").log(LoggingLevel.INFO, log, "New message arrived").process("superHeroCreator").autoStartup(autoStartRoutes());
}
};
camelContext.addRoutes(routeBuilder);
}
19
Source : ServletMappingDisablingTest.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setup() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
rest().get("/thepath").produces("text/plain").route().transform().constant("Hello");
}
});
}
19
Source : ServletHttpMessageTest.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setup() throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
rest().get("/outMessageNullBody").produces("text/plain").route().log("${body}").process(e -> e.getOut().setBody(null)).log("${body}");
}
});
}
19
Source : NagiosTestResource.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Override
public Map<String, String> start() {
nscaPort = AvailablePortFinder.getNextAvailable();
try {
context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() {
context.getRegistry().bind("mockNscaServer", mockNscaServer);
fromF("netty:tcp://0.0.0.0:%s?serverInitializerFactory=#mockNscaServer", nscaPort).log("This log statement is here just because a route definition needs an output");
}
});
context.start();
} catch (Exception e) {
LOG.error("An issue occured while starting the NagiosTestResource route", e);
}
Map<String, String> properties = new HashMap<String, String>();
properties.put(NSCA_PORT_CFG_KEY, "" + nscaPort);
properties.put(NSCA_HOST_CFG_KEY, "localhost");
return properties;
}
18
Source : AbstractActivityLoggingTest.java
with Apache License 2.0
from syndesisio
with Apache License 2.0
from syndesisio
@BeforeEach
public void before() throws Exception {
activityEvents = new ArrayList<>();
activityTracker = items -> {
try {
String json = JsonSupport.toJsonObject(items);
LOGGER.debug(json);
ActivityEvent event = JsonUtils.reader().forType(ActivityEvent.clreplaced).readValue(json);
activityEvents.add(event);
} catch (IOException e) {
LOGGER.warn("Errors during activity tracking", e);
}
};
context = new DefaultCamelContext();
context.setUuidGenerator(KeyGenerator::createKey);
context.addLogListener(new IntegrationLoggingListener(activityTracker));
context.addInterceptStrategy(new ActivityTrackingInterceptStrategy(activityTracker));
context.addRoutes(createTestRoutes());
context.start();
}
18
Source : AbstractTemplateStepHandlerTest.java
with Apache License 2.0
from syndesisio
with Apache License 2.0
from syndesisio
protected void testTemplateStepNoSpacesInSymbolAllowed(Symbol[] symbols) throws Exception {
String template = EMPTY_STRING + "At " + symbols[0] + ", " + symbols[1] + NEW_LINE + "stated submitted the following message:" + NEW_LINE + symbols[2];
replacedertThatThrownBy(() -> {
IntegrationWithRouteBuilder irb = generateRoute(template, Arrays.asList(symbols));
final RouteBuilder routes = irb.routeBuilder();
// Set up the camel context
context.addRoutes(routes);
}).isInstanceOf(IllegalStateException.clreplaced).hasMessageContaining("not valid syntactically");
}
18
Source : CamelUtils.java
with Apache License 2.0
from rodrigoserracoelho
with Apache License 2.0
from rodrigoserracoelho
public void addActiveRoute(RunningApi runningApi) {
try {
log.info("Add route: {}", runningApi.getRouteId());
camelContext.addRoutes(new PathRouteRepublisher(camelContext, this, runningApi));
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
18
Source : CamelUtils.java
with Apache License 2.0
from rodrigoserracoelho
with Apache License 2.0
from rodrigoserracoelho
public void addSuspendedRoute(RunningApi runningApi) {
try {
log.info("Add suspended route: {}", runningApi.getRouteId());
camelContext.addRoutes(new SuspendedRouteBuilder(camelContext, this, runningApi));
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
18
Source : F1UdpKafkaApp.java
with Apache License 2.0
from ppatierno
with Apache License 2.0
from ppatierno
public static void main(String[] args) throws Exception {
F1UdpKafkaAppConfig config = F1UdpKafkaAppConfig.fromEnv();
Session session = new Session();
CamelContext camelContext = new DefaultCamelContext();
log.info("Config: {}", config);
camelContext.getRegistry().bind("packet-decoder", new PacketEventDecoder());
camelContext.getRegistry().bind("drivers-splitter", new DriversSplitter(session));
camelContext.addRoutes(new DispatchRouteBuilder(config));
camelContext.addRoutes(new RawPacketsRouteBuilder(config));
camelContext.addRoutes(new EventsRouteBuilder(config, session));
camelContext.addRoutes(new DriversRouteBuilder(config));
camelContext.start();
Thread.sleep(Long.MAX_VALUE);
}
See More Examples