Is it possible to subscribe one topic in servicebus to another topic in same service bus.If possible how to achieve this functionality during runtime(through code). Thank you.
-
Do you want to chain a subscription to another topic that is part of the same namespace. If so, you could try to use the service bus `auto-forwarding` feature. Please refer to this [article](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-auto-forwarding). – Joey Cai Nov 15 '18 at 08:44
-
@JoeyCai,Yeah Joey working on it and subscription of one topic to another topic is working perfectly by using auto-forwarding feature.Thank you so much for the help.But still found some issues in some cases and trying to solve them – Mounika Nov 16 '18 at 09:47
3 Answers
If you want to send Messages from Topic A to Topic B Create a subscription under Topic A and forward all messages to Topic B.
:)
Hope this helps

- 383
- 4
- 14
As I have said, the Service Bus autoforwarding
feature enables you to chain a queue or subscription to another queue or topic that is part of the same namespace.
When autoforwarding
is enabled, Service Bus automatically removes messages that are placed in the first queue or subscription (source) and puts them in the second queue or topic (destination). It is still possible to send a message to the destination entity directly. Also, it is not possible to chain a subqueue, such as a deadletter queue, to another queue or topic.
You can enable autoforwarding by setting the SubscriptionDescription.ForwardTo properties on the SubscriptionDescription objects for the source, as in the following example:
SubscriptionDescription srcSubscription = new SubscriptionDescription (srcTopic, srcSubscriptionName);
srcSubscription.ForwardTo = destTopic;
namespaceManager.CreateSubscription(srcSubscription));
For more details, you could refer to this article.

- 18,968
- 1
- 20
- 30
You can forward the messages of your topic subscription to another topic using the Auto forward property. The messages from your main queue of your topic subscription can be forwarded to another topic using forwardTo property of your topic subscription. If you want to forward messages in your dead-letter sub queue of topic subscription , you can use forwardDeadLetteredMessagesTo property of topic subscription.
One limitation in setting the forwardTo property is that you can forward messages only to the queues and topics within the same namespace.To know more on autoforwarding refer here

- 333
- 2
- 12