Examples of MessageChannel


Examples of org.springframework.messaging.MessageChannel

  @Test
  public void runDemo() throws Exception{
    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

Examples of org.springframework.messaging.MessageChannel

  public static void main(String[] args) throws Exception {
    AbstractApplicationContext applicationContext =
      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();
  }
View Full Code Here

Examples of org.springframework.messaging.MessageChannel

      final File file = new File(sourceFileName);

      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

Examples of org.springframework.messaging.MessageChannel

    // 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

Examples of org.springframework.messaging.MessageChannel

    System.setProperty("spring.profiles.active", "testCase");

    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

Examples of org.springframework.messaging.MessageChannel

    System.setProperty("spring.profiles.active", "testCase");

    final GenericXmlApplicationContext applicationContext = new GenericXmlApplicationContext(configFilesChannelAdapterDemo);

    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

Examples of org.springframework.messaging.MessageChannel

  @Test
  public void demoControlBus(){
    ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext(
        "/META-INF/spring/integration/ControlBusDemo-context.xml");
    MessageChannel controlChannel = ac.getBean("controlChannel", MessageChannel.class);
    PollableChannel adapterOutputChanel = ac.getBean("adapterOutputChanel", PollableChannel.class);
    logger.info("Received before adapter started: " + adapterOutputChanel.receive(1000));
    controlChannel.send(new GenericMessage<String>("@inboundAdapter.start()"));
    logger.info("Received before adapter started: " + adapterOutputChanel.receive(1000));
    controlChannel.send(new GenericMessage<String>("@inboundAdapter.stop()"));
    logger.info("Received after adapter stopped: " + adapterOutputChanel.receive(1000));
    ac.close();
  }
View Full Code Here

Examples of org.springframework.messaging.MessageChannel

   *
   * @param customer
   * @return a channel
   */
  public MessageChannel resolve(String customer) {
    MessageChannel channel = this.channels.get(customer);
    if (channel == null) {
      channel = createNewCustomerChannel(customer);
    }
    return channel;
  }
View Full Code Here

Examples of org.springframework.messaging.MessageChannel

  private static Logger logger = Logger.getLogger(HelloWorldApp.class);

  public static void main(String[] args) {
    AbstractApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/spring/integration/helloWorldDemo.xml", HelloWorldApp.class);
    MessageChannel inputChannel = context.getBean("inputChannel", MessageChannel.class);
    PollableChannel outputChannel = context.getBean("outputChannel", PollableChannel.class);
    inputChannel.send(new GenericMessage<String>("World"));
    logger.info("==> HelloWorldDemo: " + outputChannel.receive(0).getPayload());
  }
View Full Code Here

Examples of org.springframework.messaging.MessageChannel

    }
    return channel;
  }

  private synchronized MessageChannel createNewCustomerChannel(String customer) {
    MessageChannel channel = this.channels.get(customer);
    if (channel == null) {
      ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(
          new String[] { "/META-INF/spring/integration/dynamic-ftp-outbound-adapter-context.xml" },
          false);
      this.setEnvironmentForCustomer(ctx, customer);
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.