mirror of
https://github.com/luoye663/e5.git
synced 2024-12-26 03:38:53 +00:00
去除rabbitmq 依赖,增加webflux依赖
This commit is contained in:
parent
d230a1c561
commit
e6d0bba0ed
22
pom.xml
22
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.3.1.RELEASE</version>
|
<version>2.5.2</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>io.qyi</groupId>
|
<groupId>io.qyi</groupId>
|
||||||
@ -135,21 +135,14 @@
|
|||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.9</version>
|
<version>3.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-aop</artifactId>
|
|
||||||
<!– <version>4.3.9.RELEASE</version>–>
|
|
||||||
</dependency>-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.aspectj</groupId>
|
<groupId>org.aspectj</groupId>
|
||||||
<artifactId>aspectjrt</artifactId>
|
<artifactId>aspectjrt</artifactId>
|
||||||
<!-- <version>1.8.9</version>-->
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.aspectj</groupId>
|
<groupId>org.aspectj</groupId>
|
||||||
<artifactId>aspectjweaver</artifactId>
|
<artifactId>aspectjweaver</artifactId>
|
||||||
<!-- <version>1.8.9</version>-->
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
@ -157,14 +150,21 @@
|
|||||||
<version>RELEASE</version>
|
<version>RELEASE</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--这个包同时包含了一些其它的包:spring-context、spring-tx、spring-web、spring-messaging、spring-retry、spring-amqp、amqp-client,如果想单纯一点,可以单独引入。-->
|
<!--webflux依赖-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--这个包同时包含了一些其它的包:spring-context、spring-tx、spring-web、spring-messaging、spring-retry、spring-amqp、amqp-client,如果想单纯一点,可以单独引入。-->
|
||||||
|
<!-- <dependency>
|
||||||
<groupId>org.springframework.amqp</groupId>
|
<groupId>org.springframework.amqp</groupId>
|
||||||
<artifactId>spring-rabbit</artifactId>
|
<artifactId>spring-rabbit</artifactId>
|
||||||
<!--<version>${version}</version>-->
|
<!–<version>${version}</version>–>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -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;
|
package io.qyi.e5.controller.admin;
|
||||||
|
|
||||||
import io.qyi.e5.config.security.UsernamePasswordAuthenticationToken;
|
|
||||||
import io.qyi.e5.outlook.service.IOutlookService;
|
import io.qyi.e5.outlook.service.IOutlookService;
|
||||||
import io.qyi.e5.service.task.ITask;
|
import io.qyi.e5.service.task.ITask;
|
||||||
import io.qyi.e5.util.EncryptUtil;
|
import io.qyi.e5.util.EncryptUtil;
|
||||||
import io.qyi.e5.util.StringUtil;
|
|
||||||
import io.qyi.e5.util.redis.RedisUtil;
|
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.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.authority.AuthorityUtils;
|
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -30,8 +26,6 @@ import java.util.*;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/admin")
|
@RequestMapping("/admin")
|
||||||
public class AdminController {
|
public class AdminController {
|
||||||
@Autowired
|
|
||||||
RabbitTemplate rabbitTemplate;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IOutlookService outlookService;
|
IOutlookService outlookService;
|
||||||
|
@ -9,9 +9,6 @@ import io.qyi.e5.service.task.ITask;
|
|||||||
import io.qyi.e5.util.redis.RedisUtil;
|
import io.qyi.e5.util.redis.RedisUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
@ -34,8 +31,6 @@ public class TaskImpl implements ITask {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IOutlookService outlookService;
|
IOutlookService outlookService;
|
||||||
@Autowired
|
|
||||||
RabbitTemplate rabbitTemplate;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
RedisUtil redisUtil;
|
RedisUtil redisUtil;
|
||||||
|
Loading…
Reference in New Issue
Block a user