Package org.springframework.messaging.handler.invocation

Examples of org.springframework.messaging.handler.invocation.InvocableHandlerMethod


  @Override
  protected MessagingMessageListenerAdapter createMessageListener(MessageListenerContainer container) {
    Assert.state(this.messageHandlerMethodFactory != null,
        "Could not create message listener - MessageHandlerMethodFactory not set");
    MessagingMessageListenerAdapter messageListener = createMessageListenerInstance();
    InvocableHandlerMethod invocableHandlerMethod =
        this.messageHandlerMethodFactory.createInvocableHandlerMethod(getBean(), getMethod());
    messageListener.setHandlerMethod(invocableHandlerMethod);
    String responseDestination = getDefaultResponseDestination();
    if (StringUtils.hasText(responseDestination)) {
      if (container.isPubSubDomain()) {
View Full Code Here


  }


  @Override
  public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) {
    InvocableHandlerMethod handlerMethod = new InvocableHandlerMethod(bean, method);
    handlerMethod.setMessageMethodArgumentResolvers(argumentResolvers);
    return handlerMethod;
  }
View Full Code Here

      }
    });
    instance.setConversionService(conversionService);
    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    invocableHandlerMethod.invoke(MessageBuilder.withPayload(sample).build());
    assertMethodInvocation(sample, "simpleString");
  }
View Full Code Here

    assertFalse("conversion service should fail to convert payload",
        conversionService.canConvert(Integer.class, String.class));
    instance.setConversionService(conversionService);
    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    thrown.expect(MessageConversionException.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload(123).build());
  }
View Full Code Here

    DefaultMessageHandlerMethodFactory instance = createInstance();
    MessageConverter messageConverter = new ByteArrayMessageConverter();
    instance.setMessageConverter(messageConverter);
    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    thrown.expect(MessageConversionException.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload(123).build());
  }
View Full Code Here

    List<HandlerMethodArgumentResolver> customResolvers = new ArrayList<HandlerMethodArgumentResolver>();
    customResolvers.add(new CustomHandlerMethodArgumentResolver());
    instance.setCustomArgumentResolvers(customResolvers);
    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "customArgumentResolver", Locale.class);

    invocableHandlerMethod.invoke(MessageBuilder.withPayload(123).build());
    assertMethodInvocation(sample, "customArgumentResolver");
  }
View Full Code Here

    instance.afterPropertiesSet();

    Message<String> message = MessageBuilder.withPayload("sample").build();

    // This will work as the local resolver is set
    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "customArgumentResolver", Locale.class);
    invocableHandlerMethod.invoke(message);
    assertMethodInvocation(sample, "customArgumentResolver");

    // This won't work as no resolver is known for the payload
    InvocableHandlerMethod invocableHandlerMethod2 =
        createInvocableHandlerMethod(instance, "simpleString", String.class);

    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("No suitable resolver for");
    invocableHandlerMethod2.invoke(message);
  }
View Full Code Here

  @Test
  public void noValidationByDefault() throws Exception {
    DefaultMessageHandlerMethodFactory instance = createInstance();
    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "payloadValidation", String.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload("failure").build());
    assertMethodInvocation(sample, "payloadValidation");
  }
View Full Code Here

        }
      }
    });
    instance.afterPropertiesSet();

    InvocableHandlerMethod invocableHandlerMethod =
        createInvocableHandlerMethod(instance, "payloadValidation", String.class);
    thrown.expect(MethodArgumentNotValidException.class);
    invocableHandlerMethod.invoke(MessageBuilder.withPayload("failure").build());
  }
View Full Code Here

  @Override
  protected MessagingMessageListenerAdapter createMessageListener(MessageListenerContainer container) {
    Assert.state(this.messageHandlerMethodFactory != null,
        "Could not create message listener - MessageHandlerMethodFactory not set");
    MessagingMessageListenerAdapter messageListener = createMessageListenerInstance();
    InvocableHandlerMethod invocableHandlerMethod =
        this.messageHandlerMethodFactory.createInvocableHandlerMethod(getBean(), getMethod());
    messageListener.setHandlerMethod(invocableHandlerMethod);
    Address replyToAddress = getDefaultReplyToAddress();
    if (replyToAddress != null) {
      messageListener.setResponseExchange(replyToAddress.getExchangeName());
View Full Code Here

TOP

Related Classes of org.springframework.messaging.handler.invocation.InvocableHandlerMethod

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.