Commit 8aae94d2 authored by 赵啸非's avatar 赵啸非

业务日志添加

parent 80503362
......@@ -111,6 +111,21 @@ public class RabbitConfig {
return factory;
}
@Bean(name = "consumerContainerFactory")
public SimpleRabbitListenerContainerFactory consumerContainerFactory(
SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) {
// 创建 SimpleRabbitListenerContainerFactory 对象
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setAfterReceivePostProcessors(m -> {
m.getMessageProperties().setContentType("application/json");
return m;
});
configurer.configure(factory, connectionFactory);
return factory;
}
//修改系列和与反序列化转换器
@Bean
public MessageConverter messageConverter() {
......
......@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
**/
@Slf4j
@Component
@RabbitListener(queues = QueueKey.OPERATION_LOG_QUEUE)
@RabbitListener(queues = QueueKey.OPERATION_LOG_QUEUE,containerFactory = "consumerContainerFactory")
//@RabbitListener(queues = QueueKey.OPERATION_LOG_QUEUE,
// containerFactory = "consumerBatchContainerFactory")
public class OperateMessageConsumerListener {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment