Java Code Examples for org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory#setMessageConverter()

The following examples show how to use org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory#setMessageConverter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseConfiguration.java    From common-project with Apache License 2.0 5 votes vote down vote up
/**
 * 配置接收消息的MessageConverter
 *
 * @param connectionFactory 连接工厂
 * @return
 */
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setPrefetchCount(50);
    factory.setConcurrentConsumers(5);
    factory.setMessageConverter(new ProtobufMessageConverter());
    factory.setAcknowledgeMode(AcknowledgeMode.AUTO);
    return factory;
}
 
Example 2
Source File: TopicRabbitConfig.java    From iot-dc3 with Apache License 2.0 5 votes vote down vote up
@Bean
public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setMessageConverter(new Jackson2JsonMessageConverter());
    return factory;
}
 
Example 3
Source File: RabbitConfig.java    From iot-dc3 with Apache License 2.0 5 votes vote down vote up
@Bean
public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setMessageConverter(new Jackson2JsonMessageConverter());
    return factory;
}
 
Example 4
Source File: TopicRabbitConfig.java    From iot-dc3 with Apache License 2.0 5 votes vote down vote up
@Bean
public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setMessageConverter(new Jackson2JsonMessageConverter());
    return factory;
}
 
Example 5
Source File: RabbitMQConfiguration.java    From seed with Apache License 2.0 5 votes vote down vote up
@Bean
public SimpleRabbitListenerContainerFactory jadyerRabbitListenerContainerFactory(ConnectionFactory connectionFactory){
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setMessageConverter(new Jackson2JsonMessageConverter());
    return factory;
}
 
Example 6
Source File: RabbitConfiguration.java    From JuniperBot with GNU General Public License v3.0 5 votes vote down vote up
@Bean
public RabbitListenerContainerFactory<SimpleMessageListenerContainer> rabbitListenerContainerFactory() {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory());
    factory.setDefaultRequeueRejected(false);
    factory.setMessageConverter(messageConverter());
    return factory;
}
 
Example 7
Source File: AmqpMessageBrokerConfiguration.java    From piper with Apache License 2.0 5 votes vote down vote up
private SimpleRabbitListenerContainerFactory createContainerFactory (int aConcurrency) {
  SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
  factory.setConcurrentConsumers(aConcurrency);
  factory.setConnectionFactory(connectionFactory);
  factory.setDefaultRequeueRejected(false);
  factory.setMessageConverter(jacksonAmqpMessageConverter(objectMapper));
  factory.setPrefetchCount(rabbit.getListener().getDirect().getPrefetch());
  return factory;
}
 
Example 8
Source File: RabbitTemplateConfig.java    From spring-boot-tutorials with Apache License 2.0 5 votes vote down vote up
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setMessageConverter(new Jackson2JsonMessageConverter());
    return factory;
}
 
Example 9
Source File: RabbitTemplateConfig.java    From spring-boot-tutorials with Apache License 2.0 5 votes vote down vote up
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setMessageConverter(new Jackson2JsonMessageConverter());
    return factory;
}
 
Example 10
Source File: AmqpMessagingApplication.java    From spring-cloud-contract with Apache License 2.0 5 votes vote down vote up
@Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(
		ConnectionFactory connectionFactory, MessageConverter messageConverter) {
	SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
	factory.setConnectionFactory(connectionFactory);
	factory.setConcurrentConsumers(3);
	factory.setMaxConcurrentConsumers(10);
	factory.setMessageConverter(messageConverter);
	return factory;
}
 
Example 11
Source File: RabbitMQConfiguration.java    From cukes with Apache License 2.0 5 votes vote down vote up
@Bean
SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory  cf,
                                                                    ObjectMapper mapper) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(cf);
    factory.setMessageConverter(new Jackson2JsonMessageConverter(mapper));
    return factory;
}