Package org.drasyl.loopback.handler
Class InboundMessageGuard
- java.lang.Object
-
- org.drasyl.pipeline.skeleton.HandlerAdapter
-
- org.drasyl.pipeline.skeleton.AddressHandlerAdapter<A>
-
- org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler<I,Event,A>
-
- org.drasyl.pipeline.skeleton.SimpleInboundHandler<ApplicationMessage,Address>
-
- org.drasyl.loopback.handler.InboundMessageGuard
-
- All Implemented Interfaces:
Handler
public class InboundMessageGuard extends SimpleInboundHandler<ApplicationMessage,Address>
This handler filters incoming messages not addressed to the local node. If the node is not started, all messages will be rejected.
-
-
Field Summary
Fields Modifier and Type Field Description static String
INBOUND_MESSAGE_GUARD
-
Constructor Summary
Constructors Constructor Description InboundMessageGuard()
-
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
matchedRead(HandlerContext ctx, Address sender, ApplicationMessage msg, CompletableFuture<Void> future)
Is called for each message of typeSimpleInboundEventAwareHandler
.-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleInboundHandler
matchedEventTriggered
-
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, write
-
-
-
-
Field Detail
-
INBOUND_MESSAGE_GUARD
public static final String INBOUND_MESSAGE_GUARD
- 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 classSimpleInboundHandler<ApplicationMessage,Address>
- Parameters:
ctx
- handler contextevent
- the eventfuture
- a future for the message
-
matchedRead
protected void matchedRead(HandlerContext ctx, Address sender, ApplicationMessage msg, CompletableFuture<Void> future)
Description copied from class:SimpleInboundEventAwareHandler
Is called for each message of typeSimpleInboundEventAwareHandler
.- Specified by:
matchedRead
in classSimpleInboundEventAwareHandler<ApplicationMessage,Event,Address>
- Parameters:
ctx
- handler contextsender
- the sender of the messagemsg
- the messagefuture
- the future of the message
-
-