Conduit v0.12.10 Conduit.Plug behaviour View Source

Defines the plug behaviour.

Included Plugs

There are also many function plugs defined in Conduit.Plug.MessageActions which delegate to functions in Conduit.Message.

Custom Plugs

You can define your own plugs as a module or as a function. If you want to define a module plug, it should implement this behaviour. run/2 and __build__/2 can be tricky to build on your own, so it is usually better to use Conduit.Plug.Builder. This will give you default implementations of the callbacks. You can then override the callbacks you would like (probably call/3 or init/1). See the included plugs above for examples.

If you want to define a function plug, you must define a method that accepts three arguments. The message, the next plug to call, and a set of opts. Once you are done transforming the message, you should generally call next with the message unless you are halting the chain. See Conduit.Plug.MessageActions for examples.

Link to this section Summary

Link to this section Types

Link to this section Callbacks

Link to this callback __build__(next, opts) View Source
__build__(next(), opts()) :: next()