amqp / rhea-promise

A promisified layer over rhea AMQP client
Apache License 2.0
30 stars 19 forks source link

Unable to receive an AMQP from Java emitted from rhea #70

Closed loicmathieu closed 3 years ago

loicmathieu commented 4 years ago

Describe the bug I have a component based on rhea-promise that sends AMQP messages. I want those messages to be received by a Java component.

Here is how I send a message with rhea-promise.

    async sendUserDoc(user:User): Promise<void> {
        const message: Message = {
            content_type: "application/json",
            durable: true,
            body: JSON.stringify(user)
        };
        await this.sendMessage(message, this.userDocSenderOptions);
    }

    private async sendMessage(message: Message, senderOptions: SenderOptions): Promise<void> {
        const connection: Connection = new Connection(this.connectionOptions);
        await connection.open();
        const sender: Sender = await connection.createSender(senderOptions);
        const delivery: Delivery = sender.send(message);
        await sender.close();
        await connection.close();
    }

I can successfully receive the same message in my Java component if send from a Java component.

I check the messages using JMSToolbox and the message contents are the same, the AMQP headers are the same except ORIGINAL_ENCODING that has the value 2 when the message is sent from my Java component and 5 when send from rhea-promise.

So, I suspect the cause of the issue is that my Java component and rhea-promise didn't handle the same way the ORIGINAL_ENCODING AMQP property.

Is there a way to fix this value to 5 ?

I also try to directly send my user object but then the ORIGINAL_ENCODING property has the value 7 and it didn't work either.

Package-version: node.js version: v10.19.0 OS name and version: Linux 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

ramya-rao-a commented 3 years ago

Hey @loicmathieu

This package is simply a wrapper over rhea providing promise versions of the APIs exposed in rhea.

Can you share more on what this ORIGINAL_ENCODING is? I don't see any such AMQP property being set in either this package or rhea.

Also, from what you have explained above, the issue seems to be around encoding which is done in rhea. I would recommend moving this issue to https://github.com/amqp/rhea

loicmathieu commented 3 years ago

@ramya-rao-a I no longuer use this package as I move to a different projet. I agree the issue is on rhea side. As I no longuer need this, I'll close the issue.