Reputation: 97
I have a scenario in which a stateless service will raise some short notes/events that I need to store in cache, and another service or listener will read those notes and process them.
Here is my approach: I will create a stateless service that will call a stateful API (this API will have an endpoints to AddInfo and GetInfo) to store the data in Reliable Services. And I will create another stateless service. This service will call the above API to get the Reliable Collection data, and I will implement my logic.
Is this the proper approach, or can you suggest anything else?
Upvotes: 0
Views: 325
Reputation: 963
The approach you have mentioned will work! And from the description you have mentioned, I am hoping that you can also use one stateless service to call the stateful API to achieve the operations you are trying to do.
You can use MyCustomHttpListener, it is a class that you have to create as your own custom listener that implements the ICommunicationListener. It contains the three methods that you need to override. See example here for an OwinCommunicationListener: Service Fabric Reliable Services Communication WebApi
Also, assuming that you are developing a ASP.NET Core Application and have gone through the below article earlier. But just in case, if you haven't gone through this before, this article will help you understand the stateless services and Stateful API in detail. https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-aspnetcore
Upvotes: 2