Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure service fabric : IReliableQueue

I'm using azure service fabric for our new service.

For the client-facing gateway I have a stateless service getting request using a Web API endpoint, the actual work is done using reliable stateless actors.

As suggested by Sean McKenna - MSFT in this question, I put the incoming request in a ReliableQueue and storing the result in a ReliableDictionary.

I don't understand how to implement this, where do I define the ReliableQueue?? it is obvious(?) that enqueue a job will occur at the Web API controller, but where do i dequeue an object and when? there are no event firing telling me an object was added??

As you see I'll love some help on this

Thanks

like image 691
Kulpemovitz Avatar asked Jan 12 '16 11:01

Kulpemovitz


1 Answers

In the question you refer to, I am describing the pattern shown in the WordCount sample.

In that case, the application is made up of a stateless gateway service and a stateful processing service. The client input is sent to the stateless gateway, then relayed on to the stateful service, where it is initially persisted in a ReliableQueue. In parallel, there's an infinite while loop running inside the RunAsync method pulling items off of the queue and processing them, with the results being stored in a ReliableDictionary. This pattern is useful when you want to quickly ACK back to the client that you received (and safely persisted!) its input and can afford to perform the real processing asynchronously.

Note that if you intend to store your state in a ReliableQueue/ReliableDictionary, there probably isn't much value in doing the processing using a stateless actor. You'd be better off to just move that logic into a type within the stateful service and do the processing there as you will likely save yourself a network hop back and forth.

like image 60
Sean McKenna Avatar answered Sep 28 '22 14:09

Sean McKenna