Using Azure Event Grid for event-based communication between microservices - microservices

I'm looking to implement a event-based communication pattern between my microservices and I'm looking to use Azure Service Bus to handle the messaging. In the examples I've seen so far (e.g. Microsoft's eShopOnContainers) the events are handled by a common library that handles the event subscription/publishing. I'm wondering if the common library could be replaced with Azure's Event Grid service (I realise this could generate an opinion-based answer, so please remove this question if it is deemed so)?
I like how Event Grid has retry capabilities, receives events from Azure Service Bus, push-like functionality (meaning my microservice doesn't need to poll), as well as other features, so in my mind it seems like a good fit. However, I'm fairly new to the event-based communication concept so I'm well aware I could be missing something.
If Azure Event Grid could be used to handle the events, is it possible to send the event to a Web Api endpoint? Once again, the examples I've seen so far all send the event to a Azure Function trigger, but I'm not planning on using any Azure Functions for my microservices.
If anyone had any examples they could point me to where Azure Service Bus and Event Grid were used for communication between microservices, that would be appreciated.

Related

Does MassTransit support Activity / ConsolidationId on Azure?

I'm using Application Insights (AI) to instrument my code. AI uses Activity to provide some data. Activity.ParentId can be used as a per-transaction identifier, across multiple services, so that a single API call can be tracked through the code, to the database and other HTTP services etc.
MassTransit has a message ConsolidationId, to track (I believe) Sagas, but I don't think it is using the Activity.ParentId.
Am I right?
How can I get MT to use the Activity.ParentId as a ConsolidationId, both as a publisher and consumer?
MassTransit supports Open Telemetry, which can easily be configured to push data to Azure Application Insights.
There is a complete sample that shows how to configure it.

How can we migrate from distributed services architecture to the MassTransit with less changes?

We have microservices architecture that the services are publishing (and also subscribing) events (+ a gateway api). And we want to start using MassTransit, since the system consist of services which are feeding each other with events to achieve the flow to the end..
Every services in the flow, are generally making some api calls to complete its mission for the events they received.
Looks like we should use MassTransit Courier in order to keep all the services as they are (with only adding consumers) and create a saga state machine as an orchestrator in the gateway api.
Is this a good approach? Or should we try something different?

Can Azure Service Bus topics be used as an event source or is there a better hosted service on Azure for this?

Can Azure Service Bus topics be used for event-sourcing?
At first sight it seem to be a good fit, but have anybody tried it? Can anybody confirm that keeping events forever in the Azure Service Bus topic is working well?
Or is there a better hosted service on Azure for this?
Do you mean in the sense of Event Sourcing?
Wouldn't recommend it. Service Bus has a maximum queue/topic size and is designed to be dequeued. Arguably you could design your replay logic as a dequeue-all and re-queue to retain the application state, but this is definitely not the intention of the product.
It also as far as I am aware has no notion of geographic replication, although the storage behind service bus itself is resilient within the data centre. For maximum redundancy I'd choose a storage technology that supports replication away from the primary data centre.
I'm also interested in that topic and from the outside it looks like Azure Event Hubs is the right service for that.

Realtime Notification Concepts

I want to create realtime notification
I dont want use node js
by the way I have ajax notification .
Its load 1s 1 time working Its right way
There are many ways to achieved real-time notification goal. One of the most famous and easy to use library for implementing more effectively notification scenario is SignalR.
According to Asp.net definition:
ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization.
See:
SignalR , SignalR.net

Event Aggregator for Distributed Applications

I am implementing an application using Prism.
The application has a few distributed components that resides on various machines or servers. In order to communicate them, I am planning to implement messaging service using Event Aggregator. But before I start working on that I would like to have a few clarifications:
Can Event Aggregator be used on a distributed environment. If yes
than how to define the server or hub where the message would be
published or subscribed?
What is the performance impact on the applications using Event
Aggregator? I feel it is negligible but still I would like to know.
Is Event Aggregator approach is good for future expansion in an
enterprise environment?
Thanks and Regards,
Ashish Sharma
PRISM is client-side technology. So, EventAggregator as it is won't do what you need. This is mechanism to communicate between modules in a loosely-coupled way. It is not about communicating between different clients.
For what you need - I would look into HTTP Polling Duplex
http://www.devproconnections.com/article/silverlight-40/using-http-polling-duplex-in-silverlight-applications
If you use PRISM on front end - you can write your own service and subscribe/publish EventAggregator events from that service while making server calls and receiving responses back.

Resources