Multiple Nodes for Event Hub


You can run multiple publishers having the same name. A typical example is the M3 publisher. In M3 you run several subsystems in separate JVMs. Each subsystem (JVM) contains its own M3 publisher instance. All M3 publishers can post events to the Event Hub simultaneously.


You can also run multiple subscribers having the same name. However, whereas multiple publisher instances having the same name will post events to the Event Hub simultaneously, the Event Hub will send events to multiple subscribers having the same name one at a time. A subscriber node needs to return true before the next event is sent to another or the same subscriber node. If you have multiple subscribers, an event will be once to each subscriber.


When a subscriber is registered, its subscriptions are sent to the Event Hub. When several subscriber instances having the same name are registered, all instances will send their respective subscriptions to the Event Hub. This will work if all subscriber instances are set up to use exactly the same subscriptions. However, if the different subscriber instances, all having the same name, use different subscriptions, the subscriptions for the latest registered subscriber will be used for all subscriber instances. This behavior may be changed in future releases of the Event Hub so that there will only be one "master" subscriber instance (the first). The proper way to use this functionality is to use the same subscriptions for all subscriber instances having the same name.

If you need to alter the subscriptions after the subscribers are registered, you can do so using the Subscriber.add(Subscription subscription), Subscriber.remove(Subscription subscription), or Subscriber.replaceAll(List<Subscription> subscriptions) on any subscriber instance. You do not need to do this for every subscriber instance. Be sure to use the updated set of subscriptions for additional subscriber instances though. Remember that the Event Hub only "sees" one subscriber with one set of subscriptions.