Package org.springframework.integration.channel

Examples of org.springframework.integration.channel.MessageChannel


import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.message.Message;

public class CamelSourceAdapterTest extends SpringTestSupport {
    public void testSendingOneWayMessage() throws Exception {
        MessageChannel channelA = (MessageChannel) applicationContext.getBean("channelA");
        template.sendBody("direct:OneWay", "Willem");
        Message message = channelA.receive();
        assertEquals("We should get the message from channelA", message.getPayload(), "Willem");

    }
View Full Code Here


        exchange.setIn(new SpringIntegrationMessage(siInMessage));
        getProcessor().process(exchange);
        if (endpoint.isInOut()) {
            // get the output channel from message header
            Object returnAddress = siInMessage.getHeader().getReturnAddress();
            MessageChannel reply = null;

            if (returnAddress != null) {
                if (returnAddress instanceof String) {
                    reply = (MessageChannel)context.getApplicationContext().getBean((String)returnAddress);
                } else if (returnAddress instanceof MessageChannel) {
                    reply = (MessageChannel) returnAddress;
                }
            } else {
                if (outputChannel != null) {
                    // using the outputChannel
                    reply = outputChannel;
                } else {
                    if (ObjectHelper.isNullOrBlank(endpoint.getOutputChannel())) {
                        outputChannel = (MessageChannel) channelRegistry.lookupChannel(endpoint.getOutputChannel());
                        ObjectHelper.notNull(inputChannel, "The outputChannel with the name [" + endpoint.getOutputChannel() + "]");
                        reply = outputChannel;
                    } else {
                        throw new RuntimeCamelException("Can't find the right outputChannelName");
                    }
                }
            }
            // put the message back the outputChannel if we need
            org.springframework.integration.message.Message siOutMessage =
                SpringIntegrationBinding.storeToSpringIntegrationMessage(exchange.getOut());
            reply.send(siOutMessage);
        }


    }
View Full Code Here

TOP

Related Classes of org.springframework.integration.channel.MessageChannel

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.