Class RpcChannel

  • All Implemented Interfaces:

    public class RpcChannel
    extends java.lang.Object
    implements ChannelListener
    A channel to handle RPC messaging
    • Constructor Detail

      • RpcChannel

        public RpcChannel​(byte[] rpcId,
                          Channel channel,
                          RpcCallback callback)
        Create an RPC channel. You can have several RPC channels attached to a group all separated out by the uniqueness
        rpcId - - the unique Id for this RPC group
        channel - Channel
        callback - RpcCallback
    • Method Detail

      • send

        public Response[] send​(Member[] destination,
                               int rpcOptions,
                               int channelOptions,
                               long timeout)
                        throws ChannelException
        Send a message and wait for the response.
        destination - Member[] - the destination for the message, and the members you request a reply from
        message - Serializable - the message you are sending out
        rpcOptions - int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
        channelOptions - channel sender options
        timeout - long - timeout in milliseconds, if no reply is received within this time null is returned
        Response[] - an array of response objects.
        ChannelException - Error sending message
      • messageReceived

        public void messageReceived​( msg,
                                    Member sender)
        Description copied from interface: ChannelListener
        Receive a message from the channel
        Specified by:
        messageReceived in interface ChannelListener
        msg - Serializable
        sender - - the source of the message
      • breakdown

        public void breakdown()
      • accept

        public boolean accept​( msg,
                              Member sender)
        Description copied from interface: ChannelListener
        Invoked by the channel to determine if the listener will process this message or not.
        Specified by:
        accept in interface ChannelListener
        msg - Serializable
        sender - Member
      • getChannel

        public Channel getChannel()
      • getRpcId

        public byte[] getRpcId()
      • setChannel

        public void setChannel​(Channel channel)
      • setCallback

        public void setCallback​(RpcCallback callback)
      • setRpcId

        public void setRpcId​(byte[] rpcId)
      • getReplyMessageOptions

        public int getReplyMessageOptions()
      • setReplyMessageOptions

        public void setReplyMessageOptions​(int replyMessageOptions)