-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Board Review: ServiceBus (Python and JavaScript) #1046
Comments
Scheduled for 3/6 |
Link to recording (MSFT INTERNAL): https://msit.microsoftstream.com/video/7ef3de47-5569-41d3-8f61-a42bbd758426 Notes from the review:
Topic: Diagnostics subnamespace
RECOMMENDATION: Let other languages stay as they are, and let javascript use a subnamespace in preview 1. User studies should investigate the experience Topic: Subscribe doesn't return a subscription
RECOMMENDATION: Keep this similar to EventHubs in functionality. Subscribe() should return some sort of closeable Topic: ContextWithSettlement deadletter overloads
ACTION: Feature team needs to reconcile differences Python review:
ACTION: Feature team to revisit connection lifecycle management
ACTION: Feature team to revisit decision for methods
RECOMMENDATION: It should be "get" Topic: Python is explicitly operating (complete()) on messages in iterator model.
ACTION: Python team to correct w.r.t consistency with other languages
ACTION: Feature team to sync on use case
ACTION: Feature team to sync with service team |
The Basics
About this client library
Artifacts required (per language)
Python
TypeScript
Champion Scenarios
Service Bus Client: Service Bus Receiver/Sender Client Proposal
The Service Bus client library offers two primary clients for sending and receiving messages, the ServiceBusSenderClient and ServiceBusReceiverClient respectively. Each designed for different operations but unified in their approach to provide a consistent experience for developers. These clients embrace a common design philosophy in providing developers an experience optimized around ease of use, familiar patterns, and a consistent API across them.
Both of the clients are designed to be user-friendly for someone who is new and does not know backend concept of Queue, Topics in details and also to some one who is coming from legacy concept of messaging.
Concepts
Namespace : A namespace is a scoping container for all messaging components. Multiple queues and topics can reside within a single namespace, and namespaces often serve as application containers.
Topics : You can also use topics to send messages. While a queue is often used for point-to-point communication, topics are useful in publish/subscribe scenarios. Enable an application to announce events to multiple interested consumers asynchronously.
https://docs.microsoft.com/en-us/azure/architecture/patterns/publisher-subscriber
Subscriptions : A subscriber to a topic can receive a copy of each message sent to that topic. Subscriptions are named entities.
Queue : Messages are sent to and received from queues. Queues store messages until the receiving application is available to receive and process them.
Enable multiple concurrent consumers to process messages received on the same messaging channel. This enables a system to process multiple messages concurrently to optimize throughput, to improve scalability and availability, and to balance the workload
https://docs.microsoft.com/en-us/azure/architecture/patterns/competing-consumers
Things to know before reading
• Some details not related to the high-level concept are not illustrated; the scope of this is limited to the high level shape and paradigms for the feature area.
Target segment: Regular , Middleware , DIY (Do it yourself) Developers
Regular Developers: Most of the developers write to Queue/Topic and read from Queue/Subscriptions. Their use case is simple but used a lot in production. For example Read one message, process it and go to next message.
Middleware Developers : These SDK writers who wrap Queue/ Topic in middle which are agnostic of server side concept or vendor agnostic. Their point of view is "send" or "receive".
DIY Developers: These are advance users who want to do everything on their own. For example message handling, exception handling, managing transactions etc.
Champion Scenarios
Scenarios 1 : Sender can send messages
A Real world existing application:
https://www.cloudamqp.com/blog/2017-09-25-breaking-down-a-monolithic-system-into-microservices.html
https://www.parkster.com/se/parking-with-parkster/
Parkster is company which provide solution for managing parking lots, payments, billing to large number of parking lots all over the world. Parkster started out with a monolithic architecture. They wanted to have their business model proven before they went further, so they started with one application which became monolithic . A monolithic application is where the whole application is built as a single unit. All code for a system is in a single codebase that is compiled together and produces a single system.
The biggest reason we moved from monolith to microservice were decoupling. Parkster’s move from a monolith architecture to a 15-20 microservice architecture. These multiple microservices communicating via message queues.
Once a parking spot is reserved by customer, One ReservationService will send a message to "ParkingLotManagerService" microservice using a queue.
ReservationService ------> ParkingLotManagementService
Message : (Spot 15) is reserved for 4 hours starting at 2 PM PST.
ReservationService has a guaranteed delivery to the queue.
Message sequence is not guaranteed unless queue is session enabled and client specify that.
The ParkingLotManagerService does not have to be online.
Exception case:
What if the receiver hangs/takes JUST long enough to not be able to renew before lock has expired and is claimed by another consumer? : Since the receiver did not renew lock before it expired, this message will be placed in queue and next customer can receive it.
Scenarios 2 : Receiver can receive messages
The ParkingLotManagerService should be able to receive messages asynchronously. The ParkingLotManagerService will receive one message at a time and update its system with start and end time for parking. It will also start a background timer which will inform other services when parking time slot expire.
Message Locking: While this message is being processed , no other thread/process can process this same message.
Receive And Delete: Sometime a receiver do not want to lock the message, It will receive a message and service delete this message from Queue.
Example :If we have "AverageCustomerPerDayService" which count how many customer uses parking lot on average everyday. It will increase count by one for each message and if it fails to do for few messages it wouldn't cause company a fortune.
Exception Cases
If receiver takes longer time to process, the lock will be released and which makes this message available .
What if receiver crashes before if complete the message, this message will be made available to other receiver for processing?
Scenarios 3 : Middleware can Send and Receive messages agnostic of Topic/Queue
Some companies build middleware products where user does not care about service concept of Queue and Topics. And user just care about sending to or receiving from "Messaging System" without knowing how it is implemented.
Scenario 1 and 2 list all features needed for this scenario.
Scenarios 4 : Publisher can publish message to a topic
For Example "Order service" publishes an order.
"Order # 101,Category=Book, Name:Programming Server Side by Jeffery Richter, Number of books = 2, Price = $100.00"
Topic Name = "ORDER_TOPIC"
Scenarios 5: Subscriber can subscribe to a topic
Topic Name = "ORDER_TOPIC"
Subscriber 1 Name = "User_Service Subscriber"
Subscriber 2 Name = "Price Service Subscriber"
Subscriber 3 Name = "Delivery Service Subscriber"
Subscriber 4 Name = "HeavyProduct Delivery Service Subscriber"
There could be more than one subscriber.
Each subscriber gets their own copy of message.
A filter could be applied on a message. For example
Subscriber 4 Name = "HeavyProduct Delivery Service SUBSCRIBER" Filter Rule = "Category == Appliance"
Above order will be received by first three subscriber but not by Subscriber 4 because it does not satisfy filter rule.
Other common uses cases for filter
Security : In some cases, we can restrict a subscriber to see one specific type of message.
Debugging : Some MS groups uses filter 1=1, to receive all the messages and determine why other subscriber are not receiving messages.
Scenarios 6 : Receiver can receive messages in sequence
A Real world existing application:
https://www.cloudamqp.com/blog/2017-09-25-breaking-down-a-monolithic-system-into-microservices.html
https://www.parkster.com/se/parking-with-parkster/
Once a parking spot is reserved by customer, ReservationService will send a message to ParkingLotManagerService using a queue. The customer changes mind with in few minutes and decide to cancel the reservation.
This scenario need FIFO which is only guaranteed when using sessions, since otherwise things would get messed up if we get the cancel message before the reserve message.
Lets say following is message sequence executed by consumer.
Message 1 : Spot 15 is reserved for 4 hours starting at 2 PM , Session ID ="SPOT-15"
Message 2 : Spot 15 reservation for 2 PM is cancelled, Session ID ="SPOT-15"
The ParkingLotManagerService will receive these message in sequence for Session ID ="SPOT-15".
Scenarios 7 : Receiver can receive messages in sequence for next available scenario
A Real world existing application:
https://www.cloudamqp.com/blog/2017-09-25-breaking-down-a-monolithic-system-into-microservices.html
https://www.parkster.com/se/parking-with-parkster/
Once a parking spot is reserved by customer, ReservationService will send a message to ParkingLotManagerService using a queue. There are multiple messages for different parking spots.
Lets say following is message sequence executed by consumer.
Message 1 : Spot 10 is reserved for 4 hours starting at 2 PM , Session ID ="SPOT-10"
Message 3 : Spot 15 reservation for 2 PM is cancelled, Session ID ="SPOT-15"
Message 2 : Spot 10 is extended for 2 more hours , Session ID ="SPOT-10"
Message 4 : Spot 15 reservation is cancelled , Session ID ="SPOT-15"
The ParkingLotManagerService request for "any" available session for processing
Service will pick next available session, for example Session ID ="SPOT-15".
Scenarios 8: Management Scenario
There are more operation which are management in nature.
Create Queue , Topic and Subscription
Add / Remove Rule/Filter
Note : No API are discussed for management scenario here but we noted them here as reference for completeness.
Agenda for the review
A board review is generally split into two parts, with additional meetings as required
Part 1 - Introducing the board to the service:
After part 1, you may schedule additional meetings with architects to refine the API and work on implementation.
Part 2 - the "GA" meeting
The text was updated successfully, but these errors were encountered: