https://www.enterpriseintegrationpatterns.com/patterns/messaging/DynamicRouter.html
I am working on implementing a mediator in Ballerina that serves as a dynamic router for incoming HTTP requests. The goal is to route these requests to the relevant service endpoint. I need to add new routings and remove existing routings during runtime.
Is Ballerina a suitable language for this task, and if so, could someone provide a basic code skeleton to get me started?
Let's imagine a scenario resembling a food delivery platform, let's call it "QuickBite Connect." In this use case, restaurants dynamically register their availability to serve food at various times. This registration involves notifying a mediator about their presence.
The communication pattern involves the restaurants signaling their presence to the mediator when they are available and announcing their sign-off when they are not. Now, when a user places an order through QuickBite Connect, the dynamic router will direct the order to the appropriate restaurant based on their current availability.