Sunday, April 8, 2012

RPC (Remote Procedure Call) with JGroups

JGroups forms a perfect medium for RPC between nodes in a cluster. Here, I share a very basic JGroups RPC example.

I think (at least, hope) the code is self-explanatory. A minor important point here is the RPC channel. Per see, I use ChannelFactory.getInstance().create() method to create the channel. ChannelFactory is a shortcut class to create multiple channels sharing the same transport. (See my Shared Transport in JGroups post for details.) That is, you need to have a separate JGroups channel reserved for RPC communication. All other messages sent/received using this channel will be consumed and ignored by the RpcDispatcher.

No comments:

Post a Comment