use of org.apache.camel.ProducerTemplate in project camel by apache.
the class RmiTest method testRmi.
@Test
public void testRmi() throws Exception {
// Create a new camel context to send the request so we can test the service which is deployed into a container
CamelContext myContext = new DefaultCamelContext();
ProducerTemplate myTemplate = myContext.createProducerTemplate();
myTemplate.start();
try {
System.out.println("Calling on port " + port);
String out = myTemplate.requestBody("rmi://localhost:" + port + "/helloServiceBean", "Camel", String.class);
assertEquals("Hello Camel", out);
} finally {
myTemplate.stop();
myContext.stop();
}
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class SplunkPublishEventClient method main.
public static void main(String[] args) throws Exception {
LOG.info("About to run splunk-camel integration...");
CamelContext camelContext = new DefaultCamelContext();
camelContext.addRoutes(new SplunkPublishEventRouteBuilder());
ProducerTemplate eventProducer = camelContext.createProducerTemplate();
camelContext.start();
eventProducer.request("direct:start", new SplunkEventProcessor());
LOG.info("Successfully published event to Splunk.");
camelContext.stop();
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class CamelContextStandaloneTest method testStandalone.
public void testStandalone() throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").to("mock:result");
}
});
context.start();
MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
mock.expectedMessageCount(1);
ProducerTemplate template = context.createProducerTemplate();
template.sendBody("direct:start", "Hello World");
mock.assertIsSatisfied();
template.stop();
context.stop();
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class PojoDualCamelContextConsumerTest method testCamel2RecipientList.
public void testCamel2RecipientList() throws Exception {
String body = "<bye>world!</bye>";
MockEndpoint result = camel2.getEndpoint("mock:result", MockEndpoint.class);
result.expectedBodiesReceived(body);
MockEndpoint foo = camel2.getEndpoint("mock:foo", MockEndpoint.class);
foo.expectedBodiesReceived(body);
ProducerTemplate template = camel2.createProducerTemplate();
template.start();
template.sendBody("direct:foo", body);
template.stop();
result.assertIsSatisfied();
foo.assertIsSatisfied();
}
use of org.apache.camel.ProducerTemplate in project camel by apache.
the class PojoDualCamelContextConsumerTest method testCamel2.
public void testCamel2() throws Exception {
String body = "<bye>world!</bye>";
MockEndpoint result = camel2.getEndpoint("mock:result", MockEndpoint.class);
result.expectedBodiesReceived(body);
ProducerTemplate template = camel2.createProducerTemplate();
template.start();
template.sendBody("direct:start", body);
template.stop();
result.assertIsSatisfied();
}
Aggregations