Package org.drasyl.pipeline
Interface HandlerContext
- All Known Implementing Classes:
DefaultHandlerContext
public interface HandlerContext
-
Method Summary
Modifier and TypeMethodDescriptionconfig()
Returns the correspondingDrasylConfig
.fireEventTriggered
(Event event, CompletableFuture<Void> future) Received an event.fireExceptionCaught
(Exception cause) Received anThrowable
in one of the inbound operations.fireRead
(Address sender, Object msg, CompletableFuture<Void> future) Received a message.handler()
Returns the associatedHandler
.identity()
Returns the identifier of this node.Returns the inbound type validator of this pipeline.name()
Returns the name of theHandler
.Returns the outbound type validator of this pipeline.pipeline()
Returns the correspondingPipeline
.io.reactivex.rxjava3.core.Scheduler
Implementation Note: This method should always return a scheduler, that differs from the normal pipeline scheduler.write
(Address recipient, Object msg, CompletableFuture<Void> future) Request to write a message via thisHandlerContext
through thePipeline
.
-
Method Details
-
name
String name()Returns the name of theHandler
.- Returns:
- the name of the
Handler
-
handler
Handler handler()Returns the associatedHandler
.- Returns:
- the associated
Handler
-
fireExceptionCaught
Received anThrowable
in one of the inbound operations.This will result in having the
Handler.exceptionCaught(HandlerContext, Exception)
method called of the nextHandler
contained in thePipeline
.- Parameters:
cause
- the cause
-
fireRead
Received a message.This will result in having the
Handler.read(HandlerContext, Address, Object, CompletableFuture)
method called of the nextHandler
contained in thePipeline
.- Parameters:
sender
- the sender of the messagemsg
- the messagefuture
- the future of the message
-
fireEventTriggered
Received an event.This will result in having the
Handler.eventTriggered(HandlerContext, Event, CompletableFuture)
method called of the nextHandler
contained in thePipeline
.- Parameters:
event
- the eventfuture
- the future of the message
-
write
Request to write a message via thisHandlerContext
through thePipeline
.- Parameters:
recipient
- the recipient of the messagemsg
- the messagefuture
- the future of the message
-
config
DrasylConfig config()Returns the correspondingDrasylConfig
.- Returns:
- the corresponding
DrasylConfig
-
pipeline
Pipeline pipeline()Returns the correspondingPipeline
.- Returns:
- the corresponding
Pipeline
-
scheduler
io.reactivex.rxjava3.core.Scheduler scheduler()Implementation Note: This method should always return a scheduler, that differs from the normal pipeline scheduler. E.g. theDrasylScheduler.getInstanceHeavy()
- Returns:
- the corresponding
Scheduler
-
identity
Identity identity()Returns the identifier of this node.- Returns:
- the identity of this node
-
inboundValidator
TypeValidator inboundValidator()Returns the inbound type validator of this pipeline.- Returns:
- the inbound type validator
-
outboundValidator
TypeValidator outboundValidator()Returns the outbound type validator of this pipeline.- Returns:
- the outbound type validator
-