Examples of DirectChannel


Examples of org.springframework.integration.channel.DirectChannel

import org.springframework.integration.message.MessageHandler;

public class CamelSourceAdapterTest extends CamelSpringTestSupport {
    @Test
    public void testSendingOneWayMessage() throws Exception {
        DirectChannel channelA = (DirectChannel) applicationContext.getBean("channelA");
        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

Examples of org.springframework.integration.channel.DirectChannel

        Map<String, Object> maps = new HashMap<String, Object>();
        maps.put(MessageHeaders.REPLY_CHANNEL, "responseChannel");

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

        DirectChannel responseChannel = (DirectChannel) applicationContext.getBean("responseChannel");
        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

Examples of org.springframework.integration.channel.DirectChannel

    public void testSendingTwoWayMessage() throws Exception {

        MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelB");
        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

Examples of org.springframework.integration.channel.DirectChannel

    @Test
    public void testSendingTwoWayMessageWithMessageAddress() throws Exception {

        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

Examples of org.springframework.integration.channel.DirectChannel

import org.springframework.integration.core.MessageHandler;

public class CamelSourceAdapterTest extends CamelSpringTestSupport {
    @Test
    public void testSendingOneWayMessage() throws Exception {
        DirectChannel channelA = (DirectChannel) applicationContext.getBean("channelA");
        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

Examples of org.springframework.integration.channel.DirectChannel

    public void testSendingTwoWayMessage() throws Exception {

        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

Examples of org.springframework.integration.channel.DirectChannel

    @Test
    public void testSendingTwoWayMessageWithMessageAddress() throws Exception {

        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

Examples of org.springframework.integration.channel.DirectChannel

        MessageChannel requestChannel = getMandatoryBean(MessageChannel.class, "requestChannel");
        Map<String, Object> maps = new HashMap<String, Object>();
        maps.put(MessageHeaders.REPLY_CHANNEL, "responseChannel");
        Message<String> message = new GenericMessage<String>(MESSAGE_BODY, maps);

        DirectChannel responseChannel = getMandatoryBean(DirectChannel.class, "responseChannel");
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                latch.countDown();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  message.getPayload());
                assertEquals("Done",  message.getHeaders().get("Status"));
            }            
View Full Code Here

Examples of org.springframework.integration.channel.DirectChannel

    public void testSendingTwoWayMessage() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);
        MessageChannel requestChannel = getMandatoryBean(MessageChannel.class, "channelB");
        Message<?> message = new GenericMessage<Object>(MESSAGE_BODY);
        //Need to subscribe the responseChannel first
        DirectChannel responseChannel = getMandatoryBean(DirectChannel.class, "channelC");
        responseChannel.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message) {
                latch.countDown();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  message.getPayload());
            }           
        });
View Full Code Here

Examples of org.springframework.integration.channel.DirectChannel

    @Test
    public void testSendingTwoWayMessageWithMessageAddress() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);
        MessageChannel requestChannel = getMandatoryBean(MessageChannel.class, "channelD");
        DirectChannel responseChannel = getMandatoryBean(DirectChannel.class, "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) {
                latch.countDown();
                assertEquals("Get the wrong result", MESSAGE_BODY + " is processed",  message.getPayload());
            }           
        });
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.