-
1. Re: Sending a single message from the server to multiple subjects, once?
navigateur Aug 16, 2012 11:53 AM (in response to navigateur)Can someone confirm if this can ever be technically possible with Errai or is already currently? Or am I missing a more obvious approach?
-
2. Re: Sending a single message from the server to multiple subjects, once?
jfuerth Aug 17, 2012 12:35 PM (in response to navigateur)The feature you describe (single message addressed to multiple subjects) is not available in Errai Bus. However, the inverse (single MessageCallback listening on multiple subjects) does work fine:
Say within the client, you have three subscribers on the Errai client message bus. We'll call them S1, S2, and S3.
S1 subscribes to subject A
S2 subscribes to subjects A and B
S3 subscribes to subjects A, B and C
When you send a message to subject C (either within the client or from the server), S3 within the client will receive that message (of course).
When you send a message to subject B, S2 and S3 will receive the message. Note that only one copy of the message went across the wire, even though S1 and S2 both received it.
Finally, a message to subject A will be delievered to all three subscribers.
So, instead of trying to send a single message to multiple destinations, if you can set up the subscribers to subscribe to the correct combination of subjects, you should be able to achieve the effect you're after.
Hope that helps.
Jonathan
-
3. Re: Sending a single message from the server to multiple subjects, once?
navigateur Aug 31, 2012 11:03 AM (in response to jfuerth)No I don't think it can work using multi-subject subscribe with single-subject publish. Please correct me if I'm wrong:
I've a new message, D, which must be connected to 3 known objects: A, B and C. If any of these exist on the client-side, D must be received and connected to them.
Client 1 has objects A and B. (So I subscribe to "A" and "B").
Client 2 has objects B and C. (So I subscribe to "B" and "C").
"A", "B" and "C" aren't related nor connected to one another in any way whatsoever, other than through the new message "D". It's impossible to predict the existence of "D", or which combination of objects it'll need to address, before it's created.
I can't think of any way to "invert" this scheme such that I can receive this new "D" message once on each client (which is all that is needed). I can only seem to receive it 3 times on each client, by sending it for each of the 3 objects it needs to address in succession, then filtering out the 2 repetitions in each case.
Am I wrong? If so, what's the answer? If I'm not wrong, then will this ever be technically possible with Errai? (My example is small, the real one may have greater numbers, thus delivering more superfluous messages).
-
4. Re: Sending a single message from the server to multiple subjects, once?
navigateur Aug 31, 2012 11:03 AM (in response to navigateur)Is this impossible?
-
5. Re: Sending a single message from the server to multiple subjects, once?
navigateur Sep 12, 2012 11:56 AM (in response to navigateur)Is this technically impossible? Will I always have to send the same message again for each subject (even though that's burdensome and seemingly unnecessary in clients subscribed to any more than one of them) in the scheme I described, regardless of any web technology?