Package org.switchyard

Examples of org.switchyard.Exchange.send()


            _targetService.getServiceName(), new InOnlyService());
        Exchange exchange = _service.createExchange();

        MockEndpoint endpoint = getMockEndpoint("mock:result");
        endpoint.expectedBodiesReceived("foo");
        exchange.send(exchange.createMessage().setContent("foo"));
   
        assertThat(context.getRegistry().lookup(TransactionManagerFactory.TM), is(notNullValue()));
        _mixIn.uninitialize();
    }
View Full Code Here


        final Exchange exchange = _service.createExchange();
        exchange.getContext().setProperty(propertyKey, propertyValue, Scope.EXCHANGE);

        Message message = exchange.createMessage();
        message.getContext().setProperty(propertyValue, propertyKey);
        exchange.send(message);

        assertThat(camelEndpoint.getReceivedCounter(), is(1));
        org.apache.camel.Exchange ex = camelEndpoint.getReceivedExchanges().get(0);
        final String actualPropertyValue = (String) ex.getProperty(propertyKey);
        final String actualPropertyKey = (String) ex.getIn().getHeader(propertyValue);
View Full Code Here

    public void routeInOutToCamel() throws Exception {
        final String body = "inOut test string";
        final Exchange exchange = _service.createExchange();
        final Message message = createMessageWithBody(exchange, body);

        exchange.send(message);

        final String payload = (String) exchange.getMessage().getContent();
        assertThat(payload, is(equalTo(body)));
    }
View Full Code Here

            }
        }
        );
        _service = _serviceDomain.registerServiceReference(serviceName, new InOutService());
        Exchange exchange = _service.createExchange();
        exchange.send(exchange.createMessage().setContent("foo"));
        assertThat((Boolean)exchange.getContext().getProperty("decomposeInvoked").getValue(), is(true));
        assertThat((Boolean)exchange.getContext().getProperty("composeInvoked").getValue(), is(true));
    }

    @Override
View Full Code Here

            });

            Exchange exchange = _serviceReference.createExchange(exchangeContract, responseExchangeHandler.get());
            Message message = exchange.createMessage().setContent(payload);

            exchange.send(message);
            Exchange exchangeOut = null;
            try {
                exchangeOut = responseQueue.take();
            } catch (InterruptedException e) {
                throw new SwitchYardException("Operation '" + operationName + "' on Service '" + _serviceReference.getName() + "' interrupted.", e);
View Full Code Here

            }
        } else {
            Exchange exchange = _serviceReference.createExchange(exchangeContract);
            Message message = exchange.createMessage().setContent(payload);

            exchange.send(message);
        }

        return null;
    }
View Full Code Here

                    .addLabels(BehaviorLabel.TRANSIENT.label());

            Message message = _messageComposer.compose(input, exchange);
            _securityContextManager.addCredentials(exchange, input.extractCredentials());
            if (exchange.getContract().getConsumerOperation().getExchangePattern() == ExchangePattern.IN_ONLY) {
                exchange.send(message);
                if (exchange.getState().equals(ExchangeState.FAULT)) {
                    response = (HttpResponseBindingData) _messageComposer.decompose(exchange, new HttpResponseBindingData());
                } else {
                    response = new HttpResponseBindingData();
                }
View Full Code Here

                    response = (HttpResponseBindingData) _messageComposer.decompose(exchange, new HttpResponseBindingData());
                } else {
                    response = new HttpResponseBindingData();
                }
            } else {
                exchange.send(message);
                exchange = inOutHandler.waitForOut();
                response = (HttpResponseBindingData) _messageComposer.decompose(exchange, new HttpResponseBindingData());
            }
        } catch (Exception e) {
            HttpLogger.ROOT_LOGGER.unexpectedExceptionInvokingSwitchyardServcie(e);
View Full Code Here

        MockHandler handler = new MockHandler();
        Exchange ex = _consumerService11.operation("sayHello").createExchange(handler);

        Message requestMsg = ex.createMessage().setContent(input);
        ex.send(requestMsg);
        handler.waitForFaultMessage();
        Exchange exchange = handler.getFaults().iterator().next();
        Property faultInfoProperty = exchange.getContext().getProperty(SOAPComposition.SOAP_FAULT_INFO);
        Assert.assertNotNull(faultInfoProperty);
        Assert.assertEquals(faultStr, faultInfoProperty.getValue().toString());
View Full Code Here

    @Test
    public void messageComposerComposeTest() throws InterruptedException {
        _mock.expectedBodiesReceived(Composer.DECOMPOSE_PREFIX + PAYLOAD);
        Exchange exchange = createExchange(new Composer().setContextMapper(new CamelContextMapper()));
        exchange.send(exchange.createMessage().setContent(PAYLOAD));
        _mock.assertIsSatisfied();
    }

    @Test
    public void contextMapperMapToTest() throws InterruptedException {
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.