Skip to content

RpcEndpoint

RpcEndpoint is an abstraction of RPC endpoints that are registered to an RpcEnv to process one- (fire-and-forget) or two-way messages.

Contract

onConnected

onConnected(
  remoteAddress: RpcAddress): Unit

Invoked when RpcAddress is connected to the current node

Used when:

  • Inbox is requested to process a RemoteProcessConnected message

onDisconnected

onDisconnected(
  remoteAddress: RpcAddress): Unit

Used when:

  • Inbox is requested to process a RemoteProcessDisconnected message

onError

onError(
  cause: Throwable): Unit

Used when:

  • Inbox is requested to process a message that threw a NonFatal exception

onNetworkError

onNetworkError(
  cause: Throwable,
  remoteAddress: RpcAddress): Unit

Used when:

  • Inbox is requested to process a RemoteProcessConnectionError message

onStart

onStart(): Unit

Used when:

  • Inbox is requested to process an OnStart message

onStop

onStop(): Unit

Used when:

  • Inbox is requested to process an OnStop message

Processing One-Way Messages

receive: PartialFunction[Any, Unit]

Used when:

  • Inbox is requested to process an OneWayMessage message

Processing Two-Way Messages

receiveAndReply(
  context: RpcCallContext): PartialFunction[Any, Unit]

Used when:

  • Inbox is requested to process a RpcMessage message

RpcEnv

rpcEnv: RpcEnv

RpcEnv this RpcEndpoint is registered to

Implementations

  • AMEndpoint
  • IsolatedRpcEndpoint
  • MapOutputTrackerMasterEndpoint
  • OutputCommitCoordinatorEndpoint
  • RpcEndpointVerifier
  • ThreadSafeRpcEndpoint
  • WorkerWatcher

self

self: RpcEndpointRef

self requests the RpcEnv for the RpcEndpointRef of this RpcEndpoint.

self throws an IllegalArgumentException when the RpcEnv has not been initialized:

rpcEnv has not been initialized

Stopping RpcEndpoint

stop(): Unit

stop requests the RpcEnv to stop this RpcEndpoint