mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
测试RabbitMQ
This commit is contained in:
@@ -25,6 +25,7 @@ import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.service.OrderService;
|
||||
import com.jsowell.service.TempService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -65,6 +66,9 @@ public class TempController extends BaseController {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private SettleOrderReportService settleOrderReportService;
|
||||
|
||||
@@ -583,4 +587,13 @@ public class TempController extends BaseController {
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试RabbitMQ
|
||||
*/
|
||||
@PostMapping("/testRabbitMQ")
|
||||
public RestApiResponse<?> testRabbitMQ(@RequestBody TestRabbitMQDTO dto) {
|
||||
rabbitTemplate.convertAndSend(dto.getExchange(), dto.getRoutingKey(), dto.getData());
|
||||
return new RestApiResponse<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,9 @@ import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 监听RabbitMQ消息 充电桩
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PileRabbitListener {
|
||||
|
||||
@@ -10,6 +10,9 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 监听RabbitMQ消息 订单
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OrderRabbitListener {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TestRabbitMQDTO {
|
||||
private String exchange;
|
||||
private String routingKey;
|
||||
private String data;
|
||||
}
|
||||
Reference in New Issue
Block a user