Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TrueWodzu opened this issue Oct 11, 2024 · 0 comments
Open

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

TrueWodzu opened this issue Oct 11, 2024 · 0 comments

Comments

@TrueWodzu
Copy link

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);
			})
@TrueWodzu TrueWodzu changed the title How to set a boolean field in header? How to set a boolean field in a header? Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant