Package org.drasyl.pipeline.skeleton
Class SimpleDuplexEventAwareHandler<I,E,O,A extends Address>
- java.lang.Object
-
- org.drasyl.pipeline.skeleton.HandlerAdapter
-
- org.drasyl.pipeline.skeleton.AddressHandlerAdapter<A>
-
- org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler<I,E,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler<I,E,O,A>
-
- All Implemented Interfaces:
Handler
- Direct Known Subclasses:
SimpleDuplexHandler
public abstract class SimpleDuplexEventAwareHandler<I,E,O,A extends Address> extends SimpleInboundEventAwareHandler<I,E,A>
HandlerAdapter
which allows to explicit only handle a specific type of messages and events.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleDuplexEventAwareHandler()
protected
SimpleDuplexEventAwareHandler(Class<? extends I> inboundMessageType, Class<? extends E> inboundEventType, Class<? extends O> outboundMessageType, Class<? extends A> addressType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
acceptOutbound(Object msg)
Returnstrue
if the given message should be handled.protected abstract void
matchedOutbound(HandlerContext ctx, A recipient, O msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleDuplexEventAwareHandler
.void
onOutbound(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future)
Gets called if aObject
was send from the application to a recipient.-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler
acceptEvent, acceptInbound, matchedEvent, matchedInbound, onEvent, onInbound
-
Methods inherited from class org.drasyl.pipeline.skeleton.AddressHandlerAdapter
acceptAddress
-
Methods inherited from class org.drasyl.pipeline.skeleton.HandlerAdapter
onAdded, onException, onRemoved
-
-
-
-
Method Detail
-
onOutbound
public void onOutbound(HandlerContext ctx, Address recipient, Object msg, CompletableFuture<Void> future) throws Exception
Description copied from interface:Handler
Gets called if aObject
was send from the application to a recipient.- Specified by:
onOutbound
in interfaceHandler
- Overrides:
onOutbound
in classHandlerAdapter
- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message- Throws:
Exception
-
acceptOutbound
protected boolean acceptOutbound(Object msg)
-
matchedOutbound
protected abstract void matchedOutbound(HandlerContext ctx, A recipient, O msg, CompletableFuture<Void> future) throws Exception
Is called for each message of typeSimpleDuplexEventAwareHandler
.- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message- Throws:
Exception
-
-