类 MQPool
java.lang.Object
cn.myafx.rabbitmq.MQPool
- 所有已实现的接口:
IMQPool,AutoCloseable
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidclose()closevoidexchangeDeclare(ExchangeConfig config) 定义交换器voidexchangeDeclare(String exchange, String type, Boolean durable, Boolean autoDelete, Map<String, Object> arguments) 定义交换器voidexchangeDeclare(List<ExchangeConfig> configs) 批量定义交换器intThe current heartbeat setting for this connection (0 for disabled).booleanisOpen()Returns true if the connection is still in a state where it can be used.<T> booleanpub(List<T> msgList, PubConfig config, Integer expire, Boolean persistent, Map<String, Object> headers) 发布消息<T> booleanpub(List<T> msgList, String routingKey, Integer expire, String exchange, Boolean persistent, Map<String, Object> headers) 发布消息<T> boolean发布消息<T> booleanpub(T msg, String routingKey, Integer expire, String exchange, Boolean persistent, Map<String, Object> headers) 发布消息<T> booleanpubDelay(List<T> msgList, PubConfig config, Integer delay, Boolean persistent, Map<String, Object> headers) 发布延迟消息<T> booleanpubDelay(List<T> msgList, String delayRoutingKey, Integer delay, String exchange, Boolean persistent, Map<String, Object> headers) 发布延迟消息<T> boolean发布延迟消息<T> booleanpubDelay(T msg, String delayRoutingKey, Integer delay, String exchange, Boolean persistent, Map<String, Object> headers) 发布延迟消息voidqueueDeclare(QueueConfig config) 定义队列voidqueueDeclare(List<QueueConfig> queues) 批量定义队列voidsetExceptionHander(ISubException hander) 异常回调<T> voidsub(ISubHander<T> hander, String queue, Boolean autoAck) 消费消息
-
构造器详细资料
-
MQPool
public MQPool(String hostName, Integer port, String userName, String password, String virtualHost, Integer maxPushPool, Integer networkRecoveryInterval, String clientName, IJsonMapper mapper) throws Exception mq 应用池- 参数:
hostName- mq服务器port- mq端口 5672userName- 登录账号password- 密码virtualHost- virtualHost, 默认 /maxPushPool- push池大小, 默认 3networkRecoveryInterval- networkRecoveryInterval, 默认 15clientName- clientNamemapper- mapper- 抛出:
Exception- Exception
-
-
方法详细资料
-
setExceptionHander
异常回调- 指定者:
setExceptionHander在接口中IMQPool- 参数:
hander- hander
-
isOpen
public boolean isOpen()Returns true if the connection is still in a state where it can be used. Identical to checking if RabbitMQ.Client.IConnection.CloseReason equal null. -
getHeartbeat
public int getHeartbeat()The current heartbeat setting for this connection (0 for disabled). second- 指定者:
getHeartbeat在接口中IMQPool- 返回:
- int
-
exchangeDeclare
public void exchangeDeclare(String exchange, String type, Boolean durable, Boolean autoDelete, Map<String, Object> arguments) throws Exception定义交换器- 指定者:
exchangeDeclare在接口中IMQPool- 参数:
exchange- 交换器, 默认 "amq.direct"type- 交换器类型, 默认 "direct"durable- 是否持久化, 默认trueautoDelete- 当已经没有消费者时,服务器是否可以删除该Exchange, 默认 falsearguments- arguments- 抛出:
Exception- Exception
-
exchangeDeclare
定义交换器- 指定者:
exchangeDeclare在接口中IMQPool- 参数:
config- ExchangeConfig- 抛出:
Exception- Exception
-
exchangeDeclare
批量定义交换器- 指定者:
exchangeDeclare在接口中IMQPool- 参数:
configs- ExchangeConfig- 抛出:
Exception- Exception
-
queueDeclare
定义队列- 指定者:
queueDeclare在接口中IMQPool- 参数:
config- QueueConfig- 抛出:
Exception- Exception
-
queueDeclare
批量定义队列- 指定者:
queueDeclare在接口中IMQPool- 参数:
queues- QueueConfig- 抛出:
Exception- Exception
-
pub
public <T> boolean pub(T msg, String routingKey, Integer expire, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布消息 -
pub
public <T> boolean pub(T msg, PubConfig config, Integer expire, Boolean persistent, Map<String, Object> headers) throws Exception发布消息 -
pub
public <T> boolean pub(List<T> msgList, String routingKey, Integer expire, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布消息 -
pub
public <T> boolean pub(List<T> msgList, PubConfig config, Integer expire, Boolean persistent, Map<String, Object> headers) throws Exception发布消息 -
pubDelay
public <T> boolean pubDelay(T msg, String delayRoutingKey, Integer delay, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息 -
pubDelay
public <T> boolean pubDelay(T msg, PubConfig config, Integer delay, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息 -
pubDelay
public <T> boolean pubDelay(List<T> msgList, String delayRoutingKey, Integer delay, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息 -
pubDelay
public <T> boolean pubDelay(List<T> msgList, PubConfig config, Integer delay, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息 -
sub
消费消息 -
close
close- 指定者:
close在接口中AutoCloseable- 抛出:
Exception
-