@Configuration public class RabbitMqClient extends Object
| 构造器和说明 |
|---|
RabbitMqClient(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()
声明其名称自动命名的队列。
|
String |
addQueue(org.springframework.amqp.core.Queue queue)
创建一个指定的Queue
|
org.springframework.amqp.core.DirectExchange |
createExchange(String exchangeName)
创建交换器
|
boolean |
deleteExchange(String exchangeName)
删除一个Exchange
|
boolean |
deleteQueue(String queueName)
删除一个队列
|
void |
deleteQueue(String queueName,
boolean unused,
boolean empty)
删除一个队列
|
org.springframework.amqp.core.Message |
getMessage(String messageType,
Object msg)
转换Message对象
|
void |
initQueue() |
void |
publishEvent(String handlerName,
BaseMap baseMap)
发送远程事件
|
RabbitMqClient |
put(String key,
Object value) |
String |
receiveFromQueue(org.springframework.amqp.core.DirectExchange directExchange,
String queueName)
给direct交换机指定queue发送消息
|
String |
receiveFromQueue(String queueName)
给queue发送消息
|
void |
removeBinding(org.springframework.amqp.core.Binding binding)
去掉一个binding
|
void |
sendMessage(String queueName)
发送消息
|
void |
sendMessage(String queueName,
Object params)
发送消息
|
void |
sendMessage(String queueName,
Object params,
Integer expiration)
延迟发送消息
|
void |
sendMessageToExchange(org.springframework.amqp.core.TopicExchange topicExchange,
org.springframework.amqp.core.AbstractExchange exchange,
String msg)
没有绑定KEY的Exchange发送
|
void |
sendMessageToExchange(org.springframework.amqp.core.TopicExchange topicExchange,
String routingKey,
Object msg)
有绑定Key的Exchange发送
|
@Autowired
public RabbitMqClient(org.springframework.amqp.rabbit.core.RabbitAdmin rabbitAdmin,
org.springframework.amqp.rabbit.core.RabbitTemplate rabbitTemplate)
@Bean public void initQueue()
public void publishEvent(String handlerName, BaseMap baseMap)
handlerName - baseMap - public org.springframework.amqp.core.Message getMessage(String messageType, Object msg)
messageType - 返回消息类型 MessageProperties类中常量msg - public void sendMessageToExchange(org.springframework.amqp.core.TopicExchange topicExchange,
String routingKey,
Object msg)
routingKey - msg - public void sendMessageToExchange(org.springframework.amqp.core.TopicExchange topicExchange,
org.springframework.amqp.core.AbstractExchange exchange,
String msg)
exchange - msg - public void sendMessage(String queueName, Object params)
queueName - 队列名称params - 消息内容mappublic void sendMessage(String queueName)
queueName - 队列名称public RabbitMqClient put(String key, Object value)
public void sendMessage(String queueName, Object params, Integer expiration)
queueName - 队列名称params - 消息内容paramsexpiration - 延迟时间 单位毫秒public String receiveFromQueue(org.springframework.amqp.core.DirectExchange directExchange, String queueName)
directExchange - queueName - 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 org.springframework.amqp.core.DirectExchange createExchange(String exchangeName)
exchangeName - Copyright © 2022. All rights reserved.