Package org.springframework.messaging

Examples of org.springframework.messaging.MessageHandler


  }

  private void doRegisterProducer(final String name, MessageChannel moduleOutputChannel, MessageHandler delegate,
      String replyTo, RedisPropertiesAccessor properties) {
    Assert.isInstanceOf(SubscribableChannel.class, moduleOutputChannel);
    MessageHandler handler = new SendingHandler(delegate, replyTo, properties);
    EventDrivenConsumer consumer = new EventDrivenConsumer((SubscribableChannel) moduleOutputChannel, handler);
    consumer.setBeanFactory(this.getBeanFactory());
    consumer.setBeanName("outbound." + name);
    consumer.afterPropertiesSet();
    Binding producerBinding = Binding.forProducer(name, moduleOutputChannel, consumer, properties);
View Full Code Here


    bus.bindConsumer("direct.0", moduleInputChannel, null);
    bus.bindProducer("direct.0", moduleOutputChannel, properties);

    final AtomicReference<Thread> caller = new AtomicReference<Thread>();
    final AtomicInteger count = new AtomicInteger();
    moduleInputChannel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        caller.set(Thread.currentThread());
        count.incrementAndGet();
View Full Code Here

    MessageChannel input = context.getBean("input", MessageChannel.class);
    SubscribableChannel output = context.getBean("output", SubscribableChannel.class);

    final AtomicBoolean handled = new AtomicBoolean();
    output.subscribe(new MessageHandler() {
      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        handled.set(true);
        assertEquals("foohellobar", message.getPayload());
      }
View Full Code Here

     * Any message that enters this {@link org.springframework.messaging.MessageHandler}
     * containing a {@code executionId} parameter will trigger a
     * {@link org.activiti.engine.RuntimeService#signal(String)}.
     */
    public static MessageHandler signallingMessageHandler(final ProcessEngine processEngine) {
        return new MessageHandler() {
            @Override
            public void handleMessage(Message<?> message) throws MessagingException {
                String executionId = message.getHeaders().containsKey("executionId") ?
                        (String) message.getHeaders().get("executionId") : (String) null;

View Full Code Here

                + dateFormat.format(Calendar.getInstance().getTime());

        // String message = "http://google.com";

        final AtomicReference<Message<?>> received = new AtomicReference<Message<?>>();
        bites.subscribe(new MessageHandler() {
            public void handleMessage(Message<?> message)
                    throws MessagingException {
                received.set(message);
            }
        });
View Full Code Here

        }
    }

    @Override
    public void unsubscribe(EventListener eventListener) {
        MessageHandler messageHandler = handlers.remove(eventListener);
        if (messageHandler != null) {
            channel.unsubscribe(messageHandler);
        }
    }
View Full Code Here

        }
    }

    @Override
    public void subscribe(EventListener eventListener) {
        MessageHandler messagehandler = new MessageHandlerAdapter(eventListener);
        MessageHandler oldHandler = handlers.putIfAbsent(eventListener, messagehandler);
        if (oldHandler == null) {
            channel.subscribe(messagehandler);
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.messaging.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.