public class RabbitMqUtils extends Object
| 构造器和说明 |
|---|
RabbitMqUtils(org.springframework.amqp.rabbit.core.RabbitAdmin rabbitAdmin,
org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addBinding(org.springframework.amqp.core.Exchange exchange,
org.springframework.amqp.core.TopicExchange topicExchange,
String routingKey)
绑定一个Exchange到一个匹配型Exchange 使用一个routingKey
|
void |
addBinding(org.springframework.amqp.core.Queue queue,
org.springframework.amqp.core.TopicExchange exchange,
String routingKey)
绑定一个队列到一个匹配型交换器使用一个routingKey
|
void |
addExchange(org.springframework.amqp.core.AbstractExchange exchange)
创建Exchange
|
org.springframework.amqp.core.Queue |
addQueue()
Declare a queue whose name is automatically named.
|
String |
addQueue(org.springframework.amqp.core.Queue queue)
创建一个指定的Queue
|
void |
basicAck(org.springframework.amqp.core.Message message,
com.rabbitmq.client.Channel channel)
通知 MQ 消息已被成功消费,可以ACK了
|
void |
basicAckAndRecover(org.springframework.amqp.core.Message message,
com.rabbitmq.client.Channel channel)
通知 MQ 消息已被成功消费,可以ACK了同时将处理失败,重新压入MQ
手动ack是必要步骤,是否重新压入MQ由业务方决定
|
void |
delayQueue(String exchange,
String queueName,
Object message,
MessageDelayLevel messageDelayLevel)
发送延迟队列
|
boolean |
deleteExchange(String exchangeName)
删除一个Exchange
|
boolean |
deleteQueue(String queueName)
删除一个queue
|
void |
deleteQueue(String queueName,
boolean unused,
boolean empty)
Delete a queue.
|
void |
directQueue(String queueName,
Object message)
直接模式发送
|
void |
fanoutExchange(String queueName,
String routingKey,
Object message)
分列模式队列
|
void |
removeBinding(org.springframework.amqp.core.Binding binding)
去掉一个binding
|
void |
topicExchange(String queueName,
String routingKey,
Object message)
主题模式队列
|
public RabbitMqUtils(org.springframework.amqp.rabbit.core.RabbitAdmin rabbitAdmin,
org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate)
public void addExchange(org.springframework.amqp.core.AbstractExchange exchange)
exchange - public boolean deleteExchange(String exchangeName)
exchangeName - public org.springframework.amqp.core.Queue addQueue()
public String addQueue(org.springframework.amqp.core.Queue queue)
queue - public void deleteQueue(String queueName, boolean unused, boolean empty)
queueName - the name of the queue.unused - true if the queue should be deleted only if not in use.empty - true if the queue should be deleted only if empty.public boolean deleteQueue(String queueName)
queueName - public void addBinding(org.springframework.amqp.core.Queue queue,
org.springframework.amqp.core.TopicExchange exchange,
String routingKey)
queue - exchange - routingKey - public void addBinding(org.springframework.amqp.core.Exchange exchange,
org.springframework.amqp.core.TopicExchange topicExchange,
String routingKey)
exchange - topicExchange - routingKey - public void removeBinding(org.springframework.amqp.core.Binding binding)
binding - public void basicAck(org.springframework.amqp.core.Message message,
com.rabbitmq.client.Channel channel)
message - channel - public void basicAckAndRecover(org.springframework.amqp.core.Message message,
com.rabbitmq.client.Channel channel)
message - channel - public void directQueue(String queueName, Object message)
queueName - message - public void fanoutExchange(String queueName, String routingKey, Object message)
queueName - routingKey - message - public void topicExchange(String queueName, String routingKey, Object message)
queueName - routingKey - message - public void delayQueue(String exchange, String queueName, Object message, MessageDelayLevel messageDelayLevel)
exchange - queueName - message - messageDelayLevel - Copyright © 2024. All rights reserved.