Conduit v0.7.0 Conduit.Plug behaviour

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.

Summary

Types

opts()
opts ::
  tuple |
  atom |
  integer |
  float |
  [opts] |
  map |
  (... -> any)

Callbacks

__build__(next, opts)
__build__(next, opts) :: next
call(arg0, next, opts)
init(opts)
init(opts) :: opts
run(arg0, opts)