Search in sources :

Example 51 with Message

use of org.springframework.messaging.Message in project spring-framework by spring-projects.

the class MessagingMessageListenerAdapterTests method getPayloadInstance.

protected MessagingMessageListenerAdapter getPayloadInstance(final Object payload, String methodName, Class... parameterTypes) {
    Method method = ReflectionUtils.findMethod(SampleBean.class, methodName, parameterTypes);
    MessagingMessageListenerAdapter adapter = new MessagingMessageListenerAdapter() {

        @Override
        protected Object extractMessage(javax.jms.Message message) {
            return payload;
        }
    };
    adapter.setHandlerMethod(factory.createInvocableHandlerMethod(sample, method));
    return adapter;
}
Also used : StubTextMessage(org.springframework.jms.StubTextMessage) Message(org.springframework.messaging.Message) TextMessage(javax.jms.TextMessage) Method(java.lang.reflect.Method)

Aggregations

Message (org.springframework.messaging.Message)51 Test (org.junit.Test)41 SimpMessageHeaderAccessor (org.springframework.messaging.simp.SimpMessageHeaderAccessor)16 MessageHeaders (org.springframework.messaging.MessageHeaders)14 StompHeaderAccessor (org.springframework.messaging.simp.stomp.StompHeaderAccessor)9 BinaryMessage (org.springframework.web.socket.BinaryMessage)9 TextMessage (org.springframework.web.socket.TextMessage)9 WebSocketMessage (org.springframework.web.socket.WebSocketMessage)6 ByteBuffer (java.nio.ByteBuffer)5 MessageChannel (org.springframework.messaging.MessageChannel)4 MessageHeaderAccessor (org.springframework.messaging.support.MessageHeaderAccessor)4 Method (java.lang.reflect.Method)3 MethodParameter (org.springframework.core.MethodParameter)3 TestPrincipal (org.springframework.messaging.simp.TestPrincipal)3 Principal (java.security.Principal)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 TextMessage (javax.jms.TextMessage)2 SynthesizingMethodParameter (org.springframework.core.annotation.SynthesizingMethodParameter)2 StubTextMessage (org.springframework.jms.StubTextMessage)2 MessagingException (org.springframework.messaging.MessagingException)2