Package org.springframework.integration.core

Examples of org.springframework.integration.core.MessageHandler


        MessageChannel requestChannel = applicationContext.getBean("channelB", MessageChannel.class);
        Message message = new GenericMessage<Object>(MESSAGE_BODY);
        //Need to subscribe the responseChannel first
        DirectChannel responseChannel = (DirectChannel) applicationContext.getBean("channelC");
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                String result = (String) message.getPayload();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);               
            }           
        });
View Full Code Here


        MessageChannel requestChannel = applicationContext.getBean("channelD", MessageChannel.class);
        DirectChannel responseChannel = applicationContext.getBean("channelC", DirectChannel.class);
        Map<String, Object> headers = new HashMap<String, Object>();
        headers.put(MessageHeaders.REPLY_CHANNEL, responseChannel);
        GenericMessage<String> message = new GenericMessage<String>(MESSAGE_BODY, headers);
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                String result = (String) message.getPayload();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);               
            }           
        });
View Full Code Here

public class CamelSourceAdapterTest extends CamelSpringTestSupport {
    @Test
    public void testSendingOneWayMessage() throws Exception {
        DirectChannel channelA = applicationContext.getBean("channelA", DirectChannel.class);
        channelA.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                assertEquals("We should get the message from channelA", message.getPayload(), "Willem");            
            }           
        });
        template.sendBody("direct:OneWay", "Willem");
View Full Code Here

        maps.put(MessageHeaders.REPLY_CHANNEL, "responseChannel");

        Message<String> message = new GenericMessage<String>(MESSAGE_BODY, maps);

        DirectChannel responseChannel = applicationContext.getBean("responseChannel", DirectChannel.class);
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                String result = (String) message.getPayload();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);               
            }            
        });
View Full Code Here

                throw new IllegalArgumentException("InputChannel has not been configured on " + getEndpoint());
            }
            exchange.getIn().getHeaders().put(MessageHeaders.REPLY_CHANNEL , inputChannel);

            // subscribe so we can receive the reply from spring integration
            inputChannel.subscribe(new MessageHandler() {
                public void handleMessage(Message<?> message) {
                    if (log.isDebugEnabled()) {
                        log.debug("Received " + message + " from InputChannel: " + inputChannel);
                    }
                    SpringIntegrationBinding.storeToCamelMessage(message, exchange.getOut());
View Full Code Here

                // we want to do in-out so the inputChannel is mandatory (used to receive reply from spring integration)
                if (replyChannel == null) {
                    throw new IllegalArgumentException("ReplyChannel has not been configured on: " + this);
                }

                replyChannel.subscribe(new MessageHandler() {
                    public void handleMessage(Message<?> message) {
                        if (LOG.isDebugEnabled()) {
                            LOG.debug("Received " + message + " from ReplyChannel: " + replyChannel);
                        }
                        //TODO set the corralationID
View Full Code Here

        MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelB");
        Message message = new GenericMessage(MESSAGE_BODY);
        //Need to subscribe the responseChannel first
        DirectChannel responseChannel = (DirectChannel) applicationContext.getBean("channelC");
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                String result = (String) message.getPayload();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);               
            }           
        });
View Full Code Here

        MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelD");
        DirectChannel responseChannel = (DirectChannel) applicationContext.getBean("channelC");
        Map<String, Object> headers = new HashMap<String, Object>();
        headers.put(MessageHeaders.REPLY_CHANNEL, responseChannel);
        GenericMessage<String> message = new GenericMessage<String>(MESSAGE_BODY, headers);
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                String result = (String) message.getPayload();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  result);               
            }           
        });
View Full Code Here

                // we want to do in-out so the inputChannel is mandatory (used to receive reply from spring integration)
                if (replyChannel == null) {
                    throw new IllegalArgumentException("ReplyChannel has not been configured on: " + this);
                }

                replyChannel.subscribe(new MessageHandler() {
                    public void handleMessage(Message<?> message) {
                        LOG.debug("Received {} from ReplyChannel: {}", message, replyChannel);
                        //TODO set the corralationID
                        SpringIntegrationBinding.storeToCamelMessage(message, exchange.getOut());
                    }
View Full Code Here

    @Test
    public void testSendingOneWayMessage() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);
        DirectChannel channelA = getMandatoryBean(DirectChannel.class, "channelA");
        channelA.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                latch.countDown();
                assertEquals("We should get the message from channelA", message.getPayload(), "Willem");            
            }           
        });
View Full Code Here

TOP

Related Classes of org.springframework.integration.core.MessageHandler

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.