distribute/messaging

Types

Batch send result with error aggregation

pub type BatchSendResult {
  BatchSendResult(
    total: Int,
    successful: Int,
    failed: Int,
    errors: List(SendError),
  )
}

Constructors

  • BatchSendResult(
      total: Int,
      successful: Int,
      failed: Int,
      errors: List(SendError),
    )
pub type Pid
pub type SendError {
  NameNotFound(String)
  ProcessNotAlive
  NetworkError(String)
  InvalidMessage(String)
  SendFailed(String)
}

Constructors

  • NameNotFound(String)

    The globally registered name was not found.

  • ProcessNotAlive

    The target process is not alive.

  • NetworkError(String)

    Network connectivity issue.

  • InvalidMessage(String)

    Message is too large or invalid.

  • SendFailed(String)

    Sending the message failed for another reason.

Values

pub fn classify_send_error(
  reason: String,
  name: String,
) -> SendError

Classify error reason into structured SendError

pub fn classify_send_error_to_string(error: SendError) -> String

Convert SendError to string for logging

pub fn is_network_error(reason: String) -> Bool

Check if error is network-related

pub fn send(pid: Pid, msg: a) -> Nil

Send a message to a process (local or remote).

pub fn send_batch(
  messages: List(#(String, a)),
) -> BatchSendResult

Send multiple messages in batch with error aggregation Returns detailed results including all errors encountered

pub fn send_batch_strict(
  messages: List(#(String, a)),
) -> Result(Nil, SendError)

Send batch and return Ok only if all succeeded, Error with first failure otherwise

pub fn send_global(
  name: String,
  msg: a,
) -> Result(Nil, SendError)

Send a message to a globally registered name. Returns Ok(Nil) if successful, Error if name not found or send failed.

Search Document