glats/handler

This module provides a subscription handler that can be used to subscribe to NATS subjects and receive them in your own handler.

Types

Callback handler that should be provided to glats to process the received messages from a subscription.

pub type MessageHandler =
  fn(Message, Subject(Command)) -> Result(Nil, String)

Functions

pub fn handle_subscription(conn: Subject(Command), subject: String, handler: fn(
    Message,
    Subject(Command),
  ) -> Result(Nil, String)) -> Result(
  Subject(Message),
  StartError,
)

Starts an actor that will handle receiving messages from a NATS subject and call your handler.

Search Document