Class AdhocDispatchInterceptor
java.lang.Object
io.fluxcapacitor.javaclient.publishing.AdhocDispatchInterceptor
- All Implemented Interfaces:
DispatchInterceptor
-
Field Summary
Fields inherited from interface io.fluxcapacitor.javaclient.publishing.DispatchInterceptor
noOp -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<? extends DispatchInterceptor>getAdhocInterceptor(MessageType messageType) interceptDispatch(Message message, MessageType messageType) Intercepts the publication of a message.modifySerializedMessage(SerializedMessage serializedMessage, Message message, MessageType messageType) Enables modification of theSerializedMessagebefore it is published.static voidrunWithAdhocInterceptor(Runnable task, DispatchInterceptor adhocInterceptor, MessageType... messageTypes) static <T> TrunWithAdhocInterceptor(Callable<T> task, DispatchInterceptor adhocInterceptor, MessageType... messageTypes) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.fluxcapacitor.javaclient.publishing.DispatchInterceptor
andThen
-
Constructor Details
-
AdhocDispatchInterceptor
public AdhocDispatchInterceptor()
-
-
Method Details
-
getAdhocInterceptor
-
runWithAdhocInterceptor
public static <T> T runWithAdhocInterceptor(Callable<T> task, DispatchInterceptor adhocInterceptor, MessageType... messageTypes) -
runWithAdhocInterceptor
public static void runWithAdhocInterceptor(Runnable task, DispatchInterceptor adhocInterceptor, MessageType... messageTypes) -
interceptDispatch
Description copied from interface:DispatchInterceptorIntercepts the publication of a message. Implementers can use this to modify the contents of a message or block the publication altogether.Return
nullor throw an exception to prevent publication of the message.- Specified by:
interceptDispatchin interfaceDispatchInterceptor
-
modifySerializedMessage
public SerializedMessage modifySerializedMessage(SerializedMessage serializedMessage, Message message, MessageType messageType) Description copied from interface:DispatchInterceptorEnables modification of theSerializedMessagebefore it is published.This method is typically invoked by message gateways right before publication of a message (so after
DispatchInterceptor.interceptDispatch(io.fluxcapacitor.javaclient.common.Message, io.fluxcapacitor.common.MessageType)is invoked).Although message publication is stopped when
nullis returned or an exception is thrown, it is preferable to useDispatchInterceptor.interceptDispatch(io.fluxcapacitor.javaclient.common.Message, io.fluxcapacitor.common.MessageType)for that.- Specified by:
modifySerializedMessagein interfaceDispatchInterceptor
-