Peter
Peter

Reputation: 119

Microservice Architecture using RabbitMQ or SignalR

Migration from a Monolith to a Microservice architecture. I'm having a hard time understanding the architeture so I'd need your feedbacks on the questions asked below.

QUESTIONS:

Thank you.

Upvotes: 2

Views: 278

Answers (1)

Rouzbeh Zarandi
Rouzbeh Zarandi

Reputation: 1082

if you want use SIGNAL-R

  • the client request for the pdf to API-1
  • the API-1 service gather the require data from database and publish to the BUS channel (RabbitMQ channel) including the client-user identification data (as configured in signal-R) where the API two is listening to consume. at this point the client is acknowledged by response (the api and the client become idle and not waiting just ensure the event from here is fired).
  • the API-2 receives and consumes the event with data and generates pdf.
  • then api-2 after generating the pdf successfully calls signal-R service and trigger to send back the data to the client-user who requested or the signal-R notifies the client-user with error message.

I think SignalR shouldn't be used in this scenario as it's more to sendiing responses from server to multiple clients

no the signal-R is also used to send push notification to specific user with specific data. like notifications in any user-panel that could be notifies a group of users or specific user or chat application.

if you can persist pdf some where

  • the client request for the pdf to API-1
  • the API-1 service gather the require data from database and publish to the BUS channel (RabbitMQ channel) including the client-user identification data where the API two is listening to consume. at this point the client is acknowledged by response (the api and the client become idle and not waiting just ensure the event from here is fired).
  • the API-2 receives and consumes the event with data and generates pdf.
  • the API-2 may persist the pdf with appropriate data (meta data eg:user data)
  • user-client can check his panel (for example table of his pdfs) and download by requesting the api-2 who is now responsible for it (or any service)

if you can persist data some where

  • the client request for the pdf to API-1
  • the API-1 service gather the require data from database and publish to the BUS channel (RabbitMQ channel) including the client-user identification data where the API two is listening to consume. at this point the client is acknowledged by response (the api and the client become idle and not waiting just ensure the event from here is fired).
  • the API-2 receives and consumes the event with data and generates for example report DATA or any data that should be in the pdf.
  • the API-2 may persist the generated-data with appropriate meta data eg:user data
  • user-client can check his panel (for example table of his pdfs) request api-2 to get the appropriate generated-data and the the client-app itself will generate pdf from the given response data.

when it comes to event-driven base communication you have in mind that the fault may happen and you need to control it since the api one is already acknowledged and dont have any idea (SAGA).

Upvotes: 3

Related Questions