Skip to content

Message Compatibility with AMQP 0.9.x #115

Closed
@luizcarlosfaria

Description

@luizcarlosfaria

Is your feature request related to a problem? Please describe.

Trying to publish with RabbitMQ.AMQP.Client 0.1.0 and 0.2.0-beta.0 and consume with regular RabbitMQ.Client, I've seen a prefix in message body.

How to produce the message:

 string text = JsonConvert.SerializeObject(message); //produces {"Text":"as","Seq":1,"Max":7000} 
 byte[] body = System.Text.Encoding.UTF8.GetBytes(text);
 IMessage amqpMessage = new AmqpMessage(body).ToAddress().Exchange(exchange).Key(routingKey).Build();
...
PublishResult result = await publisher.PublishAsync(message: amqpMessage, cancellationToken: cancellationToken).ConfigureAwait(configureAwait);

But when use Management to see what's is send (because consumers can't read this message) I've found some new behavior:

  1. Message is sent as base64 (on amqp 0.9.x i can see {"Text":"test","Seq":1,"Max":7000} , but with amqp 1x it's a base64 version AFN3oSB7IlRleHQiOiJhcyIsIlNlcSI6MSwiTWF4Ijo3MDAwfQ==
  2. When open this message a prefix cause add to body, you can see at https://dotnetfiddle.net/xd9qun

I've tryed to decode in some formats to understand:

Unicode (UTF-8): Sw� {"Text":"as","Seq":1,"Max":7000} 
Western European (ISO): Sw¡ {"Text":"as","Seq":1,"Max":7000} 
US-ASCII: Sw? {"Text":"as","Seq":1,"Max":7000} 
Unicode: 匀ꅷ笠吢硥≴∺獡Ⱒ匢煥㨢ⰱ䴢硡㨢〷〰� 
Unicode (Big-Endian): S瞡⁻≔數琢㨢慳∬≓敱∺ㄬ≍慸∺㜰〰� 
Unicode (UTF-8): Sw� {"Text":"as","Seq":1,"Max":7000} 
Unicode (UTF-7): Sw¡ {"Text":"as","Seq":1,"Max":7000} 

The base64 is easy to handle because the amqp message has type attribute.

But the prefix, I can't understand how handler

Describe the solution you'd like

  • Verify if this is a default behavior or a bug.
  • Explain how to handle this prefix (maybe defining a transport configuration).

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions