Examples of MessageChannel


Examples of org.springframework.messaging.MessageChannel

  public void runDemo() throws Exception{

    ConfigurableApplicationContext ctx =
      new ClassPathXmlApplicationContext("META-INF/spring/integration/FtpOutboundChannelAdapterSample-context.xml");

    MessageChannel ftpChannel = ctx.getBean("ftpChannel", MessageChannel.class);

    baseFolder.mkdirs();

    final File fileToSendA = new File(baseFolder, "a.txt");
    final File fileToSendB = new File(baseFolder, "b.txt");

    final InputStream inputStreamA = FtpOutboundChannelAdapterSample.class.getResourceAsStream("/test-files/a.txt");
    final InputStream inputStreamB = FtpOutboundChannelAdapterSample.class.getResourceAsStream("/test-files/b.txt");

    FileUtils.copyInputStreamToFile(inputStreamA, fileToSendA);
    FileUtils.copyInputStreamToFile(inputStreamB, fileToSendB);

    assertTrue(fileToSendA.exists());
    assertTrue(fileToSendB.exists());

    final Message<File> messageA = MessageBuilder.withPayload(fileToSendA).build();
    final Message<File> messageB = MessageBuilder.withPayload(fileToSendB).build();

    ftpChannel.send(messageA);
    ftpChannel.send(messageB);

    Thread.sleep(2000);

    assertTrue(new File(TestSuite.FTP_ROOT_DIR + File.separator + "a.txt").exists());
    assertTrue(new File(TestSuite.FTP_ROOT_DIR + File.separator + "b.txt").exists());
View Full Code Here

Examples of org.springframework.messaging.MessageChannel

  @Test
  public void runDemo() throws Exception{
    ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/spring/integration/SendInstantMessageSample-context.xml");
   
    MessageChannel toUserChannel = context.getBean("toUserChannel", MessageChannel.class);
    Message<String> message = new GenericMessage<String>("Hello from Spring Integration XMPP");
    toUserChannel.send(message);
  }
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.