Zenohex.Examples.Publisher (Zenohex v0.9.1-beta.1)

Copy Markdown View Source

Example GenServer implementation of Publisher using Zenohex.Session.declare_publisher/3.

This example demonstrates how to publish.

For the actual implementation, please refer to the following,

Examples

iex> Zenohex.Examples.Publisher.start_link([])

Summary

Functions

Sends a Zenohex.Sample with kind: :delete.

Sends a Zenohex.Sample with kind: :put and the given payload.

Starts Elixir.Zenohex.Examples.Publisher.

Stops Elixir.Zenohex.Examples.Publisher

Functions

delete(name \\ __MODULE__)

@spec delete(GenServer.server()) :: :ok | {:error, reason :: term()}

Sends a Zenohex.Sample with kind: :delete.

put(name \\ __MODULE__, payload)

@spec put(GenServer.server(), binary()) :: :ok | {:error, reason :: term()}

Sends a Zenohex.Sample with kind: :put and the given payload.

start_link(args)

@spec start_link(
  session_id: Zenohex.Session.id(),
  key_expr: String.t(),
  name: GenServer.name()
) ::
  GenServer.on_start()

Starts Elixir.Zenohex.Examples.Publisher.

Parameters

  • args – a keyword list that can include the following keys:
    • :session_id – the ID of the session
    • :key_expr – the key expression to publish to

stop(name \\ __MODULE__)

@spec stop(GenServer.server()) :: :ok | {:error, reason :: term()}

Stops Elixir.Zenohex.Examples.Publisher