Mesh.Actors.VirtualTestActor (Mesh v0.1.4)

View Source

Simple test actor for benchmarks and testing.

This is a minimal actor that echoes back the payload it receives. Used internally for Mesh's own tests and benchmarks.

For production use, implement your own actor modules:

Example Custom Actor

defmodule MyApp.GameActor do
  use GenServer

  def start_link(actor_id) do
    GenServer.start_link(__MODULE__, actor_id)
  end

  @impl true
  def init(actor_id) do
    {:ok, %{id: actor_id, state: :ready}}
  end

  @impl true
  def handle_call(payload, _from, state) do
    # Your custom logic here
    {:reply, {:ok, :processed}, state}
  end
end

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(actor_name, initial_state \\ nil)