• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MessageType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.jms.support.converter.MessageType的典型用法代码示例。如果您正苦于以下问题:Java MessageType类的具体用法?Java MessageType怎么用?Java MessageType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MessageType类属于org.springframework.jms.support.converter包,在下文中一共展示了MessageType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testReplyWithJackson

import org.springframework.jms.support.converter.MessageType; //导入依赖的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;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:MessagingMessageListenerAdapterTests.java


示例2: jacksonJmsMessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的package包/类
@Bean
public MessageConverter jacksonJmsMessageConverter() {
    MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
    converter.setTargetType(MessageType.TEXT);
    converter.setTypeIdPropertyName("_type");
    return converter;
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:8,代码来源:JmsConfig.java


示例3: MessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的package包/类
public MessageConverter() {
	super();
	// TODO set properties on mapper as in converter?
	this.setTargetType(MessageType.TEXT);
	this.setTypeIdPropertyName("_type");
	this.setObjectMapper((new Factory()).newObjectMapper());
}
 
开发者ID:maenu,项目名称:kowalski,代码行数:8,代码来源:MessageConverter.java


示例4: jacksonJmsMessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的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;
}
 
开发者ID:ftsakiris,项目名称:async-engine,代码行数:8,代码来源:Application.java


示例5: jmsMessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的package包/类
@Bean(name = "jackson2JmsMessageConverter")
@Order
@ConditionalOnMissingBean(JmsMessageConverter.class)
public JmsMessageConverter jmsMessageConverter() {
    Jackson2JmsMessageConverter messageConverter = new Jackson2JmsMessageConverter();
    messageConverter.setTargetType(MessageType.TEXT);
    messageConverter.setEncoding(encoding);
    return messageConverter;
}
 
开发者ID:kinglcc,项目名称:spring-boot-jms,代码行数:10,代码来源:JmsMessageAtuoConfiguration.java


示例6: jacksonJmsMessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的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;
}
 
开发者ID:wallerlab,项目名称:reaktor,代码行数:8,代码来源:Config.java


示例7: jacksonJmsMessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的package包/类
@Bean 
public MessageConverter jacksonJmsMessageConverter(ObjectMapper aObjectMapper) {
  MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter();
  converter.setObjectMapper(aObjectMapper);
  converter.setTargetType(MessageType.TEXT);
  converter.setTypeIdPropertyName("_type");
  return converter;
}
 
开发者ID:creactiviti,项目名称:piper,代码行数:9,代码来源:JmsMessengerConfiguration.java


示例8: jacksonJmsMessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的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;
}
 
开发者ID:rajadilipkolli,项目名称:POC,代码行数:13,代码来源:JMSApplicationConfig.java


示例9: jacksonJmsMessageConverter

import org.springframework.jms.support.converter.MessageType; //导入依赖的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;
}
 
开发者ID:jangalinski,项目名称:springbootcamp,代码行数:13,代码来源:ActiveMqApplication.java


示例10: mapToMessage

import org.springframework.jms.support.converter.MessageType; //导入依赖的package包/类
/**
 * Template method that allows for custom message mapping.
 * Invoked when {@link #setTargetType} is not {@link MessageType#TEXT} or
 * {@link MessageType#BYTES}.
 * <p>The default implementation throws an {@link IllegalArgumentException}.
 * @param object the object to marshal
 * @param session the JMS Session
 * @param objectMapper the mapper to use
 * @param targetType the target message type (other than TEXT or BYTES)
 * @return the resulting message
 * @throws JMSException if thrown by JMS methods
 * @throws IOException in case of I/O errors
 */
protected Message mapToMessage(Object object, Session session, ObjectMapper objectMapper, MessageType targetType)
        throws JMSException, IOException {

    throw new IllegalArgumentException("Unsupported message type [" + targetType
            + "]. MappingJackson2MessageConverter by default only supports TextMessages and BytesMessages.");
}
 
开发者ID:kinglcc,项目名称:spring-boot-jms,代码行数:20,代码来源:Jackson2JmsMessageConverter.java


示例11: setTargetType

import org.springframework.jms.support.converter.MessageType; //导入依赖的package包/类
/**
 * Specify whether {@link #toMessage(Object, Session)} should marshal to a
 * {@link BytesMessage} or a {@link TextMessage}.
 * <p>The default is {@link MessageType#BYTES}, i.e. this converter marshals to
 * a {@link BytesMessage}. Note that the default version of this converter
 * supports {@link MessageType#BYTES} and {@link MessageType#TEXT} only.
 * @see MessageType#BYTES
 * @see MessageType#TEXT
 */
public void setTargetType(MessageType targetType) {
    Assert.notNull(targetType, "MessageType must not be null");
    this.targetType = targetType;
}
 
开发者ID:kinglcc,项目名称:spring-boot-jms,代码行数:14,代码来源:Jackson2JmsMessageConverter.java



注:本文中的org.springframework.jms.support.converter.MessageType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RpcErrorCodeProto类代码示例发布时间:2022-05-22
下一篇:
Java CalciteSchema类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap