Package org.springframework.integration.channel

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


      @Override
      public void run() {
        ConsumerIterator<Integer, byte[]> it = stream.iterator();
        while (it.hasNext()) {
          byte[] msg = it.next().message();
          bridge.send(MessageBuilder.withPayload(msg).build());
        }
      }

    });
  }
View Full Code Here


    assertFalse(singleNodeApplication.pluginContext().containsBean("queue:z"));


    DirectChannel testChannel = new DirectChannel();
    bus.bindProducer("queue:x", testChannel, null);
    testChannel.send(MessageBuilder.withPayload("y").build());
    Thread.sleep(2000);

    singleNodeApplication.pluginContext().getBean("queue:y", MessageChannel.class);
    assertFalse(singleNodeApplication.pluginContext().containsBean("queue:z"));
View Full Code Here

    Thread.sleep(2000);

    singleNodeApplication.pluginContext().getBean("queue:y", MessageChannel.class);
    assertFalse(singleNodeApplication.pluginContext().containsBean("queue:z"));

    testChannel.send(MessageBuilder.withPayload("z").build());
    Thread.sleep(2000);
    MessageChannel y3 = singleNodeApplication.pluginContext().getBean("queue:y", MessageChannel.class);
    MessageChannel z3 = singleNodeApplication.pluginContext().getBean("queue:z", MessageChannel.class);
    assertNotNull(y3);
    assertNotNull(z3);
View Full Code Here

    assertFalse(singleNodeApplication.pluginContext().containsBean("topic:z"));


    DirectChannel testChannel = new DirectChannel();
    bus.bindPubSubProducer("topic:x", testChannel, null);
    testChannel.send(MessageBuilder.withPayload("y").build());
    Thread.sleep(2000);

    singleNodeApplication.pluginContext().getBean("topic:y", MessageChannel.class);
    assertFalse(singleNodeApplication.pluginContext().containsBean("topic:z"));
View Full Code Here

    Thread.sleep(2000);

    singleNodeApplication.pluginContext().getBean("topic:y", MessageChannel.class);
    assertFalse(singleNodeApplication.pluginContext().containsBean("topic:z"));

    testChannel.send(MessageBuilder.withPayload("z").build());
    Thread.sleep(2000);
    MessageChannel y3 = singleNodeApplication.pluginContext().getBean("topic:y", MessageChannel.class);
    MessageChannel z3 = singleNodeApplication.pluginContext().getBean("topic:z", MessageChannel.class);
    assertNotNull(y3);
    assertNotNull(z3);
View Full Code Here

    assertNotNull(z3);

    QueueChannel consumer = new QueueChannel();
    bus.bindPubSubConsumer("topic:y", consumer, null);
    bus.bindPubSubConsumer("topic:z", consumer, null);
    testChannel.send(MessageBuilder.withPayload("y").build());
    Thread.sleep(2000);
    testChannel.send(MessageBuilder.withPayload("z").build());
    Thread.sleep(2000);
    assertEquals("y", consumer.receive(2000).getPayload());
    assertEquals("z", consumer.receive(2000).getPayload());
View Full Code Here

    QueueChannel consumer = new QueueChannel();
    bus.bindPubSubConsumer("topic:y", consumer, null);
    bus.bindPubSubConsumer("topic:z", consumer, null);
    testChannel.send(MessageBuilder.withPayload("y").build());
    Thread.sleep(2000);
    testChannel.send(MessageBuilder.withPayload("z").build());
    Thread.sleep(2000);
    assertEquals("y", consumer.receive(2000).getPayload());
    assertEquals("z", consumer.receive(2000).getPayload());
    assertEquals(0, consumer.getQueueSize());
View Full Code Here

    });

    Message<TestPayload> msg = MessageBuilder.withPayload(new TestPayload())
        .setHeader(MessageHeaders.CONTENT_TYPE, MediaType.ALL_VALUE).build();

    input.send(msg);
    assertTrue(msgSent.get());
  }

  static class TestPayload {
View Full Code Here

    messageBus.bindProducer("foo.0", moduleOutputChannel, null);
    messageBus.bindConsumer("foo.0", moduleInputChannel, null);
    Message<?> message = MessageBuilder.withPayload("foo").setHeader(MessageHeaders.CONTENT_TYPE, "foo/bar").build();
    // Let the consumer actually bind to the producer before sending a msg
    busBindUnbindLatency();
    moduleOutputChannel.send(message);
    Message<?> inbound = moduleInputChannel.receive(5000);
    assertNotNull(inbound);
    assertEquals("foo", inbound.getPayload());
    assertNull(inbound.getHeaders().get(MessageBusSupport.ORIGINAL_CONTENT_TYPE_HEADER));
    assertEquals("foo/bar", inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE));
View Full Code Here

    messageBus.bindProducer("bar.0", moduleOutputChannel, null);
    messageBus.bindConsumer("bar.0", moduleInputChannel, null);
    busBindUnbindLatency();

    Message<?> message = MessageBuilder.withPayload("foo").build();
    moduleOutputChannel.send(message);
    Message<?> inbound = moduleInputChannel.receive(5000);
    assertNotNull(inbound);
    assertEquals("foo", inbound.getPayload());
    assertNull(inbound.getHeaders().get(MessageBusSupport.ORIGINAL_CONTENT_TYPE_HEADER));
    assertNull(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE));
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.