package com.matrix.component.rabbitmq;
|
|
import com.rabbitmq.client.DeliverCallback;
|
|
/**
|
* MQ队列任务类
|
*/
|
public class MqTask {
|
|
|
/**
|
* 交换机
|
*/
|
private String exchange;
|
|
/**
|
* 队列名称
|
*/
|
private String queue;
|
|
/**
|
* 路由名称
|
*/
|
private String routingKey;
|
|
/**
|
* 处理类在spring中的bean名称
|
*/
|
private DeliverCallbackAdapter handerAdapter;
|
|
/**
|
* 自动确认 默认为true
|
*/
|
private Boolean autoAck=true;
|
|
|
public MqTask(String exchange, String queue, String routingKey, DeliverCallback hander) {
|
this.exchange = exchange;
|
this.queue = queue;
|
this.routingKey = routingKey;
|
if(hander!=null){
|
this.handerAdapter = new DeliverCallbackAdapter(hander,routingKey);
|
}
|
|
}
|
public MqTask(String exchange, String queue, String routingKey, DeliverCallback hander, Boolean autoAck) {
|
this.exchange = exchange;
|
this.queue = queue;
|
this.routingKey = routingKey;
|
if(hander!=null){
|
this.handerAdapter = new DeliverCallbackAdapter(hander,routingKey);
|
}
|
this.autoAck=autoAck;
|
|
}
|
|
|
|
|
|
|
public String getExchange() {
|
return exchange;
|
}
|
|
public Boolean getAutoAck() {
|
return autoAck;
|
}
|
|
public void setAutoAck(Boolean autoAck) {
|
this.autoAck = autoAck;
|
}
|
|
public void setExchange(String exchange) {
|
this.exchange = exchange;
|
}
|
|
public String getQueue() {
|
return queue;
|
}
|
|
public void setQueue(String queue) {
|
this.queue = queue;
|
}
|
|
public String getRoutingKey() {
|
return routingKey;
|
}
|
|
public void setRoutingKey(String routingKey) {
|
this.routingKey = routingKey;
|
}
|
|
public DeliverCallback getHander() {
|
return handerAdapter;
|
}
|
|
public void setHander(DeliverCallbackAdapter hander) {
|
this.handerAdapter = hander;
|
}
|
}
|