Package org.springframework.integration.channel

Examples of org.springframework.integration.channel.QueueChannel.receive()


    messageBus.bindConsumer("foo.0", moduleInputChannel, null);
    Message<?> message = MessageBuilder.withPayload("foo").setHeader(MessageHeaders.CONTENT_TYPE, "foo/bar").build();
    // Let the consumer actually bind to the producer before sending a msg
    busBindUnbindLatency();
    moduleOutputChannel.send(message);
    Message<?> inbound = moduleInputChannel.receive(5000);
    assertNotNull(inbound);
    assertEquals("foo", inbound.getPayload());
    assertNull(inbound.getHeaders().get(MessageBusSupport.ORIGINAL_CONTENT_TYPE_HEADER));
    assertEquals("foo/bar", inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE));
    messageBus.unbindProducers("foo.0");
View Full Code Here


    messageBus.bindConsumer("bar.0", moduleInputChannel, null);
    busBindUnbindLatency();

    Message<?> message = MessageBuilder.withPayload("foo").build();
    moduleOutputChannel.send(message);
    Message<?> inbound = moduleInputChannel.receive(5000);
    assertNotNull(inbound);
    assertEquals("foo", inbound.getPayload());
    assertNull(inbound.getHeaders().get(MessageBusSupport.ORIGINAL_CONTENT_TYPE_HEADER));
    assertNull(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE));
    messageBus.unbindProducers("bar.0");
View Full Code Here

      assertNotNull(inbound);
      assertEquals("foo", inbound.getPayload());
      assertNull(inbound.getHeaders().get(MessageBusSupport.ORIGINAL_CONTENT_TYPE_HEADER));
      assertEquals("foo/bar", inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE));
      Message<?> tapped1 = module2InputChannel.receive(5000);
      Message<?> tapped2 = module3InputChannel.receive(5000);
      if (tapped1 == null || tapped2 == null) {
        // listener may not have started
        assertFalse("Failed to receive tap after retry", retried);
        retried = true;
        continue;
View Full Code Here

    // other tap still receives messages
    Message<?> tapped = module2InputChannel.receive(5000);
    assertNotNull(tapped);

    // Removed tap does not
    assertNull(module3InputChannel.receive(1000));

    // when other tap stream is deleted
    messageBus.unbindConsumer("tap:baz.http", module2InputChannel);
    // Clean up as StreamPlugin would
    messageBus.unbindConsumer("baz.0", moduleInputChannel);
View Full Code Here

      assertNotNull(inbound);
      assertEquals("foo", inbound.getPayload());
      assertNull(inbound.getHeaders().get(MessageBusSupport.ORIGINAL_CONTENT_TYPE_HEADER));
      assertEquals("foo/bar", inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE));
      Message<?> tapped1 = module2InputChannel.receive(5000);
      Message<?> tapped2 = module3InputChannel.receive(5000);
      if (tapped1 == null || tapped2 == null) {
        // listener may not have started
        assertFalse("Failed to receive tap after retry", retried);
        retried = true;
        continue;
View Full Code Here

    // other tap still receives messages
    Message<?> tapped = module2InputChannel.receive(5000);
    assertNotNull(tapped);

    // Removed tap does not
    assertNull(module3InputChannel.receive(1000));

    // when other tap stream is deleted
    messageBus.unbindConsumer("tap:baz.http", module2InputChannel);
    // Clean up as StreamPlugin would
    messageBus.unbindConsumer("baz.0", moduleInputChannel);
View Full Code Here

    Message<?> receive0 = input0.receive(1000);
    assertNotNull(receive0);
    Message<?> receive1 = input1.receive(1000);
    assertNotNull(receive1);
    Message<?> receive2 = input2.receive(1000);
    assertNotNull(receive2);

    Matcher<Message<?>> fooMatcher = new CustomMatcher<Message<?>>("the message with 'foo' as its correlationId") {

      @Override
View Full Code Here

    Message<?> receive0 = input0.receive(1000);
    assertNotNull(receive0);
    Message<?> receive1 = input1.receive(1000);
    assertNotNull(receive1);
    Message<?> receive2 = input2.receive(1000);
    assertNotNull(receive2);

    if (usesExplicitRouting()) {
      assertEquals(0, receive0.getPayload());
      assertEquals(1, receive1.getPayload());
View Full Code Here

        post("/jobs/definitions").param("name", "joblaunch").param("definition", JOB_DEFINITION).accept(
            MediaType.APPLICATION_JSON)).andExpect(status().isCreated());
    mockMvc.perform(
        post("/jobs/executions").param("jobname", "joblaunch").accept(MediaType.APPLICATION_JSON)).andExpect(
        status().isCreated());
    assertNotNull(channel.receive(3000));
  }

  @Test
  public void testStopAllJobExecutions() throws Exception {
    mockMvc.perform(put("/jobs/executions?stop=true")).andExpect(status().isOk());
View Full Code Here

    when(module.getComponent("stepExecutionReplies.output", MessageChannel.class)).thenReturn(stepResultsOut);
    jobPartitionerPlugin.preProcessModule(module);
    jobPartitionerPlugin.postProcessModule(module);
    checkBusBound(messageBus);
    stepsOut.send(new GenericMessage<String>("foo"));
    Message<?> stepExecutionRequest = stepsIn.receive(10000);
    assertThat(stepExecutionRequest, hasPayload("foo"));
    stepResultsOut.send(MessageBuilder.withPayload("bar")
        .copyHeaders(stepExecutionRequest.getHeaders()) // replyTo
        .build());
    assertThat(stepResultsIn.receive(10000), hasPayload("bar"));
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.