Package org.springframework.messaging

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


    File file = File.createTempFile("temp", "txt");
    Message<File> message = MessageBuilder.withPayload(file)
            .setHeader("customer", "cust1")
            .build();
    try {
      channel.send(message);
    }
    catch (MessagingException e) {
      assertThat(e.getCause().getCause().getCause(), instanceOf(UnknownHostException.class));
      assertTrue(e.getCause().getCause().getCause().getMessage().startsWith("host.for.cust1"));
    }
View Full Code Here


      assertThat(e.getCause().getCause().getCause(), instanceOf(UnknownHostException.class));
      assertTrue(e.getCause().getCause().getCause().getMessage().startsWith("host.for.cust1"));
    }
    // send another so we can see in the log we don't create the ac again.
    try {
      channel.send(message);
    }
    catch (MessagingException e) {
      assertThat(e.getCause().getCause().getCause(), instanceOf(UnknownHostException.class));
      assertTrue(e.getCause().getCause().getCause().getMessage().startsWith("host.for.cust1"));
    }
View Full Code Here

    }
    // send to a different customer; again, check the log to see a new ac is built
    message = MessageBuilder.withPayload(file)
        .setHeader("customer", "cust2").build();
    try {
      channel.send(message);
    }
    catch (MessagingException e) {
      assertThat(e.getCause().getCause().getCause(), instanceOf(UnknownHostException.class));
      assertTrue(e.getCause().getCause().getCause().getMessage().startsWith("host.for.cust2"));
    }
View Full Code Here

    // send to a different customer; again, check the log to see a new ac is built
    //and the first one created (cust1) should be closed and removed as per the max cache size restriction
    message = MessageBuilder.withPayload(file)
        .setHeader("customer", "cust3").build();
    try {
      channel.send(message);
    }
    catch (MessagingException e) {
      assertThat(e.getCause().getCause().getCause(), instanceOf(UnknownHostException.class));
      assertTrue(e.getCause().getCause().getCause().getMessage().startsWith("host.for.cust3"));
    }
View Full Code Here

    //send to cust1 again, since this one has been invalidated before, we should
    //see a new ac created (with ac of cust2 destroyed and removed)
    message = MessageBuilder.withPayload(file)
        .setHeader("customer", "cust1").build();
    try {
      channel.send(message);
    }
    catch (MessagingException e) {
      assertThat(e.getCause().getCause().getCause(), instanceOf(UnknownHostException.class));
      assertEquals("host.for.cust1", e.getCause().getCause().getCause().getMessage());
    }
View Full Code Here

    ApplicationContext context =
      new ClassPathXmlApplicationContext("META-INF/spring/integration/TwitterSendUpdates-context.xml");
   
    MessageChannel twitterOutChannel = context.getBean("twitterOut", MessageChannel.class);
    Message<String> twitterUpdate = new GenericMessage<String>("Testing new Twitter samples for #springintegration");
    twitterOutChannel.send(twitterUpdate);
  }
}
View Full Code Here

      new ClassPathXmlApplicationContext("/META-INF/spring/integration/orderProcessingSample.xml",
        BookOrderProcessingTestApp.class);
    MessageChannel messageChannel = (MessageChannel) applicationContext.getBean("ordersChannel");
    GenericMessage<Document> orderMessage =
      createXmlMessageFromResource("META-INF/spring/integration/order.xml");
    messageChannel.send(orderMessage);
    applicationContext.close();
  }

  private static GenericMessage<Document> createXmlMessageFromResource(String path) throws Exception {
    Resource orderRes = new ClassPathResource(path);
View Full Code Here

      Assert.isTrue(file.exists(), String.format("File '%s' does not exist.", sourceFileName));

      final Message<File> message = MessageBuilder.withPayload(file).build();
      final MessageChannel inputChannel = ac.getBean("inputChannel", MessageChannel.class);

      inputChannel.send(message);
      Thread.sleep(2000);

      Assert.isTrue(SftpTestUtils.fileExists(template, destinationFileName));

      System.out.println(String.format("Successfully transferred '%s' file to a " +
View Full Code Here

    // Create the Message object
    Message<String> message = MessageBuilder.withPayload(requestXml).build();

    // Send the Message to the handler's input channel
    MessageChannel channel = channelResolver.resolveDestination("fahrenheitChannel");
    channel.send(message);
  }

}
View Full Code Here

    final GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext(configFilesGatewayDemo);

    final MessageChannel stdinToJmsoutChannel = applicationContext.getBean("stdinToJmsoutChannel", MessageChannel.class);

    stdinToJmsoutChannel.send(MessageBuilder.withPayload("jms test").build());

    final QueueChannel queueChannel = applicationContext.getBean("queueChannel", QueueChannel.class);

    @SuppressWarnings("unchecked")
    Message<String> reply = (Message<String>) queueChannel.receive(20000);
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.