本文整理汇总了Java中org.springframework.jms.support.converter.MappingJackson2MessageConverter.setTargetType方法的典型用法代码示例。如果您正苦于以下问题:Java MappingJackson2MessageConverter.setTargetType方法的具体用法?Java MappingJackson2MessageConverter.setTargetType怎么用?Java MappingJackson2MessageConverter.setTargetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jms.support.converter.MappingJackson2MessageConverter
的用法示例。
在下文中一共展示了MappingJackson2MessageConverter.setTargetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReplyWithJackson
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入方法依赖的package包/类
private TextMessage testReplyWithJackson(String methodName, String replyContent) throws JMSException {
Queue replyDestination = mock(Queue.class);
Message<String> request = MessageBuilder.withPayload("Response").build();
Session session = mock(Session.class);
MessageProducer messageProducer = mock(MessageProducer.class);
TextMessage responseMessage = mock(TextMessage.class);
given(session.createTextMessage(replyContent)).willReturn(responseMessage);
given(session.createProducer(replyDestination)).willReturn(messageProducer);
MessagingMessageListenerAdapter listener = getPayloadInstance(request, methodName, Message.class);
MappingJackson2MessageConverter messageConverter = new MappingJackson2MessageConverter();
messageConverter.setTargetType(MessageType.TEXT);
listener.setMessageConverter(messageConverter);
listener.setDefaultResponseDestination(replyDestination);
listener.onMessage(mock(javax.jms.Message.class), session);
verify(session, times(0)).createQueue(anyString());
verify(session).createTextMessage(replyContent);
verify(messageProducer).send(responseMessage);
verify(messageProducer).close();
return responseMessage;
}
示例2: jacksonJmsMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入方法依赖的package包/类
@Bean
public MessageConverter jacksonJmsMessageConverter() {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}
示例3: jacksonJmsMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入方法依赖的package包/类
@Bean // Serialize message content to json using TextMessage
public MessageConverter jacksonJmsMessageConverter() {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}
示例4: jacksonJmsMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入方法依赖的package包/类
@Bean // Serialize message content to json using TextMessage
public MessageConverter jacksonJmsMessageConverter() {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}
示例5: jacksonJmsMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入方法依赖的package包/类
@Bean
public MessageConverter jacksonJmsMessageConverter(ObjectMapper aObjectMapper) {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setObjectMapper(aObjectMapper);
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}
示例6: jacksonJmsMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入方法依赖的package包/类
/**
* <p>jacksonJmsMessageConverter.</p>
*
* @return a {@link org.springframework.jms.support.converter.MessageConverter} object.
*/
@Bean
public MessageConverter jacksonJmsMessageConverter() {
final MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}
示例7: jacksonJmsMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入方法依赖的package包/类
/**
* Serialize message content to json using TextMessage
* @return messageConverter
*/
@Bean
public MessageConverter jacksonJmsMessageConverter() {
final MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}