'Producing/consuming web socket data to front end as well as other services - which Azure service to choose?
I'm trying to figure out which Azure service to use.
The idea is that there are multiple exchanges like Binance, Coinbase, FTX, etc., each one of them lives in its own process. They provide/publish/produce web socket data such as order book, ticker, user trades, trade history, etc. There will be several consumers/subscribers e.g. realtime frontend, live trader, backtest, etc.
In other words, I'm going to produce/publish objects of type such as Ticker, IEnumerable<UserTrades>, IEnumerable<OrderBook>, etc. The only communication between these exchanges, frontend, live traders and whatever, should be going through the stream.
This is what I've researched so far.
- Azure Event Grids – Event-driven publish-subscribe model (think reactive programming)
- Azure Event Hubs – Multiple source big data streaming pipeline (think telemetry data)
- Azure Service Bus- Traditional enterprise broker messaging system (replaces Azure Queue Storage)
- Web PubSub Service - not quite sure about this one
I am more inclined to the Azure Event Hubs. Keep in mind that I don't know what the last solution is used for. In addition, https://docs.microsoft.com/en-us/azure/architecture/example-scenario/banking/banking-system-cloud-transformation#components suggests Azure Event Hubs.
Event vs. message services
There's an important distinction to note between services that deliver an event and services that deliver a message.
Event
An event is a lightweight notification of a condition or a state change. The publisher of the event has no expectation about how the event is handled. The consumer of the event decides what to do with the notification. Events can be discrete units or part of a series.
Discrete events report state change and are actionable. To take the next step, the consumer only needs to know that something happened. The event data has information about what happened but doesn't have the data that triggered the event. For example, an event notifies consumers that a file was created. It may have general information about the file, but it doesn't have the file itself. Discrete events are ideal for serverless solutions that need to scale.
Series events report a condition and are analyzable. The events are time-ordered and interrelated. The consumer needs the sequenced series of events to analyze what happened.
Message
A message is raw data produced by a service to be consumed or stored elsewhere. The message contains the data that triggered the message pipeline. The publisher of the message has an expectation about how the consumer handles the message. A contract exists between the two sides. For example, the publisher sends a message with the raw data, and expects the consumer to create a file from that data and send a response when the work is done.
Comparison of those different services were also discussed, so be sure to check it out.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
