MULE AMQP Connector-RabbitMQ学习记录

写在前面
AMQP(Advanced Message Queuing Protocol),高级消息队列协议。RabbitMQ正是该协议的实现,如果想要在Mule中使用RabbitMQ,那么就需要和AMQP Connector打交道。之前的博客里面曾经写过一篇在Mule中使用RabbitMQ的博客,戳这里MULE配置RabbitMQ简单示例 ,十分简单地在Mule中使用了RabbitMQ,但是对于一些细节点等地方还没有仔细学习,因此有了这篇更进一步学习记录的博客。

From an inbound AMQP message, the AMQP connector creates a Mule message with byte[] payloads. For a Mule message destined for an outbound AMQP message, Mule uses its auto-transformation infrastructure to extract the Mule message’s byte[] payload.

其它类型的负载进入AMQP连接器,将会被自动转为byte[]类型的负载。当队列的消息从AMQP出站处流出时,Mule将使用其内部的自动转换将MuleMessage中的负载提取为byte[]类型负载。这也是为什么在Mule中出站的AMQP后面要接Byte Array to Object

The AMQP connector defines what broker to connect to, which credentials to use when doing so, and all the common properties used by the inbound and outbound endpoints using this connector.

AMQP Connector定义连接到broker的配置,连接broker的账号信息,被入站和出站AMQP使用的公共属性也是在AMQP连接器中定义。因此就算你本身Mule程序只是作为消费者使用,也是需要配置AMQP Connector的,否则直接拖动一个AMQP作为入站端点运行将会出现java.net.UnknownHostException

You can create several connectors connected to the same broker for the purpose of having different sets of common properties that the endpoints use.

可以创建连接到同一broker的多个connector,以便具有连接到相同的broker中可以使用的不同的公共属性集。



入站前日志打印记录

入站后日志打印记录

RabbitMQ控制台获取消息

实际上记录入站后的MuleMessage结构并没有十分关键的内容,因为消息还在消息队列中保存着没有被消耗,因此创建一个出站AMQP并且记录经过它所处理后的MuleMessage。

出站AMQP后MuleMessage结构

对于以上的结果,官网文档中作出了简单地说明:

The transport also takes care of making inbound message properties available as standard Mule Message properties and, conversely, converting properties of Mule messages into AMQP properties for outbound messages.
Additionally, all custom headers defined in the AMQP basic properties – which are available in a map under the amqp.headers inbound property – are added as standard inbound properties.


往后继续补充

参考资料
官网AMQP连接器说明
觉得不错的Rabbitmq入门概念介绍——开源中国

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值