Package org.switchyard

Examples of org.switchyard.Exchange.send()


            }

            exchange.getContext(message).setProperty(MESSAGE_NAME, operation.getInput().getMessage().getQName().getLocalPart());

            if (oneWay) {
                exchange.send(message);
                if (exchange.getState().equals(ExchangeState.FAULT)) {
                    return composeResponse(exchange, msgContext, operation, true);
                } else {
                    return null;
                }
View Full Code Here


    public void contextMapperMapToTest() throws InterruptedException {
        _mock.expectedBodiesReceived(PAYLOAD);
        _mock.expectedHeaderReceived(Mapper.PROPERTY, Mapper.VALUE);

        Exchange exchange = createExchange(new CamelMessageComposer().setContextMapper(new Mapper()));
        exchange.send(exchange.createMessage().setContent(PAYLOAD));
        _mock.assertIsSatisfied();
    }

    public Exchange createExchange(MessageComposer<CamelBindingData> messageComposer) {
        QName serviceName = new QName("urn:test", "Service");
View Full Code Here

                    return composeResponse(exchange, msgContext, operation, true);
                } else {
                    return null;
                }
            } else {
                exchange.send(message);
                try {
                    exchange = inOutHandler.waitForOut(_waitTimeout);
                } catch (DeliveryException e) {
                    return handleException(oneWay,
                            SOAPMessages.MESSAGES.timedOut(String.valueOf(_waitTimeout),
View Full Code Here

        Context context = exchange.getContext(message);
        context.setProperty("someProp", "somePropVal");
        message.setContent("blah");
        DataSource attach = new TestDataSource("someAttach", "text/plain", "someAttachData");
        message.addAttachment(attach.getName(), attach);
        exchange.send(message);
        Exchange outExchange = handler.waitForOut();
        Assert.assertEquals("true, true, true", outExchange.getMessage().getContent());
    }

}
View Full Code Here

    @Test
    public void sendReply() throws Exception {
        MockHandler handler = new MockHandler();
        handler.setWaitTimeout(3000);
        Exchange ex = sendReply.createExchange(handler);
        ex.send(ex.createMessage().setContent(TEST_IN_CONTENT));
        Assert.assertEquals(1, handler.waitForOKMessage().getMessages().size());
        Assert.assertEquals(TEST_OUT_CONTENT,
                handler.getMessages().poll().getMessage().getContent());
    }
   
View Full Code Here

    @Test
    public void attachments() throws Exception {
        MockHandler handler = new MockHandler();
        handler.setWaitTimeout(3000);
        Exchange ex = attachments.createExchange(handler);
        ex.send(ex.createMessage()
                .setContent(TEST_IN_CONTENT)
                .addAttachment(TEST_IN_ATTACHMENT, new DummyDataSource(TEST_IN_ATTACHMENT)));
        Assert.assertEquals(1, handler.waitForOKMessage().getMessages().size());
        Message reply = handler.getMessages().poll().getMessage();
        DataSource attachOut = reply.getAttachment(TEST_OUT_ATTACHMENT);
View Full Code Here

        } else {
            switchyardMessage = ExchangeMapper.mapCamelToSwitchYard(
                    camelExchange, switchyardExchange, ExchangePhase.IN);
        }
       
        switchyardExchange.send(switchyardMessage);
    }
   
    private Message composeForGateway(MessageComposer<CamelBindingData> composer,
            org.apache.camel.Exchange camelExchange, Exchange switchyardExchange) throws Exception {
       
View Full Code Here

                SynchronousInOutHandler inOutHandler = new SynchronousInOutHandler();

                Exchange exchangeIn = createExchange(_service, method, inOutHandler);
                // Don't set the message content as an array unless there are multiple arguments
                if (args != null && args.length == 1) {
                    exchangeIn.send(exchangeIn.createMessage().setContent(args[0]));
                } else {
                    exchangeIn.send(exchangeIn.createMessage().setContent(args));
                }

                Exchange exchangeOut = inOutHandler.waitForOut();
View Full Code Here

                Exchange exchangeIn = createExchange(_service, method, inOutHandler);
                // Don't set the message content as an array unless there are multiple arguments
                if (args != null && args.length == 1) {
                    exchangeIn.send(exchangeIn.createMessage().setContent(args[0]));
                } else {
                    exchangeIn.send(exchangeIn.createMessage().setContent(args));
                }

                Exchange exchangeOut = inOutHandler.waitForOut();
                if (exchangeOut.getState() == ExchangeState.OK) {
                    return exchangeOut.getMessage().getContent(method.getReturnType());
View Full Code Here

                }
            } else {
                Exchange exchange = createExchange(_service, method, null);
                // Don't set the message content as an array unless there are multiple arguments
                if (args == null) {
                    exchange.send(exchange.createMessage());
                } else if (args.length == 1) {
                    exchange.send(exchange.createMessage().setContent(args[0]));
                } else {
                    exchange.send(exchange.createMessage().setContent(args));
                }
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.