-
Notifications
You must be signed in to change notification settings - Fork 0
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
Unable to deliver message to service bus subscription #11
Comments
I tried many times but service bus subscription is not receiving message. My question is how a sender knows where to send the message (in which subscription of topic) |
This is not how the If you want to target a specific receiver, you should be using Service Bus Queue instead of Service Bus Topic as explained here (https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions#topics-and-subscriptions).
However, you could apply a filter on a subscription consumer, and you could modify certain properties of a message so that it can only pass through the filter of the desired consumer. |
I will delete this issue once you consider it settled because you have pasted information (your connection string) that I consider confidential for you. |
I used the dummy values.. :). Thanks. |
So I have a service bus "topic" under which I have "subscription". How do I send a message to that particular subscription? |
Azure/azure-service-bus#366 . This diagram depicts the correct illustration. |
You send to the topic, and all subscriptions under that topic will get a copy of that message. You should use the topic name when you create the sender and use both the topic and subscription names when you create the receiver. If you are looking for a one-to-one mapping, a queue is what you are after not topic |
As shown in the diagram you quoted. You don't send to subscription directly. You send to the topic (by creating a sender to the topic), then all subscriptions under that topic will get the same message. Message filtering is handled on the subscription side, you could add filter rules on azure portal or in code following this example (https://github.com/minghuaw/azservicebus/blob/main/examples/manage_rules.rs) |
The difference between queue, and topic/subscription is better explained here (https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-queues-topics-subscriptions) |
Thanks for the explanation. Yes I do have a filter on subscription to receive/filter message, but still not receiving message. Below are the system properties key in Azure to filter out the message: 1. correlationID 2.contenType 3. label/subject 4. messageId 5.replyto 6.replytoSessionId 7.sessionId 8. to In Python I use to set the property "to" while sending message and on the Azure side I use to put filter on "to". How can I set the "to" property while sending the message to the topic? |
There is a built-in method that allows you to set the Something like this should work (not tested though) let mut message = ServiceBusMessage::from("hello world");
message.set_to(String::from("<subscription name>"));
sender.send_message(message).await.unwrap(); |
Thanks @minghuaw. This solved my problem. Also thanks for the prompt replies. |
Just one more little help. How do I set content type of the message. Can you give an example? |
Is the below code snippet correct ? let mut message = ServiceBusMessage::from("hello world"); |
I think all methods are documented on docs.rs (https://docs.rs/azservicebus/latest/azservicebus/index.html). The API mainly follows that of the dotnet SDK, so you could refer to the official tutorials written for the dotnet SDK and the look for the corresponding function in the rust SDK on docs.rs.
This should do. https://docs.rs/azservicebus/latest/azservicebus/primitives/service_bus_message/struct.ServiceBusMessage.html#method.set_content_type |
Looks right to me. One more note, if you want an empty message.set_to(None); That function takes anything that implements |
Got it thanks. |
I will refer to this one. Thanks @minghuaw. |
}
The text was updated successfully, but these errors were encountered: