Channel

Models a communication channel between two Components.

With the channel the components can communicate with each other via the sendToComponent and receiveFromComponent methods. The channel is set up by the channelSetup method and can change its operation mode with the setMode method. The communication Mode defines if the communication should occur locally or remotely.

Properties

Link copied to clipboard
abstract val di: DI
Link copied to clipboard
open val diContext: DIContext<*>
Link copied to clipboard
open val diTrigger: DITrigger?

Functions

Link copied to clipboard
abstract suspend fun channelSetup(source: ComponentRef, destination: ComponentRef): Either<CommunicatorError, Unit>

Sets up the communication between the given source and destination components.

Link copied to clipboard
abstract suspend fun finalize(): Either<Nothing, Unit>

Asynchronously finalizes the entity. Can Either succeed or fail with an Error.

Link copied to clipboard
abstract suspend fun initialize(): Either<Nothing, Unit>

Asynchronously initializes the entity. Can Either succeed or fail with an Error.

Link copied to clipboard
abstract suspend fun receiveFromComponent(): Either<CommunicatorError, Flow<ByteArray>>

Receives messages from the component.

Link copied to clipboard
abstract suspend fun sendToComponent(message: ByteArray): Either<CommunicatorError, Unit>

Sends a message to the component.

Link copied to clipboard
abstract fun setMode(mode: Mode)

Sets the communication mode of the communicator.

Link copied to clipboard
abstract fun setupInjector(kodein: DI)

Configures the module of the dependency injection module that the resource will use.