接口 IMQPool
- 所有超级接口:
AutoCloseable
- 所有已知实现类:
MQPool
mq 应用池接口
-
方法概要
修饰符和类型方法说明voidexchangeDeclare(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) 消费消息从接口继承的方法 java.lang.AutoCloseable
close
-
方法详细资料
-
setExceptionHander
异常回调- 参数:
hander- hander
-
isOpen
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.- 返回:
- boolean
-
getHeartbeat
int getHeartbeat()The current heartbeat setting for this connection (0 for disabled). second- 返回:
- int
-
exchangeDeclare
void exchangeDeclare(String exchange, String type, Boolean durable, Boolean autoDelete, Map<String, Object> arguments) throws Exception定义交换器- 参数:
exchange- 交换器, 默认 "amq.direct"type- 交换器类型, 默认 "direct"durable- 是否持久化, 默认trueautoDelete- 当已经没有消费者时,服务器是否可以删除该Exchange, 默认 falsearguments- arguments- 抛出:
Exception- Exception
-
exchangeDeclare
定义交换器- 参数:
config- ExchangeConfig- 抛出:
Exception- Exception
-
exchangeDeclare
批量定义交换器- 参数:
configs- ExchangeConfig- 抛出:
Exception- Exception
-
queueDeclare
定义队列- 参数:
config- QueueConfig- 抛出:
Exception- Exception
-
queueDeclare
批量定义队列- 参数:
queues- QueueConfig- 抛出:
Exception- Exception
-
pub
<T> boolean pub(T msg, String routingKey, Integer expire, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布消息- 类型参数:
T- T- 参数:
msg- 消息routingKey- routingKeyexpire- 消息过期时间, 秒exchange- exchange, 默认 "amq.direct"persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exception
-
pub
<T> boolean pub(T msg, PubConfig config, Integer expire, Boolean persistent, Map<String, Object> headers) throws Exception发布消息- 类型参数:
T- T- 参数:
msg- 消息config- 路由配置expire- 消息过期时间, 秒persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exception
-
pub
<T> boolean pub(List<T> msgList, String routingKey, Integer expire, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布消息- 类型参数:
T- T- 参数:
msgList- 消息routingKey- routingKeyexpire- 消息过期时间, 秒exchange- exchange, 默认 "amq.direct"persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exceptions
-
pub
<T> boolean pub(List<T> msgList, PubConfig config, Integer expire, Boolean persistent, Map<String, Object> headers) throws Exception发布消息- 类型参数:
T- T- 参数:
msgList- 消息config- 路由配置expire- 消息过期时间, 秒persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exception
-
pubDelay
<T> boolean pubDelay(T msg, String delayRoutingKey, Integer delay, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息- 类型参数:
T- T- 参数:
msg- 消息delayRoutingKey- delayRoutingKeydelay- 延迟时间, 秒exchange- exchange, 默认 "amq.direct"persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exception
-
pubDelay
<T> boolean pubDelay(T msg, PubConfig config, Integer delay, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息- 类型参数:
T- T- 参数:
msg- 消息config- 路由配置delay- 延迟时间, 秒persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exception
-
pubDelay
<T> boolean pubDelay(List<T> msgList, String delayRoutingKey, Integer delay, String exchange, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息- 类型参数:
T- T- 参数:
msgList- 消息delayRoutingKey- delayRoutingKeydelay- 延迟时间, 秒exchange- exchange, 默认 "amq.direct"persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exception
-
pubDelay
<T> boolean pubDelay(List<T> msgList, PubConfig config, Integer delay, Boolean persistent, Map<String, Object> headers) throws Exception发布延迟消息- 类型参数:
T- T- 参数:
msgList- 消息config- 路由配置delay- 延迟时间, 秒persistent- 消息是否持久化, 默认 falseheaders- headers- 返回:
- boolean
- 抛出:
Exception- Exception
-
sub
消费消息- 类型参数:
T- T- 参数:
hander- handerqueue- queueautoAck- 是否自动确认, 默认 false- 抛出:
Exception- Exception
-