Crux vdev Crux.Base View Source

Crux "Base" module providing an example implementation of Crux.Gateway, Crux.Rest, and Crux.Cache while using Crux.Structs.

You can set as environment for :crux_base a token.
If the token is provided it will be forwarded to both Crux.Gateway and Crux.Rest.
Also this will fetch and put the gateway :url and recommended :shard_count if not already specified.

For task based cosuming you can use the provided Crux.Base.TaskConsumer and Crux.Base.ConsumerSupervisor modules.
You are also free to roll your own consumer / producer consumer setup by subscribing to the producers fetchable via Crux.Base.producers/0.

Link to this section Summary

Functions

Computes a map of all producers keyed by shard_id

Link to this section Functions

Link to this function

producers() View Source
producers() :: %{required(Crux.Base.Consumer.shard_id()) => pid() | :not_found}

Computes a map of all producers keyed by shard_id.

Values are either a pid/0 or, if for some reason the producer could not be found, :not_found.
Similar to Crux.Gateway.Connection.Producer.producers/0, but they are emitting Crux.Base.Consumer.event()s instead of raw discord api payloads.