Package org.springframework.integration.core

Examples of org.springframework.integration.core.MessagingTemplate


  /** Default message consumer if no custom configuration */
  private EventDrivenConsumer consumer;

  public IntegrationAppmasterService() {
    messagingTemplate = new MessagingTemplate();
  }
View Full Code Here


  @Test
  @DirtiesContext
  public void testRegisterFromSimpleRequestString() throws Exception {

    MessagingTemplate gateway = new MessagingTemplate();
    gateway.setReceiveTimeout(500L);
    gateway.afterPropertiesSet();

    JobConfigurationRequest request = new JobConfigurationRequest();
    request.setXml(IOUtils.toString(new ClassPathResource("/staging-context.xml").getInputStream()));
    gateway.convertAndSend(requests, request);
    assertNotNull("Time out waiting for reply", result);
     assertEquals("[staging]", result.toString());
    
  }
View Full Code Here

   *
   * @param channel the channel
   */
  public void setChannel(MessageChannel channel) {
    this.channel = channel;
    this.messagingTemplate = new MessagingTemplate(this.channel);
  }
View Full Code Here

    Message<String> message = MessageBuilder.withPayload("Yuhuu !!! i am connected using Spring Integration namespace")
        .setHeader(SmppConstants.SRC_ADDR, "pavel")
        .setHeader(SmppConstants.DST_ADDR, "pavel")
        .build();

    MessagingTemplate template = context.getBean("messagingTemplate", MessagingTemplate.class);
    template.send("target", message);
  }
View Full Code Here

    final JobLaunchingMessageHandler jobLaunchingMessageHandler = TestUtils.getPropertyValue(this.consumer, "handler.jobLaunchingMessageHandler", JobLaunchingMessageHandler.class);

    assertNotNull(jobLaunchingMessageHandler);

    final MessagingTemplate messagingTemplate = TestUtils.getPropertyValue(this.consumer, "handler.messagingTemplate", MessagingTemplate.class);
    final Long sendTimeout = TestUtils.getPropertyValue(messagingTemplate, "sendTimeout", Long.class);

    assertEquals("Wrong sendTimeout", Long.valueOf(123L),  sendTimeout);
    assertFalse(this.consumer.isRunning());
  }
View Full Code Here

  @Test
  public void testJobLaunchingGatewayIsRunning() throws Exception {
    setUp("JobLaunchingGatewayParserTestsRunning-context.xml", getClass());
    assertTrue(this.consumer.isRunning());

    final MessagingTemplate messagingTemplate = TestUtils.getPropertyValue(this.consumer, "handler.messagingTemplate", MessagingTemplate.class);
    final Long sendTimeout = TestUtils.getPropertyValue(messagingTemplate, "sendTimeout", Long.class);

    assertEquals("Wrong sendTimeout", Long.valueOf(-1L),  sendTimeout);
  }
View Full Code Here

    factory.setTransactionManager(new ResourcelessTransactionManager());
    factory.setBeanName("step");
    factory.setItemWriter(writer);
    factory.setCommitInterval(4);

    MessagingTemplate gateway = new MessagingTemplate();
    writer.setMessagingOperations(gateway);

    gateway.setDefaultChannel(requests);
    writer.setReplyChannel(replies);
    gateway.setReceiveTimeout(100);

    TestItemWriter.count = 0;

    // Drain queues
    Message<?> message = replies.receive(10);
View Full Code Here

    //execute with no default set
    messageChannelPartitionHandler = new MessageChannelPartitionHandler();
    //mock
    StepExecution masterStepExecution = mock(StepExecution.class);
    StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
    MessagingTemplate operations = mock(MessagingTemplate.class);
    Message message = mock(Message.class);
    //when
    HashSet<StepExecution> stepExecutions = new HashSet<StepExecution>();
    stepExecutions.add(new StepExecution("step1", new JobExecution(5l)));
    when(stepExecutionSplitter.split((StepExecution) anyObject(), eq(1))).thenReturn(stepExecutions);
    when(message.getPayload()).thenReturn(Collections.emptyList());
    when(operations.receive((PollableChannel) anyObject())).thenReturn(message);
    //set
    messageChannelPartitionHandler.setMessagingOperations(operations);

    //execute
    Collection<StepExecution> executions = messageChannelPartitionHandler.handle(stepExecutionSplitter, masterStepExecution);
View Full Code Here

    //execute with no default set
    messageChannelPartitionHandler = new MessageChannelPartitionHandler();
    //mock
    StepExecution masterStepExecution = mock(StepExecution.class);
    StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
    MessagingTemplate operations = mock(MessagingTemplate.class);
    Message message = mock(Message.class);
    PollableChannel replyChannel = mock(PollableChannel.class);
    //when
    HashSet<StepExecution> stepExecutions = new HashSet<StepExecution>();
    stepExecutions.add(new StepExecution("step1", new JobExecution(5l)));
    when(stepExecutionSplitter.split((StepExecution) anyObject(), eq(1))).thenReturn(stepExecutions);
    when(message.getPayload()).thenReturn(Collections.emptyList());
    when(operations.receive(replyChannel)).thenReturn(message);
    //set
    messageChannelPartitionHandler.setMessagingOperations(operations);
    messageChannelPartitionHandler.setReplyChannel(replyChannel);

    //execute
View Full Code Here

    //execute with no default set
    messageChannelPartitionHandler = new MessageChannelPartitionHandler();
    //mock
    StepExecution masterStepExecution = mock(StepExecution.class);
    StepExecutionSplitter stepExecutionSplitter = mock(StepExecutionSplitter.class);
    MessagingTemplate operations = mock(MessagingTemplate.class);
    Message message = mock(Message.class);
    //when
    HashSet<StepExecution> stepExecutions = new HashSet<StepExecution>();
    stepExecutions.add(new StepExecution("step1", new JobExecution(5l)));
    when(stepExecutionSplitter.split((StepExecution) anyObject(), eq(1))).thenReturn(stepExecutions);
View Full Code Here

TOP

Related Classes of org.springframework.integration.core.MessagingTemplate

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.