Package org.drasyl.pipeline.handler
Class AddressedEnvelopeHandler
- 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,Event,O,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexHandler<AddressedEnvelope<?,?>,Object,CompressedPublicKey>
-
- org.drasyl.pipeline.handler.AddressedEnvelopeHandler
-
- All Implemented Interfaces:
Handler
public final class AddressedEnvelopeHandler extends SimpleDuplexHandler<AddressedEnvelope<?,?>,Object,CompressedPublicKey>
This handler wraps all outgoing messages in anAddressedEnvelope
. All incoming messages of theAddressedEnvelope
type are unwrapped.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ADDRESSED_ENVELOPE_HANDLER
static Handler
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
matchedRead(HandlerContext ctx, CompressedPublicKey sender, AddressedEnvelope<?,?> msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleInboundEventAwareHandler
.protected void
matchedWrite(HandlerContext ctx, CompressedPublicKey recipient, Object msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleDuplexEventAwareHandler
.-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexHandler
eventTriggered, matchedEventTriggered
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler
acceptOutbound, write
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler
acceptEvent, acceptInbound, read
-
Methods inherited from class org.drasyl.pipeline.skeleton.AddressHandlerAdapter
acceptAddress
-
Methods inherited from class org.drasyl.pipeline.skeleton.HandlerAdapter
exceptionCaught, handlerAdded, handlerRemoved
-
-
-
-
Field Detail
-
ADDRESSED_ENVELOPE_HANDLER
public static final String ADDRESSED_ENVELOPE_HANDLER
- See Also:
- Constant Field Values
-
INSTANCE
public static final Handler INSTANCE
-
-
Method Detail
-
matchedWrite
protected void matchedWrite(HandlerContext ctx, CompressedPublicKey recipient, Object msg, CompletableFuture<Void> future)
Description copied from class:SimpleDuplexEventAwareHandler
Is called for each message of typeSimpleDuplexEventAwareHandler
.- Specified by:
matchedWrite
in classSimpleDuplexEventAwareHandler<AddressedEnvelope<?,?>,Event,Object,CompressedPublicKey>
- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-
matchedRead
protected void matchedRead(HandlerContext ctx, CompressedPublicKey sender, AddressedEnvelope<?,?> msg, CompletableFuture<Void> future)
Description copied from class:SimpleInboundEventAwareHandler
Is called for each message of typeSimpleInboundEventAwareHandler
.- Specified by:
matchedRead
in classSimpleInboundEventAwareHandler<AddressedEnvelope<?,?>,Event,CompressedPublicKey>
- Parameters:
ctx
- handler contextsender
- the sender of the messagemsg
- the messagefuture
- the future of the message
-
-