Thank you very much!

It's very helpful

Best,

Nan

On Monday, November 3, 2014 3:48:06 PM UTC-5, Luis Medina wrote:
>
> Hey Nan,
>
> No problem.
>
> The cluster pub/sub is cluster-wide so I believe that messages sent 
> through it would reach all entries regardless of what shard they are in. 
>
> One other thing I forgot to mention is that you have to remember that 
> entry actors are created only when a message is sent to them which means 
> that in order for them to receive messages through the pub/sub mechanism, 
> they will need to already exist somewhere in the cluster (since the 
> subscribing logic would get executed at some point during its life-cycle, 
> most likely during initialization).
>
> Luis
>
> On Monday, November 3, 2014 12:43:30 PM UTC-8, Nan Zhu wrote:
>>
>> Thank you for the reply, Luis, 
>>
>> Another question is about is it possible to broadcast to all shards?
>>
>> Best,
>>
>> nAN
>>
>> On Monday, November 3, 2014 2:59:00 PM UTC-5, Luis Medina wrote:
>>>
>>> Hey Nan,
>>>
>>> There might be a couple of things that you can do here:
>>>
>>> 1. If you know the id's of all of your entries, then it would be a 
>>> matter of looping through these id's and sending each one the message 
>>> you're trying to broadcast:
>>>
>>> ie. in Java 8
>>>
>>>    1. ActorRef counterRegion = ClusterSharding.get(system).shardRegion(
>>>    "Foo");
>>>    2. 
>>>    3. List<String> entryIds = getEntryIds();
>>>    4. 
>>>    5. entryIds.forEach(id -> counterRegion.tell(new EnvelopeMessage(id, 
>>>    payload), getSelf()));
>>>
>>>
>>> 2. The alternative to this would be to use cluster pub/sub and have your 
>>> entry class subscribe to a particular topic. To broadcast you would simply 
>>> publish your message to the same topic.
>>>
>>> Luis
>>>
>>>
>>> On Monday, November 3, 2014 7:27:45 AM UTC-8, Nan Zhu wrote:
>>>>
>>>> Hi, all
>>>>
>>>> I have some questions about cluster sharding
>>>>
>>>> it seems that cluster sharding does not provide the ability to 
>>>> broadcast a particular message to all entries for a shard (other messages 
>>>> should be delivered to a specific entry)?
>>>>
>>>> In my use case, I need the auto sharding capacity provided by cluster 
>>>> sharding (especially move shard from one region to another for load 
>>>> balancing),
>>>>
>>>> my questions are 
>>>>
>>>> 1. is it possible to broadcast some of the messages to all entries in 
>>>> cluster sharding?
>>>>
>>>> 2. If the answer to 1 is not, what's the other pattern I can use to 
>>>> achieve both auto-sharding (with some manual implementation) and broadcast 
>>>> message to entries?
>>>>
>>>> Thank you very much!
>>>>
>>>> Best,
>>>>
>>>> Nan
>>>>
>>>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to