External shard allocation strategy via explicit requests

Hi,

I want to control the localion of my shards via explicit requests. My plan is on SelfUp of a Node I will tell the Shard coordinator to transfer shard-0 to this new node. I will probably compare the version of the Node to others with the same role in the cluster to detect that it has been upgraded. This way I can use shard-0 for canary testing in the new Node. Is the code below the call that I need to do?

val client: ExternalShardAllocationClient = ExternalShardAllocation(system).clientFor(TypeKey.name)
val done: Future[Done] = client.updateShardLocation("shard-id-0", Address("akka", "system", "127.0.0.1", 2552))

I will probably do something similar with the second new Node upgraded with the same role. However, past this I would like to use LeastShardAllocationStrategy. Say I have toal of 4 nodes of the role I am updating. After deploying 2 new nodes of this role I would like to revert to LeastShardAllocationStrategy. How do I do this when I am using ExternalShardAllocationStrategy?

The ExternalShardAllocationStrategy allocates shards to the node/ShardRegion that requested an unstarted shard if it has not explicitly been assigned a node. This is quite different from the normal location strategy.

If you want to combine and both explicitly assign and then use the LeastShardAllocationStrategy as a fallback you will currently have to implement such a composed strategy yourself.