It's like a humans conversation interface, but for the digital world.
At my previous company, we were talking about few Java developers that they have a "heavy interface" -> meaning "they are not most communicative, and close to a cave man"
- Do you like when people call you
Mr/Mrs/Miss/Sir
? - What is your pronoun?
- Do you care about your titles, should we say
doctor
orprofessor
- Are you in the mood for a talk?
- Do you like to start with small talk?
Wouldn't it be nice to have it documented and publicly available? Oh wait -> Solid Project
Good real-life example is the dyplomatic protocol
- New mission establishment
- Credentials handover
- Appointing new representatives
Example protocol implementation is the United Nations manual of protocol.
On technical side: It is a set of rules that describe how information is transmited.
HTTP protocol on example of AsyncAPI website :
- HTTP protocol:
- Async-related protocols:
Q: Why do you do event-driven API, is REST API not enough?
A1: Because I want to know what is happening in real-time without asking for an update constantly.
OR
A2: When you send a message, and definitely do not expect a response.
there are many other patterns: Messaging Patterns
Just look at the browser and mouseover
event:
Microservices brought event-driven into renesance
.
Serverless puts it to the moon.
amqp, http, ibmmq, jms, kafka, anypointmq, mqtt, solace, stomp, websocket, mercure
- Most complex to document because of different protocols
- Not widely visible as REST API
- Programmableweb - 24,471 (Async APIs around 170)
- RapidAPI - Thousands!
- APIs Guru - 2,529 OpenAPI examples!
- APITracker - 7 AsyncAPI examples...
- REMEMBER: spec is not all you need
These two perspectives cause some headache in AsyncAPI
- Clients & Server
graph TD server1[Server -> ws://flypoland.pl/travel/status] user1[Client -> Browser] user1 --> server1 user2[Client -> Mobile] user2 --> server1
- Producers, consumers and message broker in the middle ->
fire and forget
Step 1graph TD NotificationSubscribeUI[Subscribe-Me-For-Flight-Status UI] NotificationSubscribeUI -- HTTP POST --> FlightSubscriberService
graph TD server1{mqtt://flypoland.pl:1883} NotificationSubscribeUI[Subscribe-Me-For-Flight-Status UI] NotificationSubscribeUI -- HTTP POST --> FlightSubscriberService FlightSubscriberService[Flight Subscriber Service] FlightSubscriberService -- flight/queue --> server1
graph TD server1{mqtt://flypoland.pl:1883} NotificationSubscribeUI[Subscribe-Me-For-Flight-Status UI] FlightMonitorService[Flight Monitor Service] NotificationSubscribeUI -- HTTP POST --> FlightSubscriberService FlightMonitorService -- flight/status --> server1 FlightSubscriberService[Flight Subscriber Service] FlightSubscriberService -- flight/queue --> server1 server1 -- flight/queue --> FlightMonitorService
graph TD server1{mqtt://flypoland.pl:1883} NotificationSubscribeUI[Subscribe-Me-For-Flight-Status UI] FlightMonitorService[Flight Monitor Service] NotificationSubscribeUI -- HTTP POST --> FlightSubscriberService FlightMonitorService -- flight/status --> server1 FlightNotifierService[User Notifier Service] server1 -- flight/status --> FlightNotifierService FlightSubscriberService[Flight Subscriber Service] FlightSubscriberService -- flight/queue --> server1 server1 -- flight/queue --> FlightMonitorService SMSService[External SMS Service] FlightNotifierService -- HTTP POST --> SMSService
graph TD NotificationSubscribeUI[Subscribe-Me-For-Flight-Status UI] NotificationSubscribeUI -- HTTP POST --> FlightSubscriberService subgraph EDA World FlightMonitorService[Flight Monitor Service] server1{mqtt://flypoland.pl:1883} FlightMonitorService -- flight/status --> server1 FlightNotifierService[User Notifier Service] server1 -- flight/status --> FlightNotifierService FlightSubscriberService[Flight Subscriber Service] FlightSubscriberService -- flight/queue --> server1 server1 -- flight/queue --> FlightMonitorService end SMSService[External SMS Service] FlightNotifierService -- HTTP POST --> SMSService