Top Description Methods
io.rsocket.plugins

public Interface RequestInterceptor

extends Disposable
Known Direct Subinterfaces
io.rsocket.lease.TrackingLeaseSender
Known Direct Implementers
io.rsocket.loadbalance.WeightedStatsRequestInterceptor, io.rsocket.plugins.CompositeRequestInterceptor, io.rsocket.plugins.CompositeRequestInterceptor.SafeRequestInterceptor
Imports
io.netty.buffer.ByteBuf, io.rsocket.frame.FrameType, reactor.core.Disposable, reactor.util.annotation.Nullable, reactor.util.context.Context

Class used to track the RSocket requests lifecycles. The main difference and advantage of this interceptor compares to RSocketInterceptor is that it allows intercepting the initial and terminal phases on every individual request.

Note

, if any of the invocations will rise a runtime exception, this exception will be caught and be propagated to reactor.core.publisher.Operators#onErrorDropped(Throwable, Context)

Since
1.1

Method Summary

Modifier and TypeMethod and Description
public void
onCancel(int
used by this request
streamId
,
FrameType requestType)

Method which is being invoked once a successfully accepted request is cancelled.

public void
onReject(Throwable
exception which causes rejection of a particular request
rejectionReason
,
FrameType requestType, ByteBuf
taken from the initial frame
metadata
)

Method which is being invoked on the request rejection.

public void
onStart(int
used for the request
streamId
,
FrameType requestType, ByteBuf
taken from the initial frame
metadata
)

Method which is being invoked on successful acceptance and start of a request.

public void
onTerminate(int
used by this request
streamId
,
FrameType requestType, Throwable
with which this finished has terminated. Must be one of the following signals
t
)

Method which is being invoked once a successfully accepted request is terminated.

Inherited from reactor.core.Disposable:
disposeisDisposed

Method Detail

onCancelback to summary
public void onCancel(int streamId, FrameType requestType)

Method which is being invoked once a successfully accepted request is cancelled. This method can be invoked only after the onStart(int, FrameType, ByteBuf) method. This method is exclusive with onTerminate(int, FrameType, Throwable).

Parameters
streamId:int

used by this request

requestType:FrameType

of the request. Must be one of the following types FrameType#REQUEST_FNF, FrameType#REQUEST_RESPONSE, FrameType#REQUEST_STREAM or FrameType#REQUEST_CHANNEL

onRejectback to summary
public void onReject(Throwable rejectionReason, FrameType requestType, ByteBuf metadata)

Method which is being invoked on the request rejection. This method is being called only if the actual request can not be started and is called instead of the onStart(int, FrameType, ByteBuf) method. The reason for rejection can be one of the following:

  • No available io.rsocket.lease.Lease on the requester or the responder sides
  • Invalid io.rsocket.Payload size or format on the Requester side, so the request is being rejected before the actual streamId is generated
  • A second subscription on the ongoing Request
Parameters
rejectionReason:Throwable

exception which causes rejection of a particular request

requestType:FrameType

of the request. Must be one of the following types FrameType#REQUEST_FNF, FrameType#REQUEST_RESPONSE, FrameType#REQUEST_STREAM or FrameType#REQUEST_CHANNEL

metadata:ByteBuf

taken from the initial frame

onStartback to summary
public void onStart(int streamId, FrameType requestType, ByteBuf metadata)

Method which is being invoked on successful acceptance and start of a request.

Parameters
streamId:int

used for the request

requestType:FrameType

of the request. Must be one of the following types FrameType#REQUEST_FNF, FrameType#REQUEST_RESPONSE, FrameType#REQUEST_STREAM or FrameType#REQUEST_CHANNEL

metadata:ByteBuf

taken from the initial frame

onTerminateback to summary
public void onTerminate(int streamId, FrameType requestType, Throwable t)

Method which is being invoked once a successfully accepted request is terminated. This method can be invoked only after the onStart(int, FrameType, ByteBuf) method. This method is exclusive with onCancel(int, FrameType).

Parameters
streamId:int

used by this request

requestType:FrameType

of the request. Must be one of the following types FrameType#REQUEST_FNF, FrameType#REQUEST_RESPONSE, FrameType#REQUEST_STREAM or FrameType#REQUEST_CHANNEL

t:Throwable

with which this finished has terminated. Must be one of the following signals