Search in sources :

Example 21 with DataFormat

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");
        }
    };
}
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)

Example 22 with DataFormat

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");
        }
    };
}
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)

Example 23 with DataFormat

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();
        }
    };
}
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)

Example 24 with DataFormat

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");
        }
    };
}
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)

Example 25 with DataFormat

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");
        }
    };
}
Also used : Exchange(org.apache.camel.Exchange) Processor(org.apache.camel.Processor) RouteBuilder(org.apache.camel.builder.RouteBuilder) DataFormat(org.apache.camel.spi.DataFormat)

Aggregations

DataFormat (org.apache.camel.spi.DataFormat)45 RouteBuilder (org.apache.camel.builder.RouteBuilder)20 Exchange (org.apache.camel.Exchange)8 Processor (org.apache.camel.Processor)8 JaxbDataFormat (org.apache.camel.converter.jaxb.JaxbDataFormat)6 CamelContext (org.apache.camel.CamelContext)5 Test (org.junit.Test)5 JAXBContext (javax.xml.bind.JAXBContext)2 Rfc5425FrameDecoder (org.apache.camel.component.syslog.netty.Rfc5425FrameDecoder)2 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)2 JndiRegistry (org.apache.camel.impl.JndiRegistry)2 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)2 QRY_A19 (ca.uhn.hl7v2.model.v24.message.QRY_A19)1 QRD (ca.uhn.hl7v2.model.v24.segment.QRD)1 PipeParser (ca.uhn.hl7v2.parser.PipeParser)1 ByteBuf (io.netty.buffer.ByteBuf)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Key (java.security.Key)1 AlgorithmParameterSpec (java.security.spec.AlgorithmParameterSpec)1