Examples of MessageHandler


Examples of org.springframework.integration.core.MessageHandler

        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

Examples of org.springframework.integration.message.MessageHandler

            org.springframework.integration.core.Message request =
                SpringIntegrationBinding.createSpringIntegrationMessage(exchange);
            Map<String, Object> headers = new HashMap<String, Object>();
            if (exchange.getPattern().isOutCapable()) {
                headers.put(MessageHeaders.REPLY_CHANNEL , replyChannel);
                replyChannel.subscribe(new MessageHandler() {               
                    public void handleMessage(Message<?> message) {
                        //TODO set the corralationID
                        SpringIntegrationBinding.storeToCamelMessage(message, exchange.getOut());
                        callback.done(true);
                    }
View Full Code Here

Examples of org.springframework.integration.message.MessageHandler

    public boolean process(final Exchange exchange, final AsyncCallback callback) {
        Map<String, Object> headers = new HashMap<String, Object>();
        if (exchange.getPattern().isOutCapable()) {
            headers.put(MessageHeaders.REPLY_CHANNEL , inputChannel);
            inputChannel.subscribe(new MessageHandler() {               
                public void handleMessage(Message<?> message) {                   
                    SpringIntegrationBinding.storeToCamelMessage(message, exchange.getOut());
                    callback.done(true);
                }
            });
View Full Code Here

Examples of org.springframework.integration.message.MessageHandler

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

        MessageChannel requestChannel = (MessageChannel) applicationContext.getBean("channelB");
        Message message = new StringMessage(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.message.MessageHandler

        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.message.MessageHandler

import org.springframework.integration.message.MessageHandler;

public class CamelSourceAdapterTest extends SpringTestSupport {
    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.messaging.MessageHandler


  public static void main (String[] args) throws Exception {
    ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/gmail-imap-idle-config.xml");
    DirectChannel inputChannel = ac.getBean("receiveChannel", DirectChannel.class);
    inputChannel.subscribe(new MessageHandler() {
      public void handleMessage(Message<?> message) throws MessagingException {
        logger.info("Message: " + message);
      }
    });
  }
View Full Code Here

Examples of org.springframework.messaging.MessageHandler

  private static Logger logger = Logger.getLogger(GmailInboundPop3AdapterTestApp.class);

  public static void main (String[] args) throws Exception {
    ApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/gmail-pop3-config.xml");
    DirectChannel inputChannel = ac.getBean("receiveChannel", DirectChannel.class);
    inputChannel.subscribe(new MessageHandler() {
      public void handleMessage(Message<?> message) throws MessagingException {
        logger.info("Message: " + message);
      }
    });
  }
View Full Code Here

Examples of org.subethamail.smtp.MessageHandler

    {
      context.sendResponse("503 Refusing any other AUTH command.");
      return;
    }

    MessageHandler msgHandler = getMessageHandler(context);
    boolean authenticating = context.getSession().isAuthenticating();
   
    if (!authenticating)
    {
      String[] args = getArgs(commandString);
     
      // Let's check the command syntax
      if (args.length < 2)
      {
        context.sendResponse("501 Syntax: " + VERB
            + " mechanism [initial-response]");
        return;
      }
     
      // Let's check if we support the required authentication mechanism
      String mechanism = args[1];
      if (!msgHandler.getAuthenticationMechanisms().contains(
          mechanism.toUpperCase()))
      {
        context
            .sendResponse("504 The requested authentication mechanism is not supported");
        return;
      }
    }
   
    // OK, let's go trough the authentication process.
    // The authentication process may require a series of
    // challenge-responses
    try
    {           
      if (authenticating && commandString.trim().equals(AUTH_CANCEL_COMMAND))
      {
        // RFC 2554 explicitly states this:
        context.sendResponse("501 Authentication canceled by client.");
        return;
      }
     
      StringBuilder response = new StringBuilder();
      boolean finished = msgHandler.auth(commandString, response, context);
     
      context.getSession().setAuthenticating(!finished);
     
      if (!finished)
      {
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.