Package org.springframework.integration.channel

Examples of org.springframework.integration.channel.DirectChannel.subscribe()


        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


        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

        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

    @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

        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

        gatewayProxy.setBeanFactory(getBeanFactory());
        gatewayProxy.setBeanName("gateway-"+s.getName());
        gatewayProxy.setComponentName("gateway-" + s.getName());
        gatewayProxy.setDefaultReplyChannel(reply);

        mc.subscribe(new ServiceActivatingHandler(s, "consume"));

        gatewayProxy.afterPropertiesSet();

        this.proxyMap.put(s.getName(), gatewayProxy);
      }
View Full Code Here

            wireTapLogger.setBeanName("OutputWireTapper");
            wireTapLogger.setBeanFactory(context.getBeanFactory());
            wireTapLogger.setLoggerName("wiretap");
            wireTapLogger.setShouldLogFullMessage(true);
            wireTapLogger.afterPropertiesSet();
            wireTapChannel.subscribe(wireTapLogger);

            List<ChannelInterceptor> ints = new ArrayList<ChannelInterceptor>();
            WireTap wt = new WireTap(wireTapChannel);
            ints.add(wt);
            outputChannel.setInterceptors(ints);
View Full Code Here

              MethodInvokingSplitter mis = new MethodInvokingSplitter(notificationUtils, "splitMessage");
              mis.setBeanName(platformType + "Splitter");
              mis.setBeanFactory(context.getBeanFactory());
              mis.setChannelResolver(channelResolver);
              mis.setOutputChannel(signChannel);
              splitterChannel.subscribe(mis);

              //sign messages and inject url into message headers via HeaderEnricher
              Map<String, SignedHeaderValueMessageProcessor<String>> urlHeaderToSign = new HashMap<String, SignedHeaderValueMessageProcessor<String>>();
              URI su = URI.create(uri);
              urlHeaderToSign.put("x-url", new SignedHeaderValueMessageProcessor<String>(su.getPath()));
View Full Code Here

      handler.setReleasePartialSequences(true);
      DirectChannel resequenced = new DirectChannel();
      resequenced.setBeanName("resequencedWSFrames");
      handler.setOutputChannel(resequenced);
      this.resequencer = new EventDrivenConsumer(this.resequenceChannel, handler);
      resequenced.subscribe(new MessageHandler() {

        @Override
        public void handleMessage(Message<?> message) throws MessagingException {
          doOnMessage(message);
        }
View Full Code Here

    addBinding(consumerBinding);
    ReceivingHandler convertingBridge = new ReceivingHandler();
    convertingBridge.setOutputChannel(moduleInputChannel);
    convertingBridge.setBeanName(name + ".convert.bridge");
    convertingBridge.afterPropertiesSet();
    bridgeToModuleChannel.subscribe(convertingBridge);
    consumerBinding.start();
  }

  @Override
  public void bindProducer(final String name, MessageChannel moduleOutputChannel,
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.