mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-17 08:18:34 +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.OrderService;
|
||||||
import com.jsowell.service.TempService;
|
import com.jsowell.service.TempService;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -65,6 +66,9 @@ public class TempController extends BaseController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SettleOrderReportService settleOrderReportService;
|
private SettleOrderReportService settleOrderReportService;
|
||||||
|
|
||||||
@@ -583,4 +587,13 @@ public class TempController extends BaseController {
|
|||||||
}
|
}
|
||||||
return response;
|
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.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听RabbitMQ消息 充电桩
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class PileRabbitListener {
|
public class PileRabbitListener {
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听RabbitMQ消息 订单
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class OrderRabbitListener {
|
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