Package org.drasyl.loopback.handler
Class LoopbackMessageHandler
- java.lang.Object
-
- org.drasyl.pipeline.skeleton.HandlerAdapter
-
- org.drasyl.pipeline.skeleton.AddressHandlerAdapter<A>
-
- org.drasyl.pipeline.skeleton.SimpleOutboundHandler<ApplicationMessage,Address>
-
- org.drasyl.loopback.handler.LoopbackMessageHandler
-
- All Implemented Interfaces:
Handler
public class LoopbackMessageHandler extends SimpleOutboundHandler<ApplicationMessage,Address>
This handler converts outgoing messages addressed to the local node to incoming messages addressed to the local node.
-
-
Field Summary
Fields Modifier and Type Field Description static String
LOOPBACK_MESSAGE_HANDLER
-
Constructor Summary
Constructors Constructor Description LoopbackMessageHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
eventTriggered(HandlerContext ctx, Event event, CompletableFuture<Void> future)
Gets called if aEvent
was emitted.protected void
matchedWrite(HandlerContext ctx, Address recipient, ApplicationMessage msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleOutboundHandler
.-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleOutboundHandler
acceptOutbound, write
-
Methods inherited from class org.drasyl.pipeline.skeleton.AddressHandlerAdapter
acceptAddress
-
Methods inherited from class org.drasyl.pipeline.skeleton.HandlerAdapter
exceptionCaught, handlerAdded, handlerRemoved, read
-
-
-
-
Field Detail
-
LOOPBACK_MESSAGE_HANDLER
public static final String LOOPBACK_MESSAGE_HANDLER
- See Also:
- Constant Field Values
-
-
Method Detail
-
eventTriggered
public void eventTriggered(HandlerContext ctx, Event event, CompletableFuture<Void> future)
Description copied from interface:Handler
Gets called if aEvent
was emitted.- Specified by:
eventTriggered
in interfaceHandler
- Overrides:
eventTriggered
in classHandlerAdapter
- Parameters:
ctx
- handler contextevent
- the eventfuture
- a future for the message
-
matchedWrite
protected void matchedWrite(HandlerContext ctx, Address recipient, ApplicationMessage msg, CompletableFuture<Void> future)
Description copied from class:SimpleOutboundHandler
Is called for each message of typeSimpleOutboundHandler
.- Specified by:
matchedWrite
in classSimpleOutboundHandler<ApplicationMessage,Address>
- Parameters:
ctx
- handler contextrecipient
- the recipient of the messagemsg
- the messagefuture
- a future for the message
-
-