Package org.springframework.integration

Examples of org.springframework.integration.MessageChannel


public class ControlBusDemo {

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("context.xml", ControlBusDemo.class);
    NumberHolder numberHolder = context.getBean("numberHolder", NumberHolder.class);
    MessageChannel controlChannel = context.getBean("controlChannel", MessageChannel.class);
    System.out.println("number before increment: " + numberHolder.getNumber());
    Message<String> message = MessageBuilder.withPayload("@numberHolder.increment()").build();
    controlChannel.send(message);
    System.out.println("number after increment:  " + numberHolder.getNumber());
    FilePoller filePoller = context.getBean("filePoller", FilePoller.class);
    System.out.println("file poller isRunning before start: " + filePoller.isRunning());
    controlChannel.send(MessageBuilder.withPayload("@filePoller.start()").build());
    System.out.println("file poller isRunning after start:  " + filePoller.isRunning());
    controlChannel.send(MessageBuilder.withPayload("@filePoller.stop()").build());
    System.out.println("file poller isRunning after stop:   " + filePoller.isRunning());
    ThreadPoolTaskExecutor executor = context.getBean("myExecutor", ThreadPoolTaskExecutor.class);
    System.out.println("max pool size before update: " + executor.getMaxPoolSize());
    controlChannel.send(MessageBuilder.withPayload("@myExecutor.setMaxPoolSize(25)").build());
    System.out.println("max pool size after update:  " + executor.getMaxPoolSize());
  }
View Full Code Here


*/
public class ChannelAdapterDemo {

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("siia/jms/channel-adapters.xml");
    MessageChannel toJMS = context.getBean("toJMS", MessageChannel.class);
    PollableChannel fromJMS = context.getBean("fromJMS", PollableChannel.class);
    MessagingTemplate template = new MessagingTemplate();
    template.convertAndSend(toJMS, "echo");
    Object response = template.receiveAndConvert(fromJMS);
    System.out.println("response: " + response);
View Full Code Here

public class HelloWorldExample {

  public static void main(String args[]) {
  String cfg = "siia/helloworld/channel/context.xml";
    ApplicationContext context = new ClassPathXmlApplicationContext(cfg);
    MessageChannel channel = context.getBean("names", MessageChannel.class);
    Message<String> message = MessageBuilder.withPayload("World").build();
    channel.send(message);
  }
View Full Code Here

public class WireTapDemo {

  public static void main(String[] args) {
    ClassPathXmlApplicationContext context =
        new ClassPathXmlApplicationContext("context.xml", WireTapDemo.class);
    MessageChannel debitChannel =
        context.getBean("debitChannel", MessageChannel.class);
    Message<Debit> message1 = MessageBuilder.withPayload(
        new Debit(new BigDecimal(5000), "SMALL")).build();
    Message<Debit> message2 = MessageBuilder.withPayload(
        new Debit(new BigDecimal(25000), "BIG")).build();
    debitChannel.send(message1);
    debitChannel.send(message2);
  }
View Full Code Here

public class JmxDemo {

  public static void main(String[] args) throws InterruptedException {
    ClassPathXmlApplicationContext context =
        new ClassPathXmlApplicationContext("context.xml", JmxDemo.class);
    MessageChannel channel = context.getBean("channel", MessageChannel.class);
    for (int i = 0; i < 1000; i++) {
      channel.send(MessageBuilder.withPayload(i + "").build());
      Thread.sleep(3000);
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.integration.MessageChannel

Copyright © 2018 www.massapicom. 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.