service-fabric-pub-sub
service-fabric-pub-sub copied to clipboard
Is it possible to specify a custom partition scheme?
I could only find this method in BrokerServiceLocator
that creates partition keys for connecting to the broker service:
https://github.com/SoCreate/service-fabric-pub-sub/blob/5b92715c64c5384f10fd532d4912f4cf5c1f8409/src/SoCreate.ServiceFabric.PubSub/Helpers/BrokerServiceLocator.cs#L160
Is it possible to specify a custom partition key, rather than partitioning based on the message Type
? This way we could scale based on the message subject/topic as opposed to the message type.
It doesn't currently support specifying a custom partition scheme, but that does sound like a useful feature. PR's are welcome if you want to implement it.
@danadesrosiers Thanks again, if we decide to use this in our current project I'll definitely submit a PR for this feature.
This feature is very attractive to me. I am trying to ball park the scope of work needed to implement it.
- A new DataMember "PartitionKey" would need to be added to MessageWrapper to partition on
- Update Broker Service to toggle between using PartitionKey and MessageType
- Update Subscribe Attributes to support PartitionKey and MessageType
- Other things I didn't think of?
Can you explain what you hope to get out of this feature? The most basic enhancement I can think of would be to update BrokerServiceLocator
to change private async Task<ServicePartitionKey> GetPartitionForMessageAsync(string messageTypeName)
to protected virtual
. That would allow the user to override it to specify which types to assign to which partition. Probably registering some kind of PartitionStrategy
with BrokerServiceLocator
would be a better pattern.
But that would not give you the ability to partition a single message type across multiple partitions. If you need that, I think it would be significantly more complex.
After talking with some coworkers I realize I was interested in the idea of "Named Queues" rather than changing the partition scheme. Sorry for the confusion please disregard the previous comment.