Re: [jgroups-users] v3->v4: my ReceiverAdapter methods are not being called

Questions/problems related to using JGroups <[email protected]> Tue, 7 Nov 2017 10:38:20 +0100
Newsgroups gmane.comp.java.javagroups.general
Message-ID <mailman.26024.1510047513.12861.javagroups-users@lists.sourceforge.net>

On 06/11/17 21:40, Questions/problems related to using JGroups wrote:
> On Mon, Nov 6, 2017 at 8:37 AM, Questions/problems related to using 
> JGroups <[email protected] 
> <mailto:[email protected]>> wrote:
> 
>     Your methods are never called because the MessageDispatcher catches
>     all of these messages!
> 
> 
> Thank you -- I definitely missed that in the docs and didn't expect it. 
> I have my view changes and state back!
> 
> So I've pulled my 'jChannel.setReceiver(this);' and have:
> 
>          jChannel = env.createJChannel(this);
>          dispatcher = new MessageDispatcher(jChannel, this);
>          dispatcher.setMembershipListener(this);
>          dispatcher.setStateListener(this);

Correct: the MessageDispatcher consumes all messages *before* they reach 
a registered Receiver. If you wanted both on the same channel, you'd 
have to use FORK and ForkChannels (see the manual for details).

> In v3, I was used to MD#castMessage going to handle() and JChannel#send 
> going to receive(). To be really clear, are you saying that, since we 
> have a MessageDispatcher, I should no longer use channel#send and should 
> convert those calls to use the MessageDispatcher?

Right. The MessageDispatcher trumps the Receiver, but fork channels (see 
above) would allow both to be on the same channel.

> And I don't need this I guess, right? (If so, what is this method for?)
> 
>          dispatcher.setRequestHandler(this);


This method is already called in the constructor of the 
MessageDispatcher (the 2nd arg).


> Thanks,
> Bobby
> 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> 
> 
> 
> _______________________________________________
> javagroups-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/javagroups-users
> 

-- 
Bela Ban | http://www.jgroups.org


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
javagroups-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/javagroups-users