Skip to content

How to set a boolean field in a header? #535

@TrueWodzu

Description

@TrueWodzu

Hello,

I am struggling to send in a header a custom field with value: true or false. Is there a support for simple boolean values?

Here is what I am trying:

	AMQP::MetaData metadata;
	AMQP::Table table;
	table.set("compressed", false);
	table.set("encrypted", true);
	metadata.setHeaders(table);

I see that the message with these custom fields has been send properly, but I couldn't find a way to get back these fields:

.onReceived([&channel, queue_name, this](const AMQP::Message &message, uint64_t deliveryTag, bool redelivered)
			{
				message.headers().get("compressed").isBoolean(); // Returns true
				message.headers().get("encrypted").isBoolean(); // Returns true
				auto a = message.headers().get("encrypted").operator int8_t(); // Returns 0 should return 1
				auto b = message.headers().get("compressed").operator int8_t(); // Returns 0
				
				channel.ack(deliveryTag);
			})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions