mirror of
https://github.com/luoye663/e5.git
synced 2025-10-29 02:15:27 +00:00
去除rabbitmq 依赖,增加webflux依赖
This commit is contained in:
@@ -1,83 +0,0 @@
|
||||
package io.qyi.e5.config.rabbitMQ;
|
||||
|
||||
import org.springframework.amqp.core.*;
|
||||
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @program: msgpush
|
||||
* @description:
|
||||
* @author: 落叶随风
|
||||
* @create: 2020-01-12 22:00
|
||||
**/
|
||||
@Configuration
|
||||
public class RabbitMQConfig {
|
||||
@Value("")
|
||||
private String DirectQueueName;
|
||||
|
||||
/**
|
||||
* 处理死信队列的消费队列
|
||||
*/
|
||||
@Bean
|
||||
public Queue fanoutQueue1() {
|
||||
return new Queue("delay_queue1", true, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置消息交换机
|
||||
* 针对消费者配置
|
||||
* FanoutExchange: 将消息分发到所有的绑定队列,无routingkey的概念
|
||||
* HeadersExchange :通过添加属性key-value匹配
|
||||
* DirectExchange:按照routingkey分发到指定队列
|
||||
* TopicExchange:多关键字匹配
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public CustomExchange customExchangeDelay() {
|
||||
Map<String, Object> arg = new HashMap<>();
|
||||
arg.put("x-delayed-type", "direct");
|
||||
return new CustomExchange("delay", "x-delayed-message", true, false, arg);
|
||||
}
|
||||
|
||||
/*@Bean
|
||||
public FanoutExchange fanoutExchangeTencentMsg() {
|
||||
return new FanoutExchange(EXCHANGE);
|
||||
}*/
|
||||
|
||||
//绑定 将队列和交换机绑定,
|
||||
@Bean
|
||||
public Binding bindingFanoutQueue1() {
|
||||
return BindingBuilder.bind(fanoutQueue1()).to(customExchangeDelay()).with("routing_delay").noargs();
|
||||
}
|
||||
|
||||
|
||||
// 无限循环问题
|
||||
@Bean
|
||||
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
|
||||
RabbitTemplate template = new RabbitTemplate(connectionFactory);
|
||||
template.setMessageConverter(new Jackson2JsonMessageConverter());
|
||||
return template;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
|
||||
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
|
||||
factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
|
||||
factory.setConcurrentConsumers(1);
|
||||
factory.setMaxConcurrentConsumers(50);
|
||||
factory.setPrefetchCount(20);
|
||||
factory.setConnectionFactory(connectionFactory);
|
||||
factory.setMessageConverter(new Jackson2JsonMessageConverter());
|
||||
return factory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
package io.qyi.e5.controller.admin;
|
||||
|
||||
import io.qyi.e5.config.security.UsernamePasswordAuthenticationToken;
|
||||
import io.qyi.e5.outlook.service.IOutlookService;
|
||||
import io.qyi.e5.service.task.ITask;
|
||||
import io.qyi.e5.util.EncryptUtil;
|
||||
import io.qyi.e5.util.StringUtil;
|
||||
import io.qyi.e5.util.redis.RedisUtil;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -30,8 +26,6 @@ import java.util.*;
|
||||
@RestController
|
||||
@RequestMapping("/admin")
|
||||
public class AdminController {
|
||||
@Autowired
|
||||
RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
IOutlookService outlookService;
|
||||
|
||||
@@ -9,9 +9,6 @@ import io.qyi.e5.service.task.ITask;
|
||||
import io.qyi.e5.util.redis.RedisUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.core.MessageProperties;
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
@@ -34,8 +31,6 @@ public class TaskImpl implements ITask {
|
||||
|
||||
@Autowired
|
||||
IOutlookService outlookService;
|
||||
@Autowired
|
||||
RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
RedisUtil redisUtil;
|
||||
|
||||
Reference in New Issue
Block a user