use of org.apache.camel.spi.DataFormat in project camel by apache.
the class DataFormatConcurrentTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");
// use seda that supports concurrent consumers for concurrency
from("seda:start?size=" + size + "&concurrentConsumers=5").marshal(jaxb).convertBodyTo(String.class).to("mock:result");
}
};
}
use of org.apache.camel.spi.DataFormat in project camel by apache.
the class JaxbConcurrentDataFormatTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");
from("direct:start").marshal(jaxb).to("direct:marshalled");
from("direct:marshalled").unmarshal(jaxb).to("mock:result");
}
};
}
use of org.apache.camel.spi.DataFormat in project camel by apache.
the class RouteWithErrorHandlerTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
errorHandler(deadLetterChannel("mock:error").redeliveryDelay(0));
onException(InvalidOrderException.class).maximumRedeliveries(0).handled(true).to("mock:invalid");
DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");
from("direct:start").unmarshal(jaxb).choice().when().method(RouteWithErrorHandlerTest.class, "isWine").to("mock:wine").otherwise().throwException(new InvalidOrderException("We only like wine")).end();
}
};
}
use of org.apache.camel.spi.DataFormat in project camel by apache.
the class UnmarshalTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");
from("direct:start").unmarshal(jaxb).to("mock:result");
}
};
}
use of org.apache.camel.spi.DataFormat in project camel by apache.
the class MinaManyUDPMessagesTest method createRouteBuilder.
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
public void configure() throws Exception {
//context.setTracing(true);
DataFormat syslogDataFormat = new SyslogDataFormat();
// we setup a Syslog listener on a random port.
from("mina2:udp://127.0.0.1:" + serverPort).unmarshal(syslogDataFormat).process(new Processor() {
public void process(Exchange ex) {
assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
}
}).to("mock:stop1").marshal(syslogDataFormat).to("mock:stop2");
}
};
}
Aggregations