Package org.apache.camel

Examples of org.apache.camel.Producer.createExchange()


        Endpoint producerEndpoint = component.createEndpoint(getEndpointUri(settingsFile.getName(), acceptorSessionID));
        Producer producer = producerEndpoint.createProducer();
       
        // FIX message to send
        Email email = new Email(new EmailThreadID("ID"), new EmailType(EmailType.NEW), new Subject("Test"));
        Exchange exchange = producer.createExchange(ExchangePattern.InOnly);
        exchange.getIn().setBody(email);
       
        producer.process(exchange);           

        // Produce with no session ID specified, session ID must be in message
View Full Code Here


            }
        });

        Endpoint endpoint = context.getEndpoint(uri);
        Producer producer = endpoint.createProducer();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody(hello);

        producer.start();
        producer.process(exchange);
        producer.stop();
View Full Code Here

            }
        });

        Endpoint endpoint = context.getEndpoint(uri);
        Producer producer = endpoint.createProducer();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody(hello);

        producer.start();
        producer.process(exchange);
View Full Code Here

    }

    private Exchange sendExchange(boolean setException) throws Exception {
        Endpoint endpoint = context.getEndpoint("mina2:tcp://localhost:{{port}}?sync=true&encoding=UTF-8&transferExchange=true");
        Producer producer = endpoint.createProducer();
        Exchange exchange = producer.createExchange();
        //Exchange exchange = endpoint.createExchange();

        Message message = exchange.getIn();
        message.setBody("Hello!");
        message.setHeader("cheese", "feta");
View Full Code Here

        // use a timeout value of 2 seconds (timeout is in millis) so we should actually get a response in this test
        Endpoint endpoint = context.getEndpoint("mina2:tcp://localhost:{{port}}?textline=true&sync=true&timeout=500");
        Producer producer = endpoint.createProducer();
        producer.start();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody("Hello World");
        try {
            producer.process(exchange);
            fail("Should have thrown an ExchangeTimedOutException wrapped in a RuntimeCamelException");
        } catch (Exception e) {
View Full Code Here

        });
        thread.start();

        Producer producer = context.getEndpoint("direct:foo").createProducer();
        for (int i = 0; i < numberOfMessages; i++) {
            Exchange exchange = producer.createExchange();
            exchange.getIn().setBody("test message " + i);
            producer.process(exchange);
        }
        latch.await(20, TimeUnit.SECONDS);
        assertTrue("Messages not consumed = " + latch.getCount(), latch.getCount() == 0);
View Full Code Here

        Producer producer = gatewayEndpoint.createProducer();
       
        LOG.info("Sending order");
       
        NewOrderSingle order = createNewOrderMessage();
        Exchange exchange = producer.createExchange(ExchangePattern.InOnly);
        exchange.getIn().setBody(order);
        producer.process(exchange);           

        if (!executionReportLatch.await(5, TimeUnit.SECONDS)) {
            throw new IllegalStateException("Did not receive execution reports");
View Full Code Here

        // use a timeout value of 2 seconds (timeout is in millis) so we should actually get a response in this test
        Endpoint endpoint = this.context.getEndpoint("mina:tcp://localhost:" + PORT + "?textline=true&sync=true&timeout=2000");
        Producer producer = endpoint.createProducer();
        producer.start();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody("Hello World");
        try {
            producer.process(exchange);
            fail("Should have thrown an ExchangeTimedOutException wrapped in a RuntimeCamelException");
        } catch (Exception e) {
View Full Code Here

            }
        });

        Endpoint endpoint = context.getEndpoint(uri);
        Producer producer = endpoint.createProducer();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody(hello);

        producer.start();
        producer.process(exchange);
        producer.stop();
View Full Code Here

        // use a timeout value of 2 seconds (timeout is in millis) so we should actually get a response in this test
        Endpoint endpoint = this.context.getEndpoint("mina:tcp://localhost:" + PORT + "?textline=true&sync=true&timeout=2000");
        Producer producer = endpoint.createProducer();
        producer.start();
        Exchange exchange = producer.createExchange();
        exchange.getIn().setBody("Hello World");
        try {
            producer.process(exchange);
            fail("Should have thrown an ExchangeTimedOutException wrapped in a RuntimeCamelException");
        } catch (Exception e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.