Examples of SubscribableChannel


Examples of org.springframework.messaging.SubscribableChannel

    final CountDownLatch latch = new CountDownLatch(1);

    this.template.setReceiveTimeout(1);
    this.template.setThrowExceptionOnLateReply(true);

    SubscribableChannel channel = new ExecutorSubscribableChannel(this.executor);
    channel.subscribe(new MessageHandler() {
      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        try {
          Thread.sleep(500);
          MessageChannel replyChannel = (MessageChannel) message.getHeaders().getReplyChannel();
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

  private TestController testController;


  @Before
  public void setup() {
    SubscribableChannel channel = Mockito.mock(SubscribableChannel.class);
    SimpMessageSendingOperations brokerTemplate = new SimpMessagingTemplate(channel);

    this.messageHandler = new TestSimpAnnotationMethodMessageHandler(brokerTemplate, channel, channel);
    this.messageHandler.setApplicationContext(new StaticApplicationContext());
    this.messageHandler.setValidator(new StringTestValidator(TEST_INVALID_VALUE));
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

  @Override
  public void bindReplier(String name, final MessageChannel requests, MessageChannel replies,
      Properties properties) {
    validateConsumerProperties(name, properties, Collections.emptySet());
    SubscribableChannel requestChannel = this.findOrCreateRequestReplyChannel("requestor." + name);
    requestChannel.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        requests.send(message);
      }
    });

    // TODO: handle Pollable ?
    Assert.isInstanceOf(SubscribableChannel.class, replies);
    final SubscribableChannel replyChannel = this.findOrCreateRequestReplyChannel("replier." + name);
    ((SubscribableChannel) replies).subscribe(new MessageHandler() {

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

Examples of org.springframework.messaging.SubscribableChannel

    module.initialize();
    module.start();
    assertEquals(processor, module.getType());
    MessageChannel input = module.getComponent("input", MessageChannel.class);
    assertNotNull(input);
    SubscribableChannel output = module.getComponent("output", SubscribableChannel.class);
    assertNotNull(output);
    final AtomicReference<Message<?>> result = new AtomicReference<Message<?>>();
    output.subscribe(new MessageHandler() {

      @Override
      public void handleMessage(Message<?> message) {
        result.set(message);
      }
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

    Assert.notNull(streamName, "streamName cannot be null");
    Assert.notNull(test, "test cannot be null");
    Assert.notNull(message, "message cannot be null");

    MessageChannel producer = getSourceOutputChannel(streamName);
    SubscribableChannel consumer = getSinkInputChannel(streamName);
    consumer.subscribe(test);
    producer.send(message);
    assertTrue(test.getMessageHandled());
  }
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

    deployStream(
        tapName,
        tapChannel + " > sink");

    MessageChannel producer = getSourceOutputChannel(streamName);
    SubscribableChannel consumer = getSinkInputChannel(tapName);
    SubscribableChannel streamConsumer = getSinkInputChannel(streamName);

    // Add a dummy consumer to the stream in case there is none
    streamConsumer.subscribe(new MessageHandler() {

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

Examples of org.springframework.messaging.SubscribableChannel

    context.getEnvironment().getPropertySources().addLast(new PropertiesPropertySource("options", properties));
    context.register(TestConfiguration.class);
    context.refresh();

    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

Examples of org.springframework.messaging.SubscribableChannel

    final Module module = new ResourceConfiguredModule(moduleDescriptor,
        new ModuleDeploymentProperties());

    final TestMessageBus messageBus = new TestMessageBus();
    final JobEventsListenerPlugin eventsListenerPlugin = new JobEventsListenerPlugin(messageBus);
    final SubscribableChannel jobExecutionEventsChannel = new PublishSubscribeChannel();
    final SubscribableChannel stepExecutionEventsChannel = new PublishSubscribeChannel();
    final SubscribableChannel chunkEventsChannel = new PublishSubscribeChannel();
    final SubscribableChannel itemEventsChannel = new PublishSubscribeChannel();
    final SubscribableChannel skipEventsChannel = new PublishSubscribeChannel();
    final SubscribableChannel aggregatedEventsChannel = new PublishSubscribeChannel();

    final Module spiedModule = spy(module);

    doReturn(messageBus).when(spiedModule).getComponent(MessageBus.class);
    doReturn(jobExecutionEventsChannel).when(spiedModule).getComponent("xd.job.jobExecutionEvents",
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.