Closed Guneet-commits closed 2 months ago
@Guneet-commits Can you provide more details on what broker/exchange you are working with?
@Guneet-commits If you are working with rabbitmq, their documentation (https://github.com/rabbitmq/rabbitmq-amqp1.0) could be more useful.
Looking at the "Routing and Addressing" section, I think if you want to publish to the "X"
exchange, then what you need to do is to create a sender to the target address "/exchange/"
, and then set the subject
field (https://docs.rs/fe2o3-amqp/latest/fe2o3_amqp/types/messaging/properties/struct.Builder.html#method.subject) of the message property (https://docs.rs/fe2o3-amqp/latest/fe2o3_amqp/types/messaging/properties/struct.Properties.html) to the name of the exchange "X"
.
Thanks alot @minghuaw , it worked by the following way : Setting my exchange_address = "/exchange/Relay1_HashMapData/"; Here /exchange is mandatory. I was trying the same thing but I was passing the values to application_properties. Is there some where I can the detailed documentation?
Is there some where I can the detailed documentation?
This really depends on the broker you are working with. There are some intricate differences in the way they use the protocol. If you are dealing with rabbitmq, then the official documentation mentioned above is probably your best chance. Other sources of documentation would be:
If you are ONLY dealing with rabbitmq, I'd recommend you opt in a dedicated AMQP 0.9.1 crate instead (like lapin https://crates.io/crates/lapin).
It was compulsory for me to use AMQP 1.0 but the issue is resolved now.... Thanks alot @minghuaw for the quick replies really appreciate it.
Would you mind closing this issue if you consider it resolved?
Hi @minghuaw, let exchange_address = "/exchange/Exchange1/RoutingKey"; let mut sender = Sender::builder() .name("rust-sender-link-1") .target(exchange_address) .attach(&mut session) .await .unwrap(); If I implement this, it works fine, but the issue is I have to publish to multiple routing keys say 30, so I'd have to create 30 senders which is not feasible, so is there a way through which i can just specify the exchange_name in exchange_address and then specify the routing key using some property of Sender::builder or Suppose i have 10 if else cases I could change the value of sender.target for each if else case without creating a new Sender.