Package org.drasyl.pipeline
Interface HandlerContext
-
- All Known Implementing Classes:
AbstractEndHandler
,DefaultHandlerContext
public interface HandlerContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DrasylConfig
config()
CompletableFuture<Void>
fireEventTriggered(Event event, CompletableFuture<Void> future)
Received an event.HandlerContext
fireExceptionCaught(Exception cause)
Received anThrowable
in one of the inbound operations.CompletableFuture<Void>
fireRead(CompressedPublicKey sender, Object msg, CompletableFuture<Void> future)
Received a message.Handler
handler()
Identity
identity()
String
name()
Pipeline
pipeline()
io.reactivex.rxjava3.core.Scheduler
scheduler()
Implementation Note: This method should always return a scheduler, that differs from the normal pipeline scheduler.TypeValidator
validator()
CompletableFuture<Void>
write(CompressedPublicKey recipient, Object msg, CompletableFuture<Void> future)
Request to write a message via thisHandlerContext
through thePipeline
.
-
-
-
Method Detail
-
fireExceptionCaught
HandlerContext fireExceptionCaught(Exception cause)
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
CompletableFuture<Void> fireRead(CompressedPublicKey sender, Object msg, CompletableFuture<Void> future)
Received a message.This will result in having the
Handler.read(HandlerContext, CompressedPublicKey, 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
CompletableFuture<Void> fireEventTriggered(Event event, CompletableFuture<Void> future)
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
CompletableFuture<Void> write(CompressedPublicKey recipient, Object msg, CompletableFuture<Void> future)
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 corresponding
DrasylConfig
-
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 identity of this node
-
validator
TypeValidator validator()
- Returns:
- the type validator
-
-