PID2/PID10,查询接口
This commit is contained in:
parent
ca72d89ab1
commit
9ef99bfff3
@ -1,98 +0,0 @@
|
||||
package com.qgs.dc.mq.configuration;
|
||||
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Desc: "设备:PID10 相关信息定义"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/7 9:11
|
||||
*/
|
||||
@Configuration
|
||||
public class ConfigOfPID10 {
|
||||
|
||||
//水平扩展其他设备的时候 只要:control+R 然后 PID10=>00C 然后replace all
|
||||
public static final String EQUIPMENT_NAME_PID10 = "PID10";
|
||||
|
||||
public static final String EXCHANGE_NAME_PID10 = EQUIPMENT_NAME_PID10 +"_Exchange";
|
||||
public static final String EAP_REQUEST_QUEUE_PID10 = EQUIPMENT_NAME_PID10 +"_EAP_Request_Queue";
|
||||
public static final String EAP_RESPONSE_QUEUE_PID10 = EQUIPMENT_NAME_PID10 +"_EAP_Response_Queue";
|
||||
public static final String MES_REQUEST_QUEUE_PID10 = EQUIPMENT_NAME_PID10 +"_MES_Request_Queue";
|
||||
public static final String MES_RESPONSE_QUEUE_PID10 = EQUIPMENT_NAME_PID10 +"_MES_Response_Queue";
|
||||
public static final String EAP_REQUEST_QUEUE_ROUTINGKEY_PID10 = EQUIPMENT_NAME_PID10 +"_EAP_Request_Queue_RoutingKey";
|
||||
public static final String EAP_RESPONSE_QUEUE_ROUTINGKEY_PID10 = EQUIPMENT_NAME_PID10 +"_EAP_Response_Queue_RoutingKey";
|
||||
public static final String MES_REQUEST_QUEUE_ROUTINGKEY_PID10 = EQUIPMENT_NAME_PID10 +"_MES_Request_Queue_RoutingKey";
|
||||
public static final String MES_RESPONSE_QUEUE_ROUTINGKEY_PID10 = EQUIPMENT_NAME_PID10 +"_MES_Response_Queue_RoutingKey";
|
||||
|
||||
|
||||
@Bean
|
||||
public DirectExchange EXCHANGE_NAME_PID10(){
|
||||
return new DirectExchange(EXCHANGE_NAME_PID10);
|
||||
}
|
||||
|
||||
//todo
|
||||
@Bean
|
||||
public Queue MES_REQUEST_QUEUE_PID10(){
|
||||
Queue queue = new Queue(MES_REQUEST_QUEUE_PID10);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
@Bean
|
||||
public Queue MES_RESPONSE_QUEUE_PID10(){
|
||||
Queue queue = new Queue(MES_RESPONSE_QUEUE_PID10);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue EAP_REQUEST_QUEUE_PID10(){
|
||||
Queue queue = new Queue(EAP_REQUEST_QUEUE_PID10);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
|
||||
}
|
||||
@Bean
|
||||
public Queue EAP_RESPONSE_QUEUE_PID10(){
|
||||
Queue queue = new Queue(EAP_RESPONSE_QUEUE_PID10);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueA_PID10(){
|
||||
return BindingBuilder.bind(EAP_REQUEST_QUEUE_PID10()).to(EXCHANGE_NAME_PID10())
|
||||
.with(EAP_REQUEST_QUEUE_ROUTINGKEY_PID10);
|
||||
}
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueB_PID10(){
|
||||
return BindingBuilder.bind(EAP_RESPONSE_QUEUE_PID10()).to(EXCHANGE_NAME_PID10())
|
||||
.with(EAP_RESPONSE_QUEUE_ROUTINGKEY_PID10);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueC_PID10(){
|
||||
return BindingBuilder.bind(MES_REQUEST_QUEUE_PID10()).to(EXCHANGE_NAME_PID10())
|
||||
.with(MES_REQUEST_QUEUE_ROUTINGKEY_PID10);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueD_PID10(){
|
||||
return BindingBuilder.bind(MES_RESPONSE_QUEUE_PID10()).to(EXCHANGE_NAME_PID10())
|
||||
.with(MES_RESPONSE_QUEUE_ROUTINGKEY_PID10);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.qgs.dc.mq.configuration;
|
||||
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Desc: "设备:PID10_1 相关信息定义"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/7 9:11
|
||||
*/
|
||||
@Configuration
|
||||
public class ConfigOfPID10_1 {
|
||||
|
||||
//水平扩展其他设备的时候 只要:control+R 然后 PID10_1=>00C 然后replace all
|
||||
public static final String EQUIPMENT_NAME_PID10_1 = "PID10_1";
|
||||
|
||||
public static final String EXCHANGE_NAME_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_Exchange";
|
||||
public static final String EAP_REQUEST_QUEUE_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_EAP_Request_Queue";
|
||||
public static final String EAP_RESPONSE_QUEUE_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_EAP_Response_Queue";
|
||||
public static final String MES_REQUEST_QUEUE_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_MES_Request_Queue";
|
||||
public static final String MES_RESPONSE_QUEUE_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_MES_Response_Queue";
|
||||
public static final String EAP_REQUEST_QUEUE_ROUTINGKEY_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_EAP_Request_Queue_RoutingKey";
|
||||
public static final String EAP_RESPONSE_QUEUE_ROUTINGKEY_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_EAP_Response_Queue_RoutingKey";
|
||||
public static final String MES_REQUEST_QUEUE_ROUTINGKEY_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_MES_Request_Queue_RoutingKey";
|
||||
public static final String MES_RESPONSE_QUEUE_ROUTINGKEY_PID10_1 = EQUIPMENT_NAME_PID10_1 +"_MES_Response_Queue_RoutingKey";
|
||||
|
||||
|
||||
@Bean
|
||||
public DirectExchange EXCHANGE_NAME_PID10_1(){
|
||||
return new DirectExchange(EXCHANGE_NAME_PID10_1);
|
||||
}
|
||||
|
||||
//todo
|
||||
@Bean
|
||||
public Queue MES_REQUEST_QUEUE_PID10_1(){
|
||||
Queue queue = new Queue(MES_REQUEST_QUEUE_PID10_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
@Bean
|
||||
public Queue MES_RESPONSE_QUEUE_PID10_1(){
|
||||
Queue queue = new Queue(MES_RESPONSE_QUEUE_PID10_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue EAP_REQUEST_QUEUE_PID10_1(){
|
||||
Queue queue = new Queue(EAP_REQUEST_QUEUE_PID10_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
|
||||
}
|
||||
@Bean
|
||||
public Queue EAP_RESPONSE_QUEUE_PID10_1(){
|
||||
Queue queue = new Queue(EAP_RESPONSE_QUEUE_PID10_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueA_PID10_1(){
|
||||
return BindingBuilder.bind(EAP_REQUEST_QUEUE_PID10_1()).to(EXCHANGE_NAME_PID10_1())
|
||||
.with(EAP_REQUEST_QUEUE_ROUTINGKEY_PID10_1);
|
||||
}
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueB_PID10_1(){
|
||||
return BindingBuilder.bind(EAP_RESPONSE_QUEUE_PID10_1()).to(EXCHANGE_NAME_PID10_1())
|
||||
.with(EAP_RESPONSE_QUEUE_ROUTINGKEY_PID10_1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueC_PID10_1(){
|
||||
return BindingBuilder.bind(MES_REQUEST_QUEUE_PID10_1()).to(EXCHANGE_NAME_PID10_1())
|
||||
.with(MES_REQUEST_QUEUE_ROUTINGKEY_PID10_1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueD_PID10_1(){
|
||||
return BindingBuilder.bind(MES_RESPONSE_QUEUE_PID10_1()).to(EXCHANGE_NAME_PID10_1())
|
||||
.with(MES_RESPONSE_QUEUE_ROUTINGKEY_PID10_1);
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.qgs.dc.mq.configuration;
|
||||
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Desc: "设备:PID13S 相关信息定义"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/7 9:11
|
||||
*/
|
||||
@Configuration
|
||||
public class ConfigOfPID13S {
|
||||
|
||||
//水平扩展其他设备的时候 只要:control+R 然后 PID13S=>00C 然后replace all
|
||||
public static final String EQUIPMENT_NAME_PID13S = "PID13S";
|
||||
|
||||
public static final String EXCHANGE_NAME_PID13S = EQUIPMENT_NAME_PID13S +"_Exchange";
|
||||
public static final String EAP_REQUEST_QUEUE_PID13S = EQUIPMENT_NAME_PID13S +"_EAP_Request_Queue";
|
||||
public static final String EAP_RESPONSE_QUEUE_PID13S = EQUIPMENT_NAME_PID13S +"_EAP_Response_Queue";
|
||||
public static final String MES_REQUEST_QUEUE_PID13S = EQUIPMENT_NAME_PID13S +"_MES_Request_Queue";
|
||||
public static final String MES_RESPONSE_QUEUE_PID13S = EQUIPMENT_NAME_PID13S +"_MES_Response_Queue";
|
||||
public static final String EAP_REQUEST_QUEUE_ROUTINGKEY_PID13S = EQUIPMENT_NAME_PID13S +"_EAP_Request_Queue_RoutingKey";
|
||||
public static final String EAP_RESPONSE_QUEUE_ROUTINGKEY_PID13S = EQUIPMENT_NAME_PID13S +"_EAP_Response_Queue_RoutingKey";
|
||||
public static final String MES_REQUEST_QUEUE_ROUTINGKEY_PID13S = EQUIPMENT_NAME_PID13S +"_MES_Request_Queue_RoutingKey";
|
||||
public static final String MES_RESPONSE_QUEUE_ROUTINGKEY_PID13S = EQUIPMENT_NAME_PID13S +"_MES_Response_Queue_RoutingKey";
|
||||
|
||||
|
||||
@Bean
|
||||
public DirectExchange EXCHANGE_NAME_PID13S(){
|
||||
return new DirectExchange(EXCHANGE_NAME_PID13S);
|
||||
}
|
||||
|
||||
//todo
|
||||
@Bean
|
||||
public Queue MES_REQUEST_QUEUE_PID13S(){
|
||||
Queue queue = new Queue(MES_REQUEST_QUEUE_PID13S);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
@Bean
|
||||
public Queue MES_RESPONSE_QUEUE_PID13S(){
|
||||
Queue queue = new Queue(MES_RESPONSE_QUEUE_PID13S);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue EAP_REQUEST_QUEUE_PID13S(){
|
||||
Queue queue = new Queue(EAP_REQUEST_QUEUE_PID13S);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
|
||||
}
|
||||
@Bean
|
||||
public Queue EAP_RESPONSE_QUEUE_PID13S(){
|
||||
Queue queue = new Queue(EAP_RESPONSE_QUEUE_PID13S);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueA_PID13S(){
|
||||
return BindingBuilder.bind(EAP_REQUEST_QUEUE_PID13S()).to(EXCHANGE_NAME_PID13S())
|
||||
.with(EAP_REQUEST_QUEUE_ROUTINGKEY_PID13S);
|
||||
}
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueB_PID13S(){
|
||||
return BindingBuilder.bind(EAP_RESPONSE_QUEUE_PID13S()).to(EXCHANGE_NAME_PID13S())
|
||||
.with(EAP_RESPONSE_QUEUE_ROUTINGKEY_PID13S);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueC_PID13S(){
|
||||
return BindingBuilder.bind(MES_REQUEST_QUEUE_PID13S()).to(EXCHANGE_NAME_PID13S())
|
||||
.with(MES_REQUEST_QUEUE_ROUTINGKEY_PID13S);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueD_PID13S(){
|
||||
return BindingBuilder.bind(MES_RESPONSE_QUEUE_PID13S()).to(EXCHANGE_NAME_PID13S())
|
||||
.with(MES_RESPONSE_QUEUE_ROUTINGKEY_PID13S);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.qgs.dc.mq.configuration;
|
||||
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Desc: "设备:PID13a1415a_1 相关信息定义"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/7 9:11
|
||||
*/
|
||||
@Configuration
|
||||
public class ConfigOfPID13a1415a_1 {
|
||||
|
||||
//水平扩展其他设备的时候 只要:control+R 然后 PID13a1415a_1=>00C 然后replace all
|
||||
public static final String EQUIPMENT_NAME_PID13a1415a_1 = "PID13a1415a_1";
|
||||
|
||||
public static final String EXCHANGE_NAME_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_Exchange";
|
||||
public static final String EAP_REQUEST_QUEUE_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_EAP_Request_Queue";
|
||||
public static final String EAP_RESPONSE_QUEUE_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_EAP_Response_Queue";
|
||||
public static final String MES_REQUEST_QUEUE_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_MES_Request_Queue";
|
||||
public static final String MES_RESPONSE_QUEUE_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_MES_Response_Queue";
|
||||
public static final String EAP_REQUEST_QUEUE_ROUTINGKEY_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_EAP_Request_Queue_RoutingKey";
|
||||
public static final String EAP_RESPONSE_QUEUE_ROUTINGKEY_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_EAP_Response_Queue_RoutingKey";
|
||||
public static final String MES_REQUEST_QUEUE_ROUTINGKEY_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_MES_Request_Queue_RoutingKey";
|
||||
public static final String MES_RESPONSE_QUEUE_ROUTINGKEY_PID13a1415a_1 = EQUIPMENT_NAME_PID13a1415a_1 +"_MES_Response_Queue_RoutingKey";
|
||||
|
||||
|
||||
@Bean
|
||||
public DirectExchange EXCHANGE_NAME_PID13a1415a_1(){
|
||||
return new DirectExchange(EXCHANGE_NAME_PID13a1415a_1);
|
||||
}
|
||||
|
||||
//todo
|
||||
@Bean
|
||||
public Queue MES_REQUEST_QUEUE_PID13a1415a_1(){
|
||||
Queue queue = new Queue(MES_REQUEST_QUEUE_PID13a1415a_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
@Bean
|
||||
public Queue MES_RESPONSE_QUEUE_PID13a1415a_1(){
|
||||
Queue queue = new Queue(MES_RESPONSE_QUEUE_PID13a1415a_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue EAP_REQUEST_QUEUE_PID13a1415a_1(){
|
||||
Queue queue = new Queue(EAP_REQUEST_QUEUE_PID13a1415a_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
|
||||
}
|
||||
@Bean
|
||||
public Queue EAP_RESPONSE_QUEUE_PID13a1415a_1(){
|
||||
Queue queue = new Queue(EAP_RESPONSE_QUEUE_PID13a1415a_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueA_PID13a1415a_1(){
|
||||
return BindingBuilder.bind(EAP_REQUEST_QUEUE_PID13a1415a_1()).to(EXCHANGE_NAME_PID13a1415a_1())
|
||||
.with(EAP_REQUEST_QUEUE_ROUTINGKEY_PID13a1415a_1);
|
||||
}
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueB_PID13a1415a_1(){
|
||||
return BindingBuilder.bind(EAP_RESPONSE_QUEUE_PID13a1415a_1()).to(EXCHANGE_NAME_PID13a1415a_1())
|
||||
.with(EAP_RESPONSE_QUEUE_ROUTINGKEY_PID13a1415a_1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueC_PID13a1415a_1(){
|
||||
return BindingBuilder.bind(MES_REQUEST_QUEUE_PID13a1415a_1()).to(EXCHANGE_NAME_PID13a1415a_1())
|
||||
.with(MES_REQUEST_QUEUE_ROUTINGKEY_PID13a1415a_1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueD_PID13a1415a_1(){
|
||||
return BindingBuilder.bind(MES_RESPONSE_QUEUE_PID13a1415a_1()).to(EXCHANGE_NAME_PID13a1415a_1())
|
||||
.with(MES_RESPONSE_QUEUE_ROUTINGKEY_PID13a1415a_1);
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.qgs.dc.mq.configuration;
|
||||
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Desc: "设备:PID2 相关信息定义"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/7 9:11
|
||||
*/
|
||||
@Configuration
|
||||
public class ConfigOfPID2 {
|
||||
|
||||
//水平扩展其他设备的时候 只要:control+R 然后 PID2=>00C 然后replace all
|
||||
public static final String EQUIPMENT_NAME_PID2 = "PID2";
|
||||
|
||||
public static final String EXCHANGE_NAME_PID2 = EQUIPMENT_NAME_PID2 +"_Exchange";
|
||||
public static final String EAP_REQUEST_QUEUE_PID2 = EQUIPMENT_NAME_PID2 +"_EAP_Request_Queue";
|
||||
public static final String EAP_RESPONSE_QUEUE_PID2 = EQUIPMENT_NAME_PID2 +"_EAP_Response_Queue";
|
||||
public static final String MES_REQUEST_QUEUE_PID2 = EQUIPMENT_NAME_PID2 +"_MES_Request_Queue";
|
||||
public static final String MES_RESPONSE_QUEUE_PID2 = EQUIPMENT_NAME_PID2 +"_MES_Response_Queue";
|
||||
public static final String EAP_REQUEST_QUEUE_ROUTINGKEY_PID2 = EQUIPMENT_NAME_PID2 +"_EAP_Request_Queue_RoutingKey";
|
||||
public static final String EAP_RESPONSE_QUEUE_ROUTINGKEY_PID2 = EQUIPMENT_NAME_PID2 +"_EAP_Response_Queue_RoutingKey";
|
||||
public static final String MES_REQUEST_QUEUE_ROUTINGKEY_PID2 = EQUIPMENT_NAME_PID2 +"_MES_Request_Queue_RoutingKey";
|
||||
public static final String MES_RESPONSE_QUEUE_ROUTINGKEY_PID2 = EQUIPMENT_NAME_PID2 +"_MES_Response_Queue_RoutingKey";
|
||||
|
||||
|
||||
@Bean
|
||||
public DirectExchange EXCHANGE_NAME_PID2(){
|
||||
return new DirectExchange(EXCHANGE_NAME_PID2);
|
||||
}
|
||||
|
||||
//todo
|
||||
@Bean
|
||||
public Queue MES_REQUEST_QUEUE_PID2(){
|
||||
Queue queue = new Queue(MES_REQUEST_QUEUE_PID2);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
@Bean
|
||||
public Queue MES_RESPONSE_QUEUE_PID2(){
|
||||
Queue queue = new Queue(MES_RESPONSE_QUEUE_PID2);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue EAP_REQUEST_QUEUE_PID2(){
|
||||
Queue queue = new Queue(EAP_REQUEST_QUEUE_PID2);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
|
||||
}
|
||||
@Bean
|
||||
public Queue EAP_RESPONSE_QUEUE_PID2(){
|
||||
Queue queue = new Queue(EAP_RESPONSE_QUEUE_PID2);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueA_PID2(){
|
||||
return BindingBuilder.bind(EAP_REQUEST_QUEUE_PID2()).to(EXCHANGE_NAME_PID2())
|
||||
.with(EAP_REQUEST_QUEUE_ROUTINGKEY_PID2);
|
||||
}
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueB_PID2(){
|
||||
return BindingBuilder.bind(EAP_RESPONSE_QUEUE_PID2()).to(EXCHANGE_NAME_PID2())
|
||||
.with(EAP_RESPONSE_QUEUE_ROUTINGKEY_PID2);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueC_PID2(){
|
||||
return BindingBuilder.bind(MES_REQUEST_QUEUE_PID2()).to(EXCHANGE_NAME_PID2())
|
||||
.with(MES_REQUEST_QUEUE_ROUTINGKEY_PID2);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueD_PID2(){
|
||||
return BindingBuilder.bind(MES_RESPONSE_QUEUE_PID2()).to(EXCHANGE_NAME_PID2())
|
||||
.with(MES_RESPONSE_QUEUE_ROUTINGKEY_PID2);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.qgs.dc.mq.configuration;
|
||||
|
||||
|
||||
import org.springframework.amqp.core.Binding;
|
||||
import org.springframework.amqp.core.BindingBuilder;
|
||||
import org.springframework.amqp.core.DirectExchange;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Desc: "设备:PID2_1 相关信息定义"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/7 9:11
|
||||
*/
|
||||
@Configuration
|
||||
public class ConfigOfPID2_1 {
|
||||
|
||||
//水平扩展其他设备的时候 只要:control+R 然后 PID2_1=>00C 然后replace all
|
||||
public static final String EQUIPMENT_NAME_PID2_1 = "PID2_1";
|
||||
|
||||
public static final String EXCHANGE_NAME_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_Exchange";
|
||||
public static final String EAP_REQUEST_QUEUE_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_EAP_Request_Queue";
|
||||
public static final String EAP_RESPONSE_QUEUE_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_EAP_Response_Queue";
|
||||
public static final String MES_REQUEST_QUEUE_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_MES_Request_Queue";
|
||||
public static final String MES_RESPONSE_QUEUE_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_MES_Response_Queue";
|
||||
public static final String EAP_REQUEST_QUEUE_ROUTINGKEY_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_EAP_Request_Queue_RoutingKey";
|
||||
public static final String EAP_RESPONSE_QUEUE_ROUTINGKEY_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_EAP_Response_Queue_RoutingKey";
|
||||
public static final String MES_REQUEST_QUEUE_ROUTINGKEY_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_MES_Request_Queue_RoutingKey";
|
||||
public static final String MES_RESPONSE_QUEUE_ROUTINGKEY_PID2_1 = EQUIPMENT_NAME_PID2_1 +"_MES_Response_Queue_RoutingKey";
|
||||
|
||||
|
||||
@Bean
|
||||
public DirectExchange EXCHANGE_NAME_PID2_1(){
|
||||
return new DirectExchange(EXCHANGE_NAME_PID2_1);
|
||||
}
|
||||
|
||||
//todo
|
||||
@Bean
|
||||
public Queue MES_REQUEST_QUEUE_PID2_1(){
|
||||
Queue queue = new Queue(MES_REQUEST_QUEUE_PID2_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
@Bean
|
||||
public Queue MES_RESPONSE_QUEUE_PID2_1(){
|
||||
Queue queue = new Queue(MES_RESPONSE_QUEUE_PID2_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Queue EAP_REQUEST_QUEUE_PID2_1(){
|
||||
Queue queue = new Queue(EAP_REQUEST_QUEUE_PID2_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
|
||||
}
|
||||
@Bean
|
||||
public Queue EAP_RESPONSE_QUEUE_PID2_1(){
|
||||
Queue queue = new Queue(EAP_RESPONSE_QUEUE_PID2_1);
|
||||
queue.addArgument("x-dead-letter-exchange",ConfigOfDeadLetterQueue.EXCHANGE_NAME_DLE);
|
||||
queue.addArgument("x-dead-letter-routing-key",ConfigOfDeadLetterQueue.Dead_Letter_RoutingKey);
|
||||
//queue.addArgument("x-max-priority",ConfigOfDeadLetterQueue.MAX_PRIORITY);
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueA_PID2_1(){
|
||||
return BindingBuilder.bind(EAP_REQUEST_QUEUE_PID2_1()).to(EXCHANGE_NAME_PID2_1())
|
||||
.with(EAP_REQUEST_QUEUE_ROUTINGKEY_PID2_1);
|
||||
}
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueB_PID2_1(){
|
||||
return BindingBuilder.bind(EAP_RESPONSE_QUEUE_PID2_1()).to(EXCHANGE_NAME_PID2_1())
|
||||
.with(EAP_RESPONSE_QUEUE_ROUTINGKEY_PID2_1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueC_PID2_1(){
|
||||
return BindingBuilder.bind(MES_REQUEST_QUEUE_PID2_1()).to(EXCHANGE_NAME_PID2_1())
|
||||
.with(MES_REQUEST_QUEUE_ROUTINGKEY_PID2_1);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Binding bindExchangeAndQueueD_PID2_1(){
|
||||
return BindingBuilder.bind(MES_RESPONSE_QUEUE_PID2_1()).to(EXCHANGE_NAME_PID2_1())
|
||||
.with(MES_RESPONSE_QUEUE_ROUTINGKEY_PID2_1);
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qgs.dc.common.utils.CommonFunction;
|
||||
import com.qgs.dc.mq.Constant.Constant;
|
||||
import com.qgs.dc.mq.configuration.ConfigOfPID10;
|
||||
import com.qgs.dc.mq.configuration.ConfigOfPID10_1;
|
||||
import com.qgs.dc.mq.consumer.commonHandler.MQMessageHandler;
|
||||
import com.qgs.dc.mq.entity.MQMessage;
|
||||
import com.qgs.dc.mq.entity.common.Header;
|
||||
@ -25,27 +25,27 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Desc: "PIDPID10设备 接收MQ消息 监听类"
|
||||
* @Desc: "PIDPID10_1设备 接收MQ消息 监听类"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/22 15:30
|
||||
*
|
||||
* Ctrl+R 替换设备名
|
||||
*/
|
||||
@Component
|
||||
public class PID10Received {
|
||||
public class PID10_1Received {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PID10Received.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(PID10_1Received.class);
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
MQMessageHandler mqMessageHandler;
|
||||
|
||||
@RabbitListener(queues = ConfigOfPID10.EAP_REQUEST_QUEUE_PID10)
|
||||
@RabbitListener(queues = ConfigOfPID10_1.EAP_REQUEST_QUEUE_PID10_1)
|
||||
@RabbitHandler
|
||||
public void eapRequest(Message<?> message, Channel channel)throws Exception{
|
||||
|
||||
logger.info("==============received message-EAP_REQUEST_QUEUE_PID10=================,priority:"+"equipmentName"+message.getHeaders().get("attr2"));
|
||||
logger.info("==============received message-EAP_REQUEST_QUEUE_PID10_1=================,priority:"+"equipmentName"+message.getHeaders().get("attr2"));
|
||||
|
||||
Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
// //MQMessage 中的 transactionId
|
||||
@ -63,10 +63,10 @@ public class PID10Received {
|
||||
|
||||
//注意 这里特别注意 已经拒收的消息 再签收是要出错的,这里要特别注意。
|
||||
if(result == 1){
|
||||
logger.info("在 EAP_REQUEST_QUEUE_PID10 队列中,transitionId"+transactionId+", 这条消息处理成功");
|
||||
logger.info("在 EAP_REQUEST_QUEUE_PID10_1 队列中,transitionId"+transactionId+", 这条消息处理成功");
|
||||
channel.basicAck(deliveryTag,false);
|
||||
}else {
|
||||
logger.error("在 EAP_REQUEST_QUEUE_PID10 队列中,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
logger.error("在 EAP_REQUEST_QUEUE_PID10_1 队列中,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
channel.basicNack(deliveryTag,false,false);
|
||||
}
|
||||
//2.模拟异常 ,然后 拒签消息 ,然后丢到死信队列
|
||||
@ -119,10 +119,10 @@ public class PID10Received {
|
||||
System.out.println(s);
|
||||
//String result= HttpUtil.post("localhost:8001/receivedFromEapRequest",s);
|
||||
|
||||
//{"header":{"transactionId":"PIDPID10_20210908093729_95196","messageType":"Request","messageCategory":"Alarm","messageName":"AlarmTimeOut","from":"EAP","to":"MES","equipmentId":"PIDPID10","sendTimestamp":"2021-09-08 09:37:29"},"body":"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ=="}
|
||||
String s22 = "{\"header\":{\"transactionId\":\"PIDPID10_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID10\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":\"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ==\"}";
|
||||
//{"header":{"transactionId":"PIDPID10_1_20210908093729_95196","messageType":"Request","messageCategory":"Alarm","messageName":"AlarmTimeOut","from":"EAP","to":"MES","equipmentId":"PIDPID10_1","sendTimestamp":"2021-09-08 09:37:29"},"body":"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ=="}
|
||||
String s22 = "{\"header\":{\"transactionId\":\"PIDPID10_1_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID10_1\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":\"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ==\"}";
|
||||
|
||||
String s2 = "{\"header\":{\"transactionId\":\"PIDPID10_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID10\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":{\"TransactionId:\":\"PIDPID10_20210908093644_71835\",\"MessageName:\":\"TraceData\"}}";
|
||||
String s2 = "{\"header\":{\"transactionId\":\"PIDPID10_1_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID10_1\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":{\"TransactionId:\":\"PIDPID10_1_20210908093644_71835\",\"MessageName:\":\"TraceData\"}}";
|
||||
JSONObject jsonObject = JSON.parseObject(s2);
|
||||
String header1 = jsonObject.getString("header");
|
||||
String body = jsonObject.getString("body");
|
||||
@ -136,10 +136,10 @@ public class PID10Received {
|
||||
System.out.println(mqMessage2.toString());
|
||||
}
|
||||
|
||||
@RabbitListener(queues = ConfigOfPID10.MES_RESPONSE_QUEUE_PID10)
|
||||
@RabbitListener(queues = ConfigOfPID10_1.MES_RESPONSE_QUEUE_PID10_1)
|
||||
@RabbitHandler
|
||||
public void mesResponse(Message<?> message, Channel channel)throws Exception{
|
||||
logger.info("==============PIDPID10_Exchange-MES_Response_Queue=================,priority:"+message.getHeaders().get("priority")+",attr1"+message.getHeaders().get("attr1"));
|
||||
logger.info("==============PIDPID10_1_Exchange-MES_Response_Queue=================,priority:"+message.getHeaders().get("priority")+",attr1"+message.getHeaders().get("attr1"));
|
||||
Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
|
||||
//模拟异常 ,然后 拒签消息 ,然后丢到死信队列
|
||||
@ -148,10 +148,10 @@ public class PID10Received {
|
||||
String transactionId = mqMessage.getHeader().getTransactionId();
|
||||
Integer result = mqMessageHandler.responseHandler(message);
|
||||
if(result == 1){
|
||||
logger.info("在 MES_RESPONSE_QUEUE_PID10 队列中 , transitionId"+transactionId+" 这条消息处理成功");
|
||||
logger.info("在 MES_RESPONSE_QUEUE_PID10_1 队列中 , transitionId"+transactionId+" 这条消息处理成功");
|
||||
channel.basicAck(deliveryTag,false);
|
||||
}else {
|
||||
logger.error("在 MES_RESPONSE_QUEUE_PID10 队列中 ,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
logger.error("在 MES_RESPONSE_QUEUE_PID10_1 队列中 ,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
channel.basicNack(deliveryTag,false,false);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qgs.dc.common.utils.CommonFunction;
|
||||
import com.qgs.dc.mq.Constant.Constant;
|
||||
import com.qgs.dc.mq.configuration.ConfigOfPID2;
|
||||
import com.qgs.dc.mq.configuration.ConfigOfPID13a1415a_1;
|
||||
import com.qgs.dc.mq.consumer.commonHandler.MQMessageHandler;
|
||||
import com.qgs.dc.mq.entity.MQMessage;
|
||||
import com.qgs.dc.mq.entity.common.Header;
|
||||
@ -25,27 +25,27 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Desc: "PIDPID2设备 接收MQ消息 监听类"
|
||||
* @Desc: "PIDPID13a1415a_1设备 接收MQ消息 监听类"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/22 15:30
|
||||
*
|
||||
* Ctrl+R 替换设备名
|
||||
*/
|
||||
@Component
|
||||
public class PID2Received {
|
||||
public class PID13a1415a_1Received {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PID2Received.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(PID13a1415a_1Received.class);
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
MQMessageHandler mqMessageHandler;
|
||||
|
||||
@RabbitListener(queues = ConfigOfPID2.EAP_REQUEST_QUEUE_PID2)
|
||||
@RabbitListener(queues = ConfigOfPID13a1415a_1.EAP_REQUEST_QUEUE_PID13a1415a_1)
|
||||
@RabbitHandler
|
||||
public void eapRequest(Message<?> message, Channel channel)throws Exception{
|
||||
|
||||
logger.info("==============received message-EAP_REQUEST_QUEUE_PID2=================,priority:"+"equipmentName"+message.getHeaders().get("attr2"));
|
||||
logger.info("==============received message-EAP_REQUEST_QUEUE_PID13a1415a_1=================,priority:"+"equipmentName"+message.getHeaders().get("attr2"));
|
||||
|
||||
Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
// //MQMessage 中的 transactionId
|
||||
@ -63,15 +63,14 @@ public class PID2Received {
|
||||
|
||||
//注意 这里特别注意 已经拒收的消息 再签收是要出错的,这里要特别注意。
|
||||
if(result == 1){
|
||||
logger.info("在 EAP_REQUEST_QUEUE_PID2 队列中,transitionId"+transactionId+", 这条消息处理成功");
|
||||
logger.info("在 EAP_REQUEST_QUEUE_PID13a1415a_1 队列中,transitionId"+transactionId+", 这条消息处理成功");
|
||||
channel.basicAck(deliveryTag,false);
|
||||
}else {
|
||||
logger.error("在 EAP_REQUEST_QUEUE_PID2 队列中,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
logger.error("在 EAP_REQUEST_QUEUE_PID13a1415a_1 队列中,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
channel.basicNack(deliveryTag,false,false);
|
||||
}
|
||||
//2.模拟异常 ,然后 拒签消息 ,然后丢到死信队列
|
||||
|
||||
//throw new Exception("11111");
|
||||
}catch (Exception e){
|
||||
// 第一个false 是 不批量签收;第二个false 是 不重回队列
|
||||
logger.error(e.getMessage());
|
||||
@ -119,10 +118,10 @@ public class PID2Received {
|
||||
System.out.println(s);
|
||||
//String result= HttpUtil.post("localhost:8001/receivedFromEapRequest",s);
|
||||
|
||||
//{"header":{"transactionId":"PIDPID2_20210908093729_95196","messageType":"Request","messageCategory":"Alarm","messageName":"AlarmTimeOut","from":"EAP","to":"MES","equipmentId":"PIDPID2","sendTimestamp":"2021-09-08 09:37:29"},"body":"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ=="}
|
||||
String s22 = "{\"header\":{\"transactionId\":\"PIDPID2_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID2\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":\"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ==\"}";
|
||||
//{"header":{"transactionId":"PIDPID13a1415a_1_20210908093729_95196","messageType":"Request","messageCategory":"Alarm","messageName":"AlarmTimeOut","from":"EAP","to":"MES","equipmentId":"PIDPID13a1415a_1","sendTimestamp":"2021-09-08 09:37:29"},"body":"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ=="}
|
||||
String s22 = "{\"header\":{\"transactionId\":\"PIDPID13a1415a_1_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID13a1415a_1\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":\"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ==\"}";
|
||||
|
||||
String s2 = "{\"header\":{\"transactionId\":\"PIDPID2_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID2\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":{\"TransactionId:\":\"PIDPID2_20210908093644_71835\",\"MessageName:\":\"TraceData\"}}";
|
||||
String s2 = "{\"header\":{\"transactionId\":\"PIDPID13a1415a_1_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID13a1415a_1\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":{\"TransactionId:\":\"PIDPID13a1415a_1_20210908093644_71835\",\"MessageName:\":\"TraceData\"}}";
|
||||
JSONObject jsonObject = JSON.parseObject(s2);
|
||||
String header1 = jsonObject.getString("header");
|
||||
String body = jsonObject.getString("body");
|
||||
@ -136,10 +135,10 @@ public class PID2Received {
|
||||
System.out.println(mqMessage2.toString());
|
||||
}
|
||||
|
||||
@RabbitListener(queues = ConfigOfPID2.MES_RESPONSE_QUEUE_PID2)
|
||||
@RabbitListener(queues = ConfigOfPID13a1415a_1.MES_RESPONSE_QUEUE_PID13a1415a_1)
|
||||
@RabbitHandler
|
||||
public void mesResponse(Message<?> message, Channel channel)throws Exception{
|
||||
logger.info("==============PIDPID2_Exchange-MES_Response_Queue=================,priority:"+message.getHeaders().get("priority")+",attr1"+message.getHeaders().get("attr1"));
|
||||
logger.info("==============PIDPID13a1415a_1_Exchange-MES_Response_Queue=================,priority:"+message.getHeaders().get("priority")+",attr1"+message.getHeaders().get("attr1"));
|
||||
Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
|
||||
//模拟异常 ,然后 拒签消息 ,然后丢到死信队列
|
||||
@ -148,10 +147,10 @@ public class PID2Received {
|
||||
String transactionId = mqMessage.getHeader().getTransactionId();
|
||||
Integer result = mqMessageHandler.responseHandler(message);
|
||||
if(result == 1){
|
||||
logger.info("在 MES_RESPONSE_QUEUE_PID2 队列中 , transitionId"+transactionId+" 这条消息处理成功");
|
||||
logger.info("在 MES_RESPONSE_QUEUE_PID13a1415a_1 队列中 , transitionId"+transactionId+" 这条消息处理成功");
|
||||
channel.basicAck(deliveryTag,false);
|
||||
}else {
|
||||
logger.error("在 MES_RESPONSE_QUEUE_PID2 队列中 ,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
logger.error("在 MES_RESPONSE_QUEUE_PID13a1415a_1 队列中 ,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
channel.basicNack(deliveryTag,false,false);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qgs.dc.common.utils.CommonFunction;
|
||||
import com.qgs.dc.mq.Constant.Constant;
|
||||
import com.qgs.dc.mq.configuration.ConfigOfPID13S;
|
||||
import com.qgs.dc.mq.configuration.ConfigOfPID2_1;
|
||||
import com.qgs.dc.mq.consumer.commonHandler.MQMessageHandler;
|
||||
import com.qgs.dc.mq.entity.MQMessage;
|
||||
import com.qgs.dc.mq.entity.common.Header;
|
||||
@ -25,27 +25,27 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Desc: "PIDPID13S设备 接收MQ消息 监听类"
|
||||
* @Desc: "PIDPID2_1设备 接收MQ消息 监听类"
|
||||
* @Author: caixiang
|
||||
* @DATE: 2021/6/22 15:30
|
||||
*
|
||||
* Ctrl+R 替换设备名
|
||||
*/
|
||||
@Component
|
||||
public class PID13SReceived {
|
||||
public class PID2_1Received {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(PID13SReceived.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(PID2_1Received.class);
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
MQMessageHandler mqMessageHandler;
|
||||
|
||||
@RabbitListener(queues = ConfigOfPID13S.EAP_REQUEST_QUEUE_PID13S)
|
||||
@RabbitListener(queues = ConfigOfPID2_1.EAP_REQUEST_QUEUE_PID2_1)
|
||||
@RabbitHandler
|
||||
public void eapRequest(Message<?> message, Channel channel)throws Exception{
|
||||
|
||||
logger.info("==============received message-EAP_REQUEST_QUEUE_PID13S=================,priority:"+"equipmentName"+message.getHeaders().get("attr2"));
|
||||
logger.info("==============received message-EAP_REQUEST_QUEUE_PID2_1=================,priority:"+"equipmentName"+message.getHeaders().get("attr2"));
|
||||
|
||||
Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
// //MQMessage 中的 transactionId
|
||||
@ -63,14 +63,15 @@ public class PID13SReceived {
|
||||
|
||||
//注意 这里特别注意 已经拒收的消息 再签收是要出错的,这里要特别注意。
|
||||
if(result == 1){
|
||||
logger.info("在 EAP_REQUEST_QUEUE_PID13S 队列中,transitionId"+transactionId+", 这条消息处理成功");
|
||||
logger.info("在 EAP_REQUEST_QUEUE_PID2_1 队列中,transitionId"+transactionId+", 这条消息处理成功");
|
||||
channel.basicAck(deliveryTag,false);
|
||||
}else {
|
||||
logger.error("在 EAP_REQUEST_QUEUE_PID13S 队列中,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
logger.error("在 EAP_REQUEST_QUEUE_PID2_1 队列中,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
channel.basicNack(deliveryTag,false,false);
|
||||
}
|
||||
//2.模拟异常 ,然后 拒签消息 ,然后丢到死信队列
|
||||
|
||||
//throw new Exception("11111");
|
||||
}catch (Exception e){
|
||||
// 第一个false 是 不批量签收;第二个false 是 不重回队列
|
||||
logger.error(e.getMessage());
|
||||
@ -118,10 +119,10 @@ public class PID13SReceived {
|
||||
System.out.println(s);
|
||||
//String result= HttpUtil.post("localhost:8001/receivedFromEapRequest",s);
|
||||
|
||||
//{"header":{"transactionId":"PIDPID13S_20210908093729_95196","messageType":"Request","messageCategory":"Alarm","messageName":"AlarmTimeOut","from":"EAP","to":"MES","equipmentId":"PIDPID13S","sendTimestamp":"2021-09-08 09:37:29"},"body":"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ=="}
|
||||
String s22 = "{\"header\":{\"transactionId\":\"PIDPID13S_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID13S\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":\"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ==\"}";
|
||||
//{"header":{"transactionId":"PIDPID2_1_20210908093729_95196","messageType":"Request","messageCategory":"Alarm","messageName":"AlarmTimeOut","from":"EAP","to":"MES","equipmentId":"PIDPID2_1","sendTimestamp":"2021-09-08 09:37:29"},"body":"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ=="}
|
||||
String s22 = "{\"header\":{\"transactionId\":\"PIDPID2_1_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID2_1\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":\"eyJ2aWRMaXN0IjpbIjEwMDAwIiwiMTAwMDEiLCIxMDAwMiJdLCJ2aWRUeXBlIjoidTQifQ==\"}";
|
||||
|
||||
String s2 = "{\"header\":{\"transactionId\":\"PIDPID13S_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID13S\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":{\"TransactionId:\":\"PIDPID13S_20210908093644_71835\",\"MessageName:\":\"TraceData\"}}";
|
||||
String s2 = "{\"header\":{\"transactionId\":\"PIDPID2_1_20210908093729_95196\",\"messageType\":\"Request\",\"messageCategory\":\"Alarm\",\"messageName\":\"AlarmTimeOut\",\"from\":\"EAP\",\"to\":\"MES\",\"equipmentId\":\"PIDPID2_1\",\"sendTimestamp\":\"2021-09-08 09:37:29\"},\"body\":{\"TransactionId:\":\"PIDPID2_1_20210908093644_71835\",\"MessageName:\":\"TraceData\"}}";
|
||||
JSONObject jsonObject = JSON.parseObject(s2);
|
||||
String header1 = jsonObject.getString("header");
|
||||
String body = jsonObject.getString("body");
|
||||
@ -135,10 +136,10 @@ public class PID13SReceived {
|
||||
System.out.println(mqMessage2.toString());
|
||||
}
|
||||
|
||||
@RabbitListener(queues = ConfigOfPID13S.MES_RESPONSE_QUEUE_PID13S)
|
||||
@RabbitListener(queues = ConfigOfPID2_1.MES_RESPONSE_QUEUE_PID2_1)
|
||||
@RabbitHandler
|
||||
public void mesResponse(Message<?> message, Channel channel)throws Exception{
|
||||
logger.info("==============PIDPID13S_Exchange-MES_Response_Queue=================,priority:"+message.getHeaders().get("priority")+",attr1"+message.getHeaders().get("attr1"));
|
||||
logger.info("==============PIDPID2_1_Exchange-MES_Response_Queue=================,priority:"+message.getHeaders().get("priority")+",attr1"+message.getHeaders().get("attr1"));
|
||||
Long deliveryTag = (Long)message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
|
||||
//模拟异常 ,然后 拒签消息 ,然后丢到死信队列
|
||||
@ -147,10 +148,10 @@ public class PID13SReceived {
|
||||
String transactionId = mqMessage.getHeader().getTransactionId();
|
||||
Integer result = mqMessageHandler.responseHandler(message);
|
||||
if(result == 1){
|
||||
logger.info("在 MES_RESPONSE_QUEUE_PID13S 队列中 , transitionId"+transactionId+" 这条消息处理成功");
|
||||
logger.info("在 MES_RESPONSE_QUEUE_PID2_1 队列中 , transitionId"+transactionId+" 这条消息处理成功");
|
||||
channel.basicAck(deliveryTag,false);
|
||||
}else {
|
||||
logger.error("在 MES_RESPONSE_QUEUE_PID13S 队列中 ,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
logger.error("在 MES_RESPONSE_QUEUE_PID2_1 队列中 ,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列");
|
||||
channel.basicNack(deliveryTag,false,false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user