Package org.apache.camel.spi

Examples of org.apache.camel.spi.DataFormat


                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")
View Full Code Here


    }

    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");
            }
        };
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {

                //context.setTracing(true);
                DataFormat syslogDataFormat = new Rfc3164SyslogDataFormat();

                // we setup a Syslog  listener on a random port.
                from("mina:udp://127.0.0.1:" + serverPort).unmarshal(syslogDataFormat).process(new Processor() {
                    public void process(Exchange ex) {
                        assertTrue(ex.getIn().getBody() instanceof SyslogMessage);
View Full Code Here

                errorHandler(deadLetterChannel("jms:queue:error").redeliverDelay(0));

                onException(InvalidOrderException.class).maximumRedeliveries(0).handled(true)
                    .to("jms:queue:invalid");

                DataFormat jaxb = new JaxbDataFormat("org.apache.camel.itest.jms");

                from("jms:queue:in")
                    .unmarshal(jaxb)
                    .choice()
                        .when().method(JmsJaxbTest.class, "isWine").to("jms:queue:wine")
View Full Code Here

        this.dataFormatType = dataFormatType;
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) {
        DataFormat dataFormat = DataFormatDefinition.getDataFormat(routeContext, getDataFormatType(), ref);
        return new UnmarshalProcessor(dataFormat);
    }
View Full Code Here

            @Override
            public void configure() throws Exception {
                // START SNIPPET: e1
                // just a unit test but imaging using your own data format that does complex
                // and CPU heavy processing for decrypting the message
                DataFormat mySecureDataFormat = new StringDataFormat("iso-8859-1");

                // list on the JMS queue for new orders
                from("jms:queue:order")
                    // do some sanity check validation
                    .to("bean:validateOrder")
View Full Code Here

    public boolean isUseRouteBuilder() {
        return false;
    }

    public void testMarshalMandatoryConversionFailed() throws Exception {
        DataFormat dataFormat = new ZipDataFormat();

        try {
            dataFormat.marshal(new DefaultExchange(new DefaultCamelContext()), new Object(), new ByteArrayOutputStream());
            fail("Should have thrown an exception");
        } catch (NoTypeConversionAvailableException e) {
            // expected
        }
    }
View Full Code Here

        this.dataFormatType = dataFormatType;
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) {
        DataFormat dataFormat = DataFormatDefinition.getDataFormat(routeContext, getDataFormatType(), ref);
        return new UnmarshalProcessor(dataFormat);
    }
View Full Code Here

        super("crypto");
    }

    @Override
    protected DataFormat createDataFormat(RouteContext routeContext) {
        DataFormat cryptoFormat = super.createDataFormat(routeContext);

        if (ObjectHelper.isNotEmpty(keyRef)) {
            Key key = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), keyRef, Key.class);
            setProperty(cryptoFormat, "key", key);
        }
View Full Code Here

        this.skipFirstLine = skipFirstLine;
    }

    @Override
    protected DataFormat createDataFormat(RouteContext routeContext) {
        DataFormat csvFormat = super.createDataFormat(routeContext);

        if (ObjectHelper.isNotEmpty(configRef)) {
            Object config = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), configRef);
            setProperty(csvFormat, "config", config);
        }
View Full Code Here

TOP

Related Classes of org.apache.camel.spi.DataFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.