Red Hat Training
A Red Hat training course is available for Red Hat Fuse
5.3.3. Camel JAXB アンマーシャリング
WildFlyCamelContext camelctx = contextFactory.createCamelContext(getClass().getClassLoader());
final JaxbDataFormat jaxb = new JaxbDataFormat();
jaxb.setContextPath("org.wildfly.camel.test.jaxb.model");
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start")
.unmarshal(jaxb);
}
});
camelctx.start();
ProducerTemplate producer = camelctx.createProducerTemplate();
// Send an XML representation of the customer to the direct:start endpoint
Customer customer = producer.requestBody("direct:start", readCustomerXml(), Customer.class);
Assert.assertEquals("John", customer.getFirstName());
Assert.assertEquals("Doe", customer.getLastName());