Sathish Kumar k k
Sathish Kumar k k

Reputation: 1842

Data types supported by RabbitMQ

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.

Upvotes: 0

Views: 3633

Answers (3)

Basel Darvish
Basel Darvish

Reputation: 64

You can serialze any Java Object that implements Serializable interface.

Upvotes: 0

old_sound
old_sound

Reputation: 2313

You need to serialize/deserialize the data you want to send. Perhaps using JSON or XML or some other format that's convenient to your app

Upvotes: 2

Gabriele Santomaggio
Gabriele Santomaggio

Reputation: 22682

In short:

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);

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

Long:

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

Upvotes: 2

Related Questions