service-fabric-pub-sub icon indicating copy to clipboard operation
service-fabric-pub-sub copied to clipboard

Publish to specific stateless instance

Open olivergrimes opened this issue 5 years ago • 3 comments

I had a look through the code and couldn't see how messages are published to specific stateless service instances. Is that possible with this library?

olivergrimes avatar Nov 21 '19 16:11 olivergrimes

I don't think that's possible with remoting. IServiceProxyFactory.CreateServiceProxy allows us to set the TargetReplicaSelector, but the only option for stateless services is RandomInstance. And that makes sense. I don't think you're ever supposed to interact with a specific instance when working with a stateless service. Perhaps you are looking for a partitioned stateful service?

danadesrosiers avatar Nov 21 '19 17:11 danadesrosiers

@danadesrosiers Thanks for the response. I asked as I'm currently using Actor Events to support messaging between back-end services and specific instances of a stateless service hosting SignalR.

https://github.com/olivergrimes/servicefabric-topicactor-signalr

I'm doing this to avoid the overhead of a standard backplane. The service-fabric-pub-sub documentation states that it supports stateless services, therefore I assumed there may have been another way to achieve what I ended up using Actor Events for.

olivergrimes avatar Nov 21 '19 17:11 olivergrimes

The library is designed to pass messages between different services, not different instances of the same service. One queue is created per partition, which will be just one for a stateless service. The message is published to a single instance at random. Sounds like it's not what you need, unfortunately.

danadesrosiers avatar Nov 21 '19 21:11 danadesrosiers