Examples of PollableChannel


Examples of org.springframework.integration.core.PollableChannel

public class ObjectKeyTest extends BaseFunctionalTestCase {
  @Test
  public void testReceiveMessageByObjectKey() {
    final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "ObjectKeyTest-context.xml", getClass() );
    final StoreClient storeClient = context.getBean( "objectStoreClient", StoreClient.class );
    final PollableChannel inboundChannel = context.getBean( "voldemortInboundChannel", PollableChannel.class );

    // given
    final Car.CarId carId = new Car.CarId( 1 );
    final Car car = new Car( carId, "Ford Mustang" );
    storeClient.put( carId, car );

    // when
    final Message<Car> received = (Message<Car>) inboundChannel.receive();

    // then
    Assert.assertEquals( car, received.getPayload() );

    context.close();
View Full Code Here

Examples of org.springframework.integration.core.PollableChannel

   */
  @Test
  public void testReceiveMessageKey() {
    final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "VoldemortInboundAdapterTest-context.xml", getClass() );
    final StoreClient storeClient = context.getBean( "storeClient", StoreClient.class );
    final PollableChannel inboundChannel = context.getBean( "voldemortInboundChannel", PollableChannel.class );

    // given
    final Person lukasz = new Person( "lukasz", "Lukasz", "Antoniak" );
    storeClient.put( lukasz.getId(), lukasz );

    // when
    final Message<Person> received = (Message<Person>) inboundChannel.receive();

    // then
    Assert.assertEquals( lukasz, received.getPayload() );

    context.close();
View Full Code Here

Examples of org.springframework.integration.core.PollableChannel

   */
  @Test
  public void testReceiveMessageExpr() {
    final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "VoldemortInboundAdapterTest-context.xml", getClass() );
    final StoreClient storeClient = context.getBean( "storeClient", StoreClient.class );
    final PollableChannel inboundChannel = context.getBean( "voldemortInboundChannel", PollableChannel.class );

    // given
    final Person kinga = new Person( "kinga", "Kinga", "Mroz" );
    storeClient.put( kinga.getId(), kinga );

    // when
    final Message<Versioned<Person>> received = (Message<Versioned<Person>>) inboundChannel.receive();

    // then
    final Versioned found = storeClient.get( kinga.getId() );
    Assert.assertEquals( found, received.getPayload() );

View Full Code Here

Examples of org.springframework.integration.core.PollableChannel

  @Test
  public void testDeleteAfterPoll() {
    final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "VoldemortInboundAdapterTest-context.xml", getClass() );
    final StoreClient storeClient = context.getBean( "storeClient", StoreClient.class );
    final PollableChannel inboundChannel = context.getBean( "voldemortInboundChannel", PollableChannel.class );

    // given
    final Person robert = new Person( "robert", "Robert", "Antoniak" );
    storeClient.put( robert.getId(), robert );

    // when
    final Message<Person> received = (Message<Person>) inboundChannel.receive();

    // then
    Assert.assertEquals( robert, received.getPayload() );
    final Versioned found = storeClient.get( robert.getId() );
    Assert.assertNull( found );
View Full Code Here

Examples of org.springframework.integration.core.PollableChannel

    //mock
    StepExecution masterStepExecution = mock(StepExecution.class);
    StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
    MessagingOperations operations = mock(MessagingOperations.class);
    Message message = mock(Message.class);
    PollableChannel replyChannel = mock(PollableChannel.class);
    //when
    when(message.getPayload()).thenReturn(Collections.emptyList());
    when(operations.receive(replyChannel)).thenReturn(message);
    //set
    messageChannelPartitionHandler.setMessagingOperations(operations);
View Full Code Here

Examples of org.springframework.integration.core.PollableChannel

public class GatewayDemo {

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

Examples of org.springframework.integration.core.PollableChannel

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

Examples of org.springframework.messaging.PollableChannel

    }
    logger.info("Populated directory with files");
    Thread.sleep(2000);
    logger.info("Starting Spring Integration Sequential File processing");
    ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("META-INF/spring/integration/sequentialFileProcessing-config.xml");
    PollableChannel filesOutChannel = ac.getBean("filesOutChannel", PollableChannel.class);
    for (int i = 0; i < fileCount; i++) {
      logger.info("Finished processing " + filesOutChannel.receive(10000).getPayload());
    }
    ac.stop();
  }
View Full Code Here

Examples of org.springframework.messaging.PollableChannel

    }
    logger.info("Populated directory with files");
    Thread.sleep(2000);
    logger.info("Starting Spring Integration Sequential File processing");
    ConfigurableApplicationContext ac = new ClassPathXmlApplicationContext("/META-INF/spring/integration/concurrentFileProcessing-config.xml");
    PollableChannel filesOutChannel = ac.getBean("filesOutChannel", PollableChannel.class);
    for (int i = 0; i < fileCount; i++) {
      logger.info("Finished processing " + filesOutChannel.receive(10000).getPayload());
    }
    ac.stop();
  }
View Full Code Here

Examples of org.springframework.messaging.PollableChannel

    String file2 = "b.txt";
    String file3 = "c.bar";
    new File("local-dir", file1).delete();
    new File("local-dir", file2).delete();
    try {
      PollableChannel localFileChannel = context.getBean("receiveChannel", PollableChannel.class);
      @SuppressWarnings("unchecked")
      SessionFactory<LsEntry> sessionFactory = context.getBean(CachingSessionFactory.class);
      template = new RemoteFileTemplate<LsEntry>(sessionFactory);
      SftpTestUtils.createTestFiles(template, file1, file2, file3);

      SourcePollingChannelAdapter adapter = context.getBean(SourcePollingChannelAdapter.class);
      adapter.start();

      Message<?> received = localFileChannel.receive();
      assertNotNull("Expected file", received);
      System.out.println("Received first file message: " + received);
      received = localFileChannel.receive();
      assertNotNull("Expected file", received);
      System.out.println("Received second file message: " + received);
      received = localFileChannel.receive(1000);
      assertNull("Expected null", received);
      System.out.println("No third file was received as expected");
    }
    finally {
      SftpTestUtils.cleanUp(template, file1, file2, file3);
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.