0

For updates on a dashboard, I need to decide to make an extra api end point which creates a message in SignalR or let some kind of message broker (filewatcher1) do that. What would be good architecture?

Context
I've created an api which reads and updates data of an ERP. The ERP has its own client (UI) where users can update data as well. The api is used for dashboarding and some automated tasks where the client provides magnificent functionality to no need to replace that with the api. The ERP has the possibility to execute a script on each status update. In this case, the best is to create a file after each update (or delete, for that matter).

Updating data on the dashboards
Now instead of continuesly refreshing data by making api requests, I decided to use SignalR to let the dashboard listen to data changes. With the possibilities of the ERP, I've extended an already existing FileWatcher which processes files of the ERP or other business software (CAD/CAM).

ERP creates json on record update ==>
       FileWatcher processes file, does X ==>
                dashboards gets new data through SignalR.

What should X be?
I have some options:

  1. Make an api end point on an already existing controller for the filewatcher to make a request to. The api end point then retreives the updatet data and sends it to the SignalR Hub.
  2. Make the api end point, but let the SignalR hub retreive the data. So the api end point only tells the hub 'There is an update an record A' or 'Record B is deleted.'
  3. Let the filewatcher connect to the SignalR hub and notify it of the data change, the SignalR hub retreives the data as mention in point 2.

The advantage of point 1 or 2 is that once the api end point is created, notifying dashboards is easier than when every entitiy has to create a connection with the SignalR hub. But with point 3, the api remains more restful (does it?) and responsibilities more clear.

Any reading material is more than welcome.

1This could be a service inside the api as well.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.