本文整理汇总了Java中org.springframework.jms.support.converter.MappingJackson2MessageConverter类的典型用法代码示例。如果您正苦于以下问题:Java MappingJackson2MessageConverter类的具体用法?Java MappingJackson2MessageConverter怎么用?Java MappingJackson2MessageConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MappingJackson2MessageConverter类属于org.springframework.jms.support.converter包,在下文中一共展示了MappingJackson2MessageConverter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setMapping
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入依赖的package包/类
/**
* Define any mapping
*
* @param endpointId if of the endpoint
* @param listener listener
*/
private void setMapping(final String endpointId, AbstractAdaptableMessageListener listener) {
String mapping = getEndpointProperty(endpointId, CONFIGURATION_KEY_JMS_ENDPOINT_MAPPING);
if (MAPPING_JSON.equalsIgnoreCase(mapping)) {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTypeIdPropertyName(JMS_PROPERTY_DTO_CLASSNAME);
listener.setMessageConverter(converter);
} else if (mapping != null && !MAPPING_NONE.equalsIgnoreCase(mapping)) {
StringBuilder errorMessage = new StringBuilder();
errorMessage.append("Mapping type ('").append(mapping);
errorMessage.append("') unknown for endpoint ").append(endpointId).append(" : only 'none' or 'json' are allowed.");
if (ignoreErroneousEndpoint) {
errorMessage.append(" None mapping will be used.");
logger.warn(errorMessage.toString());
}
else {
throw new IllegalArgumentException(errorMessage.toString());
}
}
}
示例3: 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;
}
示例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 // Serialize message content to json using TextMessage
public MessageConverter jacksonJmsMessageConverter() {
MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
converter.setTargetType(MessageType.TEXT);
converter.setTypeIdPropertyName("_type");
return converter;
}
示例6: 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;
}
示例7: outMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter outMessageConverter() {
MappingJackson2MessageConverter messageConverter = new MappingJackson2MessageConverter();
messageConverter.setTypeIdPropertyName("typeId");
return messageConverter;
}
示例8: fileServerMessageConverter
import org.springframework.jms.support.converter.MappingJackson2MessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter fileServerMessageConverter() {
MappingJackson2MessageConverter messageConverter = new MappingJackson2MessageConverter();
messageConverter.setTypeIdPropertyName("typeId");
return messageConverter;
}
示例9: 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;
}
示例10: 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;
}