Packages
alternera_plugin_camel
0.9.0
Alternera's Camel step: calls Apache Camel routes on Camel plugin hosts the proxy runs, and takes messages from Camel as a source.
Current section
Files
Jump to
Current section
Files
alternera_plugin_camel
README.md
README.md
# alternera_plugin_camel
The Camel pipeline plugin (`Alternera.Plugins.Camel`): a step that
calls an Apache Camel route on a Camel plugin host the proxy runs. It is
built on the plugin hosts' runtime, `alternera_plugin_hosts`, and is
shipped: `PluginRegistry` lists it in `@shipped`, so every installation
installs it; where no host is configured, a Camel step has no host to
pick.
Whoever runs the proxy configures the hosts, under the package's own
application; each belongs to one tenant, named by its slug:
config :alternera_plugin_camel,
hosts: [
%{name: "erp", routes: ["file:…/*.yaml"], protocol: :http2, tenant: "acme",
pool: %{min: 0, max: 8, idle_minutes: 30},
variables: ["ERP_SCHEMA", "secret.ERP_PASSWORD"]}
]
`variables` names the tenant variables the host's routes read as
`{{ERP_SCHEMA}}` and `{{secret.ERP_PASSWORD}}`: the proxy sends their
values to each member before its hello, never in its environment, and
restarts the members when one is saved.
Each host is a pool of Camel hosts (defaults `min: 1, max: 4,
idle_minutes: 10`): `min` run always, more start up to `max` while every
one is busy, and one beyond `min` stops after `idle_minutes` without a
call. At `min: 0` nothing runs until a call, or the step editor, needs a
member, and that start comes out of the caller's deadline (see the
`PluginHosts` moduledoc); a host on a hot path keeps `min: 1` or runs the
native image. Each member opens its own database pools, so a data source
can hold `max` × its pool size connections.
The package's application starts a `PluginHosts.Supervisor` for the Camel
kind. The Camel host's code is the Java library in `host_runtime`
(`mvn install`); a host is a Maven project that depends on it and lists
its own components, and `plugin_host` is one to start from (`mvn
package`; see its README). `Plugins.Camel.HostSpec` builds a host's
command line. The step editor is `Plugins.Camel.Editor`.
The plugin also offers a source trigger's message source
(`Plugins.Camel.Source`, its `source/0`): a route on a host that serves
HTTP, ending at `alternera:source:<name>`, whose deliveries the trigger
pulls over the host's HTTP channel (RabbitMQ today; `host_runtime`'s
README). Its test against a real broker,
Alternera's `test/alternera/plugin_hosts/camel_source_test.exs`, is tagged
`:rabbitmq` and left out by default; its moduledoc says how to run it.
`test/` here checks the contract with the SDK's kit and runs the hosts'
`Host` and `Pool` against the built Camel host (`mvn package` first; the
JVM tests skip when it is not built). The internals section is
`docs/internals.adoc`.
## Licence
Licensed under the Apache License, Version 2.0 (`LICENSE`, `NOTICE`).
Alternera itself, the proxy this package plugs into, is under the Elastic
License 2.0.