use of org.apache.camel.converter.jaxb.JaxbDataFormat in project camel by apache.
the class DataFormatConcurrentTest method testMarshallConcurrent.
@Test
public void testMarshallConcurrent() throws Exception {
template.setDefaultEndpointUri("direct:marshal");
final CountDownLatch latch = new CountDownLatch(warmupCount + testCycleCount);
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:marshal").marshal(new JaxbDataFormat("org.apache.camel.example")).process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
latch.countDown();
}
});
}
});
marshal(latch);
}
use of org.apache.camel.converter.jaxb.JaxbDataFormat 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.converter.jaxb.JaxbDataFormat in project camel by apache.
the class DataFormatTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
JaxbDataFormat example = new JaxbDataFormat("org.apache.camel.example");
JaxbDataFormat person = new JaxbDataFormat("org.apache.camel.foo.bar");
person.setPrettyPrint(true);
from("direct:start").marshal(example).to("direct:marshalled");
from("direct:marshalled").unmarshal().jaxb("org.apache.camel.example").to("mock:result");
from("direct:prettyPrint").marshal(person).to("mock:result");
}
};
}
use of org.apache.camel.converter.jaxb.JaxbDataFormat 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.converter.jaxb.JaxbDataFormat 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();
}
};
}
Aggregations