RabbitMQ 支持的数据类型 [英] Data types supported by RabbitMQ

查看:59
本文介绍了RabbitMQ 支持的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试发送数据类型,如 int、float、bolean 等以及 Java 对象.我没有看到此类用例的任何示例或实现.我看到的那些例子只有字符串.

I am trying send data types like int, float, bolean etc and also Java Object. I dont see any examples or implementations for this kind of use cases. Those examples I saw they have only string.

推荐答案

简而言之:

使用 Rabbitmq 您可以发送缓冲区,您可以根据自己的喜好创建缓冲区,例如:

with Rabbitmq you can send a buffer, you can create the buffer as you prefer, for example:

byte[] messageBodyBytes = ByteBuffer.allocate(4).putInt(yourint).array();
channel.basicPublish(exchangeName, routingKey, null, messageBodyBytes);

如果你想发送一个java类,你可以使用JSON格式对其进行序列化.

if you want to send a java class, you can serialize it using JSON format.

长:

您应该在这里阅读 amqp 协议规范:https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf

You sholud read the amqp protocol specification here : https://www.rabbitmq.com/resources/specs/amqp0-9-1.pdf

这篇关于RabbitMQ 支持的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆