Search in sources :

Example 16 with JaxbDataFormat

use of org.apache.camel.converter.jaxb.JaxbDataFormat in project camel by apache.

the class DataFormatConcurrentTest method testUnmarshalConcurrent.

@Test
public void testUnmarshalConcurrent() throws Exception {
    template.setDefaultEndpointUri("direct:unmarshal");
    final CountDownLatch latch = new CountDownLatch(warmupCount + testCycleCount);
    context.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from("direct:unmarshal").unmarshal(new JaxbDataFormat("org.apache.camel.example")).process(new Processor() {

                @Override
                public void process(Exchange exchange) throws Exception {
                    latch.countDown();
                }
            });
        }
    });
    unmarshal(latch);
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) CountDownLatch(java.util.concurrent.CountDownLatch) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat) Test(org.junit.Test)

Example 17 with JaxbDataFormat

use of org.apache.camel.converter.jaxb.JaxbDataFormat in project camel by apache.

the class DataFormatDataSetTest method createRouteBuilder.

protected RouteBuilder createRouteBuilder() {
    return new RouteBuilder() {

        public void configure() {
            DataFormat jaxb = new JaxbDataFormat("org.apache.camel.example");
            // use 5 concurrent threads to do marshalling
            from("dataset:beer").marshal(jaxb).to("dataset:beer");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) DataFormat(org.apache.camel.spi.DataFormat) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat) JaxbDataFormat(org.apache.camel.converter.jaxb.JaxbDataFormat)

Aggregations

JaxbDataFormat (org.apache.camel.converter.jaxb.JaxbDataFormat)17 RouteBuilder (org.apache.camel.builder.RouteBuilder)14 DataFormat (org.apache.camel.spi.DataFormat)6 Exchange (org.apache.camel.Exchange)3 Processor (org.apache.camel.Processor)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 JAXBContext (javax.xml.bind.JAXBContext)1 CamelContextAware (org.apache.camel.CamelContextAware)1 RuntimeCamelException (org.apache.camel.RuntimeCamelException)1 PersonType (org.apache.camel.foo.bar.PersonType)1 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 SwitchYardMessage (org.switchyard.common.camel.SwitchYardMessage)1