添加队列
parent
4c08e5a40b
commit
3e90aba9f6
|
@ -4,6 +4,8 @@ import com.fate.common.core.utils.StringUtils;
|
|||
import com.shiyi.launch.domain.VehicleConnectionReq;
|
||||
import com.shiyi.launch.mapper.VehicleaunchMapper;
|
||||
import com.shiyi.launch.service.VehiclelaunchService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -16,11 +18,22 @@ import java.util.UUID;
|
|||
* @Date: 2023-11-30 20:02
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class VehiclelaunchServiceimpl implements VehiclelaunchService {
|
||||
|
||||
@Autowired
|
||||
private VehicleaunchMapper vehicleaunchMapper;
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
// 主题
|
||||
private static final String FATE = "fate";
|
||||
|
||||
// 队列
|
||||
private static final String STREAM_QUEUE = "fate_queue";
|
||||
|
||||
@Override
|
||||
public String vehicleConnection(VehicleConnectionReq vehicleConnectionReq) {
|
||||
// 先去查询车辆的vin 在不在 ,如果不在就连接不上
|
||||
|
@ -45,6 +58,8 @@ public class VehiclelaunchServiceimpl implements VehiclelaunchService {
|
|||
|
||||
String fate = "fate" + vehicleConnectionReq.getVehicleVin().substring(3,7) + vehicleConnectionReq.getNonce();
|
||||
|
||||
rabbitTemplate.convertAndSend(FATE,STREAM_QUEUE,fate);
|
||||
log.info("发送消息成功");
|
||||
return fate;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue