org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory Java Examples
The following examples show how to use
org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MethodJmsListenerEndpointTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void validatePayloadInvalid() throws JMSException { DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory(); customFactory.setValidator(testValidator("invalid value")); Method method = getListenerMethod("validatePayload", String.class); MessagingMessageListenerAdapter listener = createInstance(customFactory, method); Session session = mock(Session.class); thrown.expect(ListenerExecutionFailedException.class); listener.onMessage(createSimpleJmsTextMessage("invalid value"), session); // test is an invalid value }
Example #2
Source File: RabbitConfiguration.java From heimdall with Apache License 2.0 | 5 votes |
@Bean public DefaultMessageHandlerMethodFactory messageHandlerMethodFactory() { DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory(); factory.setMessageConverter(consumerJackson2MessageConverter()); return factory; }
Example #3
Source File: RabbitConfiguration.java From heimdall with Apache License 2.0 | 5 votes |
@Bean public DefaultMessageHandlerMethodFactory messageHandlerMethodFactory() { DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory(); factory.setMessageConverter(consumerJackson2MessageConverter()); return factory; }
Example #4
Source File: JmsListenerContainerFactoryIntegrationTests.java From java-technology-stack with MIT License | 5 votes |
private MethodJmsListenerEndpoint createMethodJmsEndpoint(DefaultMessageHandlerMethodFactory factory, Method method) { MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint(); endpoint.setBean(listener); endpoint.setMethod(method); endpoint.setMessageHandlerMethodFactory(factory); return endpoint; }
Example #5
Source File: JmsListenerAnnotationBeanPostProcessor.java From spring-analysis-note with MIT License | 5 votes |
private MessageHandlerMethodFactory createDefaultJmsHandlerMethodFactory() { DefaultMessageHandlerMethodFactory defaultFactory = new DefaultMessageHandlerMethodFactory(); if (beanFactory != null) { defaultFactory.setBeanFactory(beanFactory); } defaultFactory.afterPropertiesSet(); return defaultFactory; }
Example #6
Source File: MethodJmsListenerEndpointTests.java From java-technology-stack with MIT License | 5 votes |
private MessagingMessageListenerAdapter createInstance( DefaultMessageHandlerMethodFactory factory, Method method, MessageListenerContainer container) { MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint(); endpoint.setBean(this.sample); endpoint.setMethod(method); endpoint.setMessageHandlerMethodFactory(factory); return endpoint.createMessageListener(container); }
Example #7
Source File: MethodJmsListenerEndpointTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void validatePayloadInvalid() throws JMSException { DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory(); customFactory.setValidator(testValidator("invalid value")); Method method = getListenerMethod("validatePayload", String.class); MessagingMessageListenerAdapter listener = createInstance(customFactory, method); Session session = mock(Session.class); this.thrown.expect(ListenerExecutionFailedException.class); listener.onMessage(createSimpleJmsTextMessage("invalid value"), session); // test is an invalid value }
Example #8
Source File: MethodJmsListenerEndpointTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void validatePayloadValid() throws JMSException { String methodName = "validatePayload"; DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory(); customFactory.setValidator(testValidator("invalid value")); initializeFactory(customFactory); Method method = getListenerMethod(methodName, String.class); MessagingMessageListenerAdapter listener = createInstance(customFactory, method); Session session = mock(Session.class); listener.onMessage(createSimpleJmsTextMessage("test"), session); // test is a valid value assertListenerMethodInvocation(this.sample, methodName); }
Example #9
Source File: MethodJmsListenerEndpointTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void validatePayloadValid() throws JMSException { String methodName = "validatePayload"; DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory(); customFactory.setValidator(testValidator("invalid value")); initializeFactory(customFactory); Method method = getListenerMethod(methodName, String.class); MessagingMessageListenerAdapter listener = createInstance(customFactory, method); Session session = mock(Session.class); listener.onMessage(createSimpleJmsTextMessage("test"), session); // test is a valid value assertListenerMethodInvocation(sample, methodName); }
Example #10
Source File: JmsListenerAnnotationBeanPostProcessor.java From java-technology-stack with MIT License | 5 votes |
private MessageHandlerMethodFactory createDefaultJmsHandlerMethodFactory() { DefaultMessageHandlerMethodFactory defaultFactory = new DefaultMessageHandlerMethodFactory(); if (beanFactory != null) { defaultFactory.setBeanFactory(beanFactory); } defaultFactory.afterPropertiesSet(); return defaultFactory; }
Example #11
Source File: MethodJmsListenerEndpointTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
private MessagingMessageListenerAdapter createInstance( DefaultMessageHandlerMethodFactory factory, Method method, MessageListenerContainer container) { MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint(); endpoint.setBean(sample); endpoint.setMethod(method); endpoint.setMessageHandlerMethodFactory(factory); return endpoint.createMessageListener(container); }
Example #12
Source File: JmsListenerContainerFactoryIntegrationTests.java From spring-analysis-note with MIT License | 5 votes |
private MethodJmsListenerEndpoint createMethodJmsEndpoint(DefaultMessageHandlerMethodFactory factory, Method method) { MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint(); endpoint.setBean(listener); endpoint.setMethod(method); endpoint.setMessageHandlerMethodFactory(factory); return endpoint; }
Example #13
Source File: MethodJmsListenerEndpointTests.java From spring-analysis-note with MIT License | 5 votes |
private MessagingMessageListenerAdapter createInstance( DefaultMessageHandlerMethodFactory factory, Method method, MessageListenerContainer container) { MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint(); endpoint.setBean(this.sample); endpoint.setMethod(method); endpoint.setMessageHandlerMethodFactory(factory); return endpoint.createMessageListener(container); }
Example #14
Source File: MethodJmsListenerEndpointTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void validatePayloadInvalid() throws JMSException { DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory(); customFactory.setValidator(testValidator("invalid value")); Method method = getListenerMethod("validatePayload", String.class); MessagingMessageListenerAdapter listener = createInstance(customFactory, method); Session session = mock(Session.class); // test is an invalid value assertThatExceptionOfType(ListenerExecutionFailedException.class).isThrownBy(() -> listener.onMessage(createSimpleJmsTextMessage("invalid value"), session)); }
Example #15
Source File: MethodJmsListenerEndpointTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void validatePayloadValid() throws JMSException { String methodName = "validatePayload"; DefaultMessageHandlerMethodFactory customFactory = new DefaultMessageHandlerMethodFactory(); customFactory.setValidator(testValidator("invalid value")); initializeFactory(customFactory); Method method = getListenerMethod(methodName, String.class); MessagingMessageListenerAdapter listener = createInstance(customFactory, method); Session session = mock(Session.class); listener.onMessage(createSimpleJmsTextMessage("test"), session); // test is a valid value assertListenerMethodInvocation(this.sample, methodName); }
Example #16
Source File: JmsListenerContainerFactoryIntegrationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
private MethodJmsListenerEndpoint createMethodJmsEndpoint(DefaultMessageHandlerMethodFactory factory, Method method) { MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint(); endpoint.setBean(listener); endpoint.setMethod(method); endpoint.setMessageHandlerMethodFactory(factory); return endpoint; }
Example #17
Source File: MethodJmsListenerEndpointTests.java From java-technology-stack with MIT License | 4 votes |
private MessagingMessageListenerAdapter createInstance(DefaultMessageHandlerMethodFactory factory, Method method) { return createInstance(factory, method, new SimpleMessageListenerContainer()); }
Example #18
Source File: MethodJmsListenerEndpointTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
private MessagingMessageListenerAdapter createInstance(DefaultMessageHandlerMethodFactory factory, Method method) { return createInstance(factory, method, new SimpleMessageListenerContainer()); }
Example #19
Source File: MethodJmsListenerEndpointTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #20
Source File: MessagingMessageListenerAdapterTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #21
Source File: EnableJmsTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Bean public MessageHandlerMethodFactory customMessageHandlerMethodFactory() { DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory(); factory.setValidator(new TestValidator()); return factory; }
Example #22
Source File: JmsListenerContainerFactoryIntegrationTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #23
Source File: JmsListenerAnnotationBeanPostProcessor.java From spring4-understanding with Apache License 2.0 | 4 votes |
private MessageHandlerMethodFactory createDefaultJmsHandlerMethodFactory() { DefaultMessageHandlerMethodFactory defaultFactory = new DefaultMessageHandlerMethodFactory(); defaultFactory.setBeanFactory(beanFactory); defaultFactory.afterPropertiesSet(); return defaultFactory; }
Example #24
Source File: JmsListenerContainerFactoryIntegrationTests.java From java-technology-stack with MIT License | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #25
Source File: MethodJmsListenerEndpointTests.java From java-technology-stack with MIT License | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #26
Source File: MessagingMessageListenerAdapterTests.java From java-technology-stack with MIT License | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #27
Source File: EnableJmsTests.java From java-technology-stack with MIT License | 4 votes |
@Bean public MessageHandlerMethodFactory customMessageHandlerMethodFactory() { DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory(); factory.setValidator(new TestValidator()); return factory; }
Example #28
Source File: JmsListenerContainerFactoryIntegrationTests.java From spring-analysis-note with MIT License | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #29
Source File: MethodJmsListenerEndpointTests.java From spring-analysis-note with MIT License | 4 votes |
private void initializeFactory(DefaultMessageHandlerMethodFactory factory) { factory.setBeanFactory(new StaticListableBeanFactory()); factory.afterPropertiesSet(); }
Example #30
Source File: MethodJmsListenerEndpointTests.java From spring-analysis-note with MIT License | 4 votes |
private MessagingMessageListenerAdapter createInstance(DefaultMessageHandlerMethodFactory factory, Method method) { return createInstance(factory, method, new SimpleMessageListenerContainer()); }