This is an extension on RabbitMQ for Java: how to send multiple float values?
Instead of 3 float parameters, I want to send 3 different classes as parameters and I want to use the JSon protocol.
The server is written in C#. Hence I decode the JSon string method of the server side.
Basically the solution offered on the other post in terms of floats is as follows:
final ByteBuffer buf = ByteBuffer.allocate(12) // 3 floats
.putFloat(f1).putFloat(f2).putFloat(f3); // put them; .put*() return this
channel.basicPublish(buf.array()); // send
This will write the floats in big endian (default network order and what Java uses as well).
On the receiving side, you would do:
// delivery is a QueuingConsumer.Delivery
final ByteBuffer buf = ByteBuffer.wrap(delivery.getBody());
final float f1 = buf.getFloat();
final float f2 = buf.getFloat();
final float f3 = buf.getFloat();
but I want to send class Car, Airplane, Boat as JSon formatted from Java to C#