I would like to bind an exchange to another exchange via a bash script (what I plan to use within a Dockerfile).
As simple code (like JS) it is fine, working perfectly, but I would like to use plain bash script for it, if it is possible.
The part of the JS code, what I would like to have but in bash:
// ...
await ch1.assertExchange('test-exchange', 'headers');
await ch1.assertExchange('another-exchange', 'headers');
await ch1.bindExchange('test-exchange', 'another-exchange','',{
'x-match':'all',
target: 'pay-flow'
});
// ...
When I run the JS code, then it is fine. I got the following results in RabbitMQ:
bash-5.1# rabbitmqadmin -u guest -p guest list bindings
+-----------------+-----------------------+-----------------------+
| source | destination | routing_key |
+-----------------+-----------------------+-----------------------+
| | test-queue | test-queue |
| test-exchange | test-queue | |
| test-exchange | another-exchange | |
+-----------------+-----------------------+-----------------------+
What I tried in bash:
#!/bin/bash
rabbitmqadmin -u guest -p guest declare binding source=test-exchange destination=another-exchange
Then I got the message of:
** Not found: /api/bindings/%2F/e/test-exchange/q/another-exchange
By the CLI/rabbitmqadmin documentation it seems, I am supposed to (or able only to) bind an exchange with a queue.
Anyone has any idea, how to solve it? (Maybe write the binder code in python and run it from the bash script?) Are there any kind of cli tool what capable to do it?