Skip to main content Link Search Menu Expand Document (external link)

Messenger overview

Added in v1.0.0


Table of contents


models

Messenger (interface)

An interface to communicate with a remote entity.

Signature

export interface Messenger<Msg extends Message.Message.Any> {
  /**
   * Send a message without waiting for a response (fire and forget)
   *
   * You can use Effect timeout to get send timeouts. The default behaviour is to send the message indifinetely
   *
   * @since 1.0.0
   */
  sendDiscard(entityId: string): (message: Msg) => Effect.Effect<void, ShardingException.ShardingException>

  /**
   * Send a message and wait for a response.
   *
   * You can use Effect timeout to get send timeouts. The default behaviour is to send the message indifinetely
   *
   * @since 1.0.0
   */
  send(
    entityId: string
  ): <A extends Msg>(
    message: A
  ) => Effect.Effect<Message.Message.Success<A>, ShardingException.ShardingException | Message.Message.Error<A>>
}

Added in v1.0.0