Alternera.PluginHosts.Kind behaviour (alternera_plugin_hosts v0.9.0)

Copy Markdown View Source

A kind of plugin host: the plugin whose steps call hosts of that kind, which also configures them, builds their commands and claims their names. Plugins.Camel and Plugins.Command are the two. Every function of Alternera.PluginHosts takes the kind first, and each kind has its own hosts, registries (PluginHosts.registry/1), supervisor (PluginHosts.Supervisor) and host suffix, so two kinds may each have a host of the same name.

The kind's module also implements Plugin.Provisional.Upstream, whose upstream_suffix/0 names its hosts' HTTP channel (PluginHosts.Endpoint).

Summary

Callbacks

Whether the kind's hosts take documents a step writes (PluginHosts.Definition, the define frame): Camel's routes "written here". A host of such a kind takes them only when its entry has written_routes (PluginHosts.written_routes?/3).

The kind's name in log lines and messages: "Camel".

The Alternera.PluginHosts.Host.spec/0 of a configured entry, without the channel (:protocol, :tls_host), which PluginHosts adds.

The application whose environment holds the kind's hosts (config <app>, hosts: […]).

Whether the kind's hosts read their operations again in place on a reload frame (Host.reload/1). A kind without it reloads by a rolling restart (PluginHosts.reload/3).

Callbacks

definitions?()

(optional)
@callback definitions?() :: boolean()

Whether the kind's hosts take documents a step writes (PluginHosts.Definition, the define frame): Camel's routes "written here". A host of such a kind takes them only when its entry has written_routes (PluginHosts.written_routes?/3).

host_label()

@callback host_label() :: String.t()

The kind's name in log lines and messages: "Camel".

host_spec(entry)

@callback host_spec(entry :: map()) :: map()

The Alternera.PluginHosts.Host.spec/0 of a configured entry, without the channel (:protocol, :tls_host), which PluginHosts adds.

hosts_app()

@callback hosts_app() :: atom()

The application whose environment holds the kind's hosts (config <app>, hosts: […]).

reloads_in_place?()

(optional)
@callback reloads_in_place?() :: boolean()

Whether the kind's hosts read their operations again in place on a reload frame (Host.reload/1). A kind without it reloads by a rolling restart (PluginHosts.reload/3).