public interface RequestInterceptor extends Disposable
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 Operators.onErrorDropped(Throwable,
Context)
Disposable.Composite, Disposable.Swap
Modifier and Type | Method and Description |
---|---|
void |
onCancel(int streamId,
FrameType requestType)
Method which is being invoked once a successfully accepted request is cancelled.
|
void |
onReject(Throwable rejectionReason,
FrameType requestType,
ByteBuf metadata)
Method which is being invoked on the request rejection.
|
void |
onStart(int streamId,
FrameType requestType,
ByteBuf metadata)
Method which is being invoked on successful acceptance and start of a request.
|
void |
onTerminate(int streamId,
FrameType requestType,
Throwable t)
Method which is being invoked once a successfully accepted request is terminated.
|
dispose, isDisposed
void onStart(int streamId, FrameType requestType, @Nullable ByteBuf metadata)
streamId
- used for the requestrequestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
metadata
- taken from the initial framevoid onTerminate(int streamId, FrameType requestType, @Nullable Throwable t)
onStart(int, FrameType, ByteBuf)
method. This method is
exclusive with onCancel(int, FrameType)
.streamId
- used by this requestrequestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
t
- with which this finished has terminated. Must be one of the following signalsvoid onCancel(int streamId, FrameType requestType)
onStart(int, FrameType, ByteBuf)
method. This method is
exclusive with onTerminate(int, FrameType, Throwable)
.requestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
streamId
- used by this requestvoid onReject(Throwable rejectionReason, FrameType requestType, @Nullable ByteBuf metadata)
onStart(int, FrameType,
ByteBuf)
method. The reason for rejection can be one of the following:
rejectionReason
- exception which causes rejection of a particular requestrequestType
- of the request. Must be one of the following types FrameType.REQUEST_FNF
, FrameType.REQUEST_RESPONSE
, FrameType.REQUEST_STREAM
or FrameType.REQUEST_CHANNEL
metadata
- taken from the initial frame