Scaling Streaming Consumption

Only one streaming consumer can receive business events on the Streaming API at any one time. If another streaming consumer connects and sends the "subscribe" request, the consumer receives a 4409 error.

For resilience, scale out the number of streaming consumers so that each streaming consumer:
  1. Connects to the Streaming API
  2. Sends the "init" request
  3. Sends the below request to query the connection:
    query {
      connection {
        id
        status
      }
    } 
The streaming consumer should only send the "subscribe" request if the response indicates the "status" is Inactive.