Package org.springframework.messaging

Examples of org.springframework.messaging.MessageChannel.send()


      LOG.info("message sent " + i);
    }

    //sending 5,000 messages to kafka server for topic test2
    for (int i = 0; i < 50; i++) {
      channel.send(
        MessageBuilder.withPayload("hello Fom ob adapter test2 -  " + i)
          .setHeader("messageKey", String.valueOf(i))
          .setHeader("topic", "test2").build());

      LOG.info("message sent " + i);
View Full Code Here


      LOG.info("message sent " + i);
    }

    //Send some messages to multiple topics matching regex.
    for (int i = 0; i < 10; i++) {
      channel.send(
        MessageBuilder.withPayload("hello Fom ob adapter regextopic1 -  " + i)
          .setHeader("messageKey", String.valueOf(i))
          .setHeader("topic", "regextopic1").build());

      LOG.info("message sent " + i);
View Full Code Here

          .setHeader("topic", "regextopic1").build());

      LOG.info("message sent " + i);
    }
    for (int i = 0; i < 10; i++) {
      channel.send(
        MessageBuilder.withPayload("hello Fom ob adapter regextopic2 -  " + i)
          .setHeader("messageKey", String.valueOf(i))
          .setHeader("topic", "regextopic2").build());

      LOG.info("message sent " + i);
View Full Code Here

    if (instanceRepository.findOne(name) == null) {
      throwNotDeployedException(name);
    }
    // todo: is this Assert necessary? if not we can remove the parser dependency and parse method
    Assert.isTrue(parse(name, job.getDefinition()).size() == 1, "Expecting only a single module");
    channel.send(MessageBuilder.withPayload(jobParameters != null ? jobParameters : "").build());
  }

  @Override
  protected JobDefinition createDefinition(String name, String definition) {
    return new JobDefinition(name, definition);
View Full Code Here

    Assert.isInstanceOf(SubscribableChannel.class, requests);
    ((SubscribableChannel) requests).subscribe(new MessageHandler() {

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

    ExecutorChannel replyChannel = this.findOrCreateRequestReplyChannel("replier." + name);
    replyChannel.subscribe(new MessageHandler() {
View Full Code Here

      @Override
      public void handleMessage(Message<?> message) {
        result.set(message);
      }
    });
    input.send(MessageBuilder.withPayload("foo").build());
    Message<?> message = result.get();
    assertEquals("foo12", message.getPayload());
  }

  @Test
View Full Code Here

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

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

  protected void sendPayloadAndVerifyOutput(String streamName, Object payload, MessageTest test) {
    Assert.notNull(payload, "payload cannot be null");
View Full Code Here

      public void handleMessage(Message<?> message) throws MessagingException {
      }
    });

    consumer.subscribe(test);
    producer.send(message);
    assertTrue(test.getMessageHandled());

    undeployStream(tapName);
  }
View Full Code Here

  @Test
  public void testWritesWithRollover() throws Exception {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/xd/integration/hadoop/config/HdfsOutboundChannelAdapterIntegrationTests.xml");
    MessageChannel channel = context.getBean("hdfsOut", MessageChannel.class);
    channel.send(MessageBuilder.withPayload("foo").build());
    channel.send(MessageBuilder.withPayload("bar").build());
    FileSystem fileSystem = context.getBean("hadoopFs", FileSystem.class);
    String path = context.getBean("path", String.class);
    context.close();
    Path basepath = new Path(path + "/testdir/");
View Full Code Here

  public void testWritesWithRollover() throws Exception {
    ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
        "org/springframework/xd/integration/hadoop/config/HdfsOutboundChannelAdapterIntegrationTests.xml");
    MessageChannel channel = context.getBean("hdfsOut", MessageChannel.class);
    channel.send(MessageBuilder.withPayload("foo").build());
    channel.send(MessageBuilder.withPayload("bar").build());
    FileSystem fileSystem = context.getBean("hadoopFs", FileSystem.class);
    String path = context.getBean("path", String.class);
    context.close();
    Path basepath = new Path(path + "/testdir/");
    Path filepath0 = new Path(basepath, "testfile-0");
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.