release- 积分日志单线程运行

release-2024-04-25
pikaqiudeshujia 2 months ago
parent acd7e4e1b7
commit b9098dadc5

@ -24,4 +24,13 @@ public class RabbitMQConfig {
factory.setMessageConverter(new Jackson2JsonMessageConverter()); factory.setMessageConverter(new Jackson2JsonMessageConverter());
return factory; return factory;
} }
@Bean
public SimpleRabbitListenerContainerFactory pointLogFactory(ConnectionFactory connectionFactory) {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setMessageConverter(new Jackson2JsonMessageConverter());
factory.setPrefetchCount(1);
return factory;
}
} }

@ -6,12 +6,10 @@ import com.luoo.user.service.UserPointLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
/** /**
* @program: luoo_parent * @program: luoo_parent
@ -20,7 +18,7 @@ import java.util.Map;
* @create: 2024-07-24 13:05 * @create: 2024-07-24 13:05
**/ **/
@Component @Component
@RabbitListener(queues = "pointLog") @RabbitListener(queues = "pointLog", containerFactory = "pointLogFactory")
@Slf4j @Slf4j
public class PointLogListener { public class PointLogListener {

Loading…
Cancel
Save