Examples of MessagingMessageListenerAdapter


Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    assertDefaultListenerMethodInvocation();
  }

  @Test
  public void resolveConvertedPayload() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(Integer.class);

    Channel channel = mock(Channel.class);

    listener.onMessage(createTextMessage("33"), channel);
    assertDefaultListenerMethodInvocation();
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    assertDefaultListenerMethodInvocation();
  }

  @Test
  public void processAndReply() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
    String body = "echo text";
    String correlationId = "link-1234";
    String responseExchange = "fooQueue";
    String responseRoutingKey = "abc-1234";

    listener.setResponseExchange(responseExchange);
    listener.setResponseRoutingKey(responseRoutingKey);
    MessageProperties properties = new MessageProperties();
    properties.setCorrelationId(correlationId.getBytes(SimpleMessageConverter.DEFAULT_CHARSET));
    org.springframework.amqp.core.Message message = createTextMessage(body, properties);

    processAndReply(listener, message, responseExchange, responseRoutingKey, false, correlationId);
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    assertDefaultListenerMethodInvocation();
  }

  @Test
  public void processAndReplyWithMessage() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(org.springframework.amqp.core.Message.class);
    listener.setMessageConverter(null);
    listener.setResponseExchange("fooQueue");
    String body = "echo text";

    org.springframework.amqp.core.Message message = createTextMessage(body, new MessageProperties());

View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    assertDefaultListenerMethodInvocation();
  }

  @Test
  public void processAndReplyWithMessageAndStringReply() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(org.springframework.amqp.core.Message.class);
    listener.setMessageConverter(null);
    listener.setResponseExchange("fooQueue");
    String body = "echo text";

    org.springframework.amqp.core.Message message = createTextMessage(body, new MessageProperties());

    try {
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    assertDefaultListenerMethodInvocation();
  }

  @Test
  public void processAndReplyUsingReplyTo() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
    listener.setMandatoryPublish(true);
    String body = "echo text";
    Address replyTo = new Address("replyToQueue", "myRouting");

    MessageProperties properties = new MessageProperties();
    properties.setReplyToAddress(replyTo);
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    assertDefaultListenerMethodInvocation();
  }

  @Test
  public void processAndReplyWithSendTo() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);
    String body = "echo text";
    String messageId = "msgId-1234";

    MessageProperties properties = new MessageProperties();
    properties.setMessageId(messageId);
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    assertEquals("Wrong correlationId in reply", expectedCorrelationId, argument.getValue().getCorrelationId());
  }

  @Test
  public void emptySendTo() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class);

    processAndReply(listener, createTextMessage("content"), "", "", false, null);
    assertDefaultListenerMethodInvocation();
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

    DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory();
    customFactory.setValidator(testValidator("invalid value"));
    initializeFactory(customFactory);

    Method method = getListenerMethod(methodName, String.class);
    MessagingMessageListenerAdapter listener = createInstance(customFactory, method);
    Channel channel = mock(Channel.class);
    listener.onMessage(createTextMessage("test"), channel); // test is a valid value
    assertListenerMethodInvocation(sample, methodName);
  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

  public void validatePayloadInvalid() throws Exception {
    DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory();
    customFactory.setValidator(testValidator("invalid value"));

    Method method = getListenerMethod("validatePayload", String.class);
    MessagingMessageListenerAdapter listener = createInstance(customFactory, method);
    Channel channel = mock(Channel.class);

    thrown.expect(ListenerExecutionFailedException.class);
    listener.onMessage(createTextMessage("invalid value"), channel); // test is an invalid value

  }
View Full Code Here

Examples of org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter

  // failure scenario

  @Test
  public void invalidPayloadType() throws Exception {
    MessagingMessageListenerAdapter listener = createDefaultInstance(Integer.class);
    Channel channel = mock(Channel.class);

    thrown.expect(ListenerExecutionFailedException.class);
    thrown.expectCause(Matchers.isA(MessageConversionException.class));
    thrown.expectMessage(getDefaultListenerMethod(Integer.class).toGenericString()); // ref to method
    listener.onMessage(createTextMessage("test"), channel); // test is not a valid integer
  }
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.