I am using Service Fabric stateful services to store state about users in the system. My partitioning strategy is to use the normalized international string format phone number to address a named service instance, and the hash of the phone number to resolve a partition of that service. EX: fabric:/myapp/users/1/718 (where the international phone number is +1718xxxxxxx) This allows me to geo-locate services based on their country (and further in the US/Canada markets by area code).
My question is sort of theoretical, but also practical in nature. Who owns the logic for service resolution? A simple approach is to just require anyone taking a dependency on this service to know how its partitioned, but that feels like a leaky abstraction to me. Furthermore, I would like to assign an Id to the user which is divorced from the concept of a phone number.
I also, am open to entertaining the idea that partitioning users this way is a bad idea. However, using the phone is advisable for a number of reasons.
I'd recommend keeping any knowledge about partitioning away from your service consumers, if possible. This way you can change the service internals without changing anything at the consumer-side.
That leads to option 3, combined with the built-in reverse proxy service. In that extra service, you can look up the authenticated user and use its location to determine the service partition.
If you make it a new application, it can become the entrypoint (/proxy) for multiple bounded contexts
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.