本文整理汇总了Java中org.springframework.amqp.support.converter.MessageConverter类的典型用法代码示例。如果您正苦于以下问题:Java MessageConverter类的具体用法?Java MessageConverter怎么用?Java MessageConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageConverter类属于org.springframework.amqp.support.converter包,在下文中一共展示了MessageConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MessageListenerAdapter
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Test
public void 回復可能例外の場合はデフォルトの指定回数リトライが実行されて回復可能例外キューに配信される() throws Exception {
container.setQueues(ctx.getBean("retryTestQueue", Queue.class));
container.setMessageListener(new MessageListenerAdapter(new ApplicationRecoverableExceptionTestHandler(), ctx.getBean(MessageConverter.class)));
recoverableContainer.setQueues(ctx.getBean("recoverableExceptionQueue", Queue.class));
recoverableContainer.setMessageListener(new MessageListenerAdapter(new RecoverableTestHandler(), ctx.getBean(MessageConverter.class)));
container.start();
recoverableContainer.start();
template.convertAndSend("retry.test.exchange", "retry.test.binding", new RetryTestBean("test"));
assertThat(retry.await(30, TimeUnit.SECONDS), is(true));
assertThat(retry.getCount(), is(0L));
assertThat(recover.await(3, TimeUnit.SECONDS), is(true));
assertThat(recover.getCount(), is(0L));
container.stop();
recoverableContainer.stop();
}
示例2: RabbitTemplateMock
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
public RabbitTemplateMock(
AmqpTemplateMockManager mockManager,
MessageConverter messageConverter,
String defaultExchange) {
this.mockManager = mockManager;
this.messageConverter = messageConverter;
this.setConnectionFactory(Mockito.mock(ConnectionFactory.class));
this.setExchange(defaultExchange);
}
示例3: commandBusRabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
@Autowired
public RabbitTemplate commandBusRabbitTemplate(final ConnectionFactory commandBusConnectionFactory, final MessageConverter commandBusMessageConverter) {
log.info("Creating command bus RabbitMQ template with a custom JSON converter");
final RabbitTemplate rabbitTemplate = new RabbitTemplate(commandBusConnectionFactory);
rabbitTemplate.setMessageConverter(commandBusMessageConverter);
return rabbitTemplate;
}
示例4: eventBusRabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
@Autowired
public RabbitTemplate eventBusRabbitTemplate(final ConnectionFactory eventBusConnectionFactory, final MessageConverter eventBusMessageConverter) {
log.info("Creating query event bus RabbitMQ template with a custom JSON converter");
final RabbitTemplate rabbitTemplate = new RabbitTemplate(eventBusConnectionFactory);
rabbitTemplate.setMessageConverter(eventBusMessageConverter);
return rabbitTemplate;
}
示例5: eventBusRabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
@Autowired
@Primary
public RabbitTemplate eventBusRabbitTemplate(final ConnectionFactory eventBusConnectionFactory, final MessageConverter eventBusMessageConverter) {
log.info("Creating event bus RabbitMQ template with a custom JSON converter");
final RabbitTemplate rabbitTemplate = new RabbitTemplate(eventBusConnectionFactory);
rabbitTemplate.setMessageConverter(eventBusMessageConverter);
return rabbitTemplate;
}
示例6: jsonMessageConverter
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter jsonMessageConverter()
{
final Jackson2JsonMessageConverter converter = new Jackson2JsonMessageConverter();
converter.setClassMapper(classMapper());
return converter;
}
示例7: replicationRabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public RabbitTemplate replicationRabbitTemplate(
ConnectionFactory connectionFactory,
MessageConverter replicationMessageConverter
) {
RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setReceiveTimeout(listeningTimeout);
template.setExchange(replicationExchange);
template.setMessageConverter(replicationMessageConverter);
return template;
}
示例8: rabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public RabbitTemplate rabbitTemplate(
ConnectionFactory connectionFactory,
MessageConverter messageConverter
) {
RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setReceiveTimeout(listeningTimeout);
template.setMessageConverter(messageConverter);
return template;
}
示例9: outRabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public RabbitTemplate outRabbitTemplate(
ConnectionFactory outConnectionFactory,
MessageConverter outMessageConverter
) {
RabbitTemplate template = new RabbitTemplate(outConnectionFactory);
template.setReceiveTimeout(listeningTimeout);
template.setQueue(resultQueue);
template.setMessageConverter(outMessageConverter);
return template;
}
示例10: fileServerRabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public RabbitTemplate fileServerRabbitTemplate(
ConnectionFactory serverConnectionFactory,
MessageConverter fileServerMessageConverter
) {
RabbitTemplate template = new RabbitTemplate(serverConnectionFactory);
template.setReceiveTimeout(listeningTimeout);
template.setMessageConverter(fileServerMessageConverter);
return template;
}
示例11: assertThat
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Test
public void デフォルト値が設定されて指定のインスタンスがDIコンテナに登録される() {
assertThat(config.host, is("127.0.0.1"));
assertThat(config.port, is("5672"));
assertThat(config.username, is("guest"));
assertThat(config.password, is("guest"));
assertThat(config.channelCacheSize, is(10));
assertThat(context.getBean(ConnectionFactory.class), is(notNullValue()));
assertThat(context.getBean(RabbitTemplate.class), is(notNullValue()));
assertThat(context.getBean(MessageConverter.class), is(notNullValue()));
}
示例12: jsonConverter
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter jsonConverter() {
return new Jackson2JsonMessageConverter();
}
示例13: messageConverter
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter messageConverter() {
return new ContentTypeDelegatingMessageConverter();
}
示例14: rabbitTemplate
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public RabbitTemplate rabbitTemplate(
AmqpTemplateMockManager mockManager, MessageConverter messageConverter) {
return new RabbitTemplateMock(mockManager, messageConverter, "my-default-exchange");
}
示例15: messageConverter
import org.springframework.amqp.support.converter.MessageConverter; //导入依赖的package包/类
@Bean
public MessageConverter messageConverter() {
return new Jackson2JsonMessageConverter();
}