Open Closed

configure multiple Topics and its subscription #10397


User avatar
0
Hon-Tre_IFS created

I have 3 topics and 3 subscriptions. how to configure in appsettings json. i want to configure in existing below format. { "Azure": { "ServiceBus": { "Connections": { "Default": { "ConnectionString": "Endpoint=sb://sb-my-app.servicebus.windows.net/;SharedAccessKeyName={{Policy Name}};SharedAccessKey={};EntityPath=marketing-consent" } } }, "EventBus": { "ConnectionName": "Default", "SubscriberName": "MySubscriberName", "TopicName": "MyTopicName" } } }


4 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • In ABP’s Azure Service Bus distributed event bus integration, the Azure:EventBus section represents a single topic + a single subscription name per application:

      • TopicName = the topic ABP publishes to / listens from
      • SubscriberName = the subscription name created/used under that topic for this application
    • Because of that, you can’t configure 3 topics + 3 subscriptions in the same Azure:EventBus section in appsettings.json in the “existing format”. ABP reads one TopicName and one SubscriberName.

    • What you should do instead:

      1. Pick one topic for your whole solution (recommended), e.g. MyApp.
      2. Configure one SubscriberName per microservice/app (each consumer app uses a different subscription under the same topic).
      3. If you truly must use multiple topics, you need separate applications/hosts with different Azure:EventBus configs (one per topic) or implement a custom event bus provider/routing (not supported via appsettings in the default provider).

    Example (recommended): single topic, 3 subscriptions (3 apps)

    • appsettings.json for ServiceA:
    {
      "Azure": {
        "ServiceBus": {
          "Connections": {
            "Default": {
              "ConnectionString": "Endpoint=sb://sb-my-app.servicebus.windows.net/;SharedAccessKeyName=...;SharedAccessKey=..."
            }
          }
        },
        "EventBus": {
          "ConnectionName": "Default",
          "TopicName": "MyApp",
          "SubscriberName": "ServiceA"
        }
      }
    }
    
    • appsettings.json for ServiceB:
    {
      "Azure": {
        "ServiceBus": {
          "Connections": {
            "Default": {
              "ConnectionString": "Endpoint=sb://sb-my-app.servicebus.windows.net/;SharedAccessKeyName=...;SharedAccessKey=..."
            }
          }
        },
        "EventBus": {
          "ConnectionName": "Default",
          "TopicName": "MyApp",
          "SubscriberName": "ServiceB"
        }
      }
    }
    
    • appsettings.json for ServiceC:
    {
      "Azure": {
        "ServiceBus": {
          "Connections": {
            "Default": {
              "ConnectionString": "Endpoint=sb://sb-my-app.servicebus.windows.net/;SharedAccessKeyName=...;SharedAccessKey=..."
            }
          }
        },
        "EventBus": {
          "ConnectionName": "Default",
          "TopicName": "MyApp",
          "SubscriberName": "ServiceC"
        }
      }
    }
    

    If you put EntityPath=... in the connection string: for topics/subscriptions, ABP already uses TopicName, so keep the connection string at the namespace level (no EntityPath) unless you have a specific reason.

    Link (verified): https://abp.io/docs/latest/framework/infrastructure/event-bus/distributed/azure


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    Hon-Tre_IFS created

    i would like to configure with one host app not multiple host app. so all my topic and subscription should be configure in same host app how to do it?

  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • With ABP’s built-in Azure Service Bus distributed event bus provider, a single host application can be configured with only one TopicName and one SubscriberName via Azure:EventBus (that config maps to one topic + one subscription for that app). There is no supported appsettings.json format to declare multiple topics/subscriptions for the same host using the default provider.

    • If you must use one host app and still consume from 3 topic/subscription pairs, you have only these viable options:

    1. Recommended ABP way: use 1 topic, 1 subscription, and let ABP route by event type

      • Put all events on one Azure Service Bus topic (e.g. MyApp).
      • Keep one subscription for the host (e.g. MyHost).
      • ABP already dispatches incoming messages to handlers based on event name/type; you don’t need separate topics per event group.
      • Config stays exactly like you already have (single topic/subscriber).
    2. If you strictly need 3 different topics: do it outside ABP EventBus

      • Keep ABP’s distributed event bus configured for one topic/subscription (or disable it if you won’t use it).
      • Then, for the other topics/subscriptions, use the raw Azure SDK (Azure.Messaging.ServiceBus) and create your own ServiceBusProcessor instances (one per topic/subscription) inside your host app.
      • This is not configurable “in the existing ABP Azure:EventBus format”; it’s custom code.

    Because option (2) requires custom code and ABP has no official “multiple topics per app” configuration for the Azure EventBus provider, the direct answer to “how to do it in the same host app via appsettings” is: you can’t with the default ABP Azure EventBus configuration.

    Link (validated): https://abp.io/docs/latest/framework/infrastructure/event-bus/distributed/azure


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Abp Azure event bus doesn't support multiple topics.

    https://github.com/abpframework/abp/issues/22424

    Thanks

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.2.0-preview. Updated on February 05, 2026, 13:24
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.