Interface SideEffectService<Context>
-
- Type Parameters:
Context
- Context type.
- All Known Subinterfaces:
ConsumerService<Context>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface SideEffectService<Context> extends Service<Context,State>
Service implementation that alters the state of the owning application in some way. A SideEffectService does not return a generated result, instead it returns a response, indicating whether or not the context was consumed
-
-
Method Detail
-
handle
@NonNull State handle(@NonNull Context context) throws java.lang.Exception
Consumes the context, if possible. ReturnsState.ACCEPTED
if the input was consumed, elseState.REJECTED
- Specified by:
handle
in interfaceService<Context,State>
- Parameters:
context
- context used in the generation of the response- Returns:
- Response. If the response isn't
State.ACCEPTED
, the next service in the service chain will get to act on the context. Otherwise the execution halts, and the provided response is the final response. - Throws:
java.lang.Exception
- Any exception that occurs during the handling can be thrown, and will be wrapped by aPipelineException
-
-