The Elixir SDK can be downloaded from Hex. Add it to your list of dependencies
in mix.exs:
# mix.exs
def deps do
[
{:inngest, "~> 0.2"},
{:finch, "~> 0.19"}
]
endThen run mix deps.get to download the package.
HTTP client
The SDK uses a small Inngest.HTTPClient behaviour for outbound HTTP. The
default adapter is Inngest.HTTPClient.Finch. Finch is an optional dependency
of the SDK, so applications using the default adapter should include it directly
and add a Finch process to their supervision tree:
children = [
{Finch, name: Inngest.Finch}
]To use a different Finch process name, configure the adapter options on your client:
children = [
{Finch, name: MyApp.InngestFinch}
]
defmodule MyApp.Inngest do
use Inngest.Client,
id: "my-app",
funcs: [MyApp.Function],
http_client_opts: [name: MyApp.InngestFinch]
endHackney is also available as a supported non-default adapter. Add it to your application dependencies before selecting it:
def deps do
[
{:inngest, "~> 0.2"},
{:hackney, "~> 1.25"}
]
enddefmodule MyApp.Inngest do
use Inngest.Client,
id: "my-app",
funcs: [MyApp.Function],
http_client: Inngest.HTTPClient.Hackney
endHackney does not require Finch supervision. It can also be configured globally:
config :inngest, http_client: Inngest.HTTPClient.HackneyFor custom HTTP clients, implement the behaviour and configure it on the first-class client:
defmodule MyApp.InngestHTTPClient do
@behaviour Inngest.HTTPClient
@impl true
def request(%Inngest.HTTPClient.Request{} = request) do
# Execute request.url with your preferred HTTP library and return:
{:ok,
%Inngest.HTTPClient.Response{
status: 200,
headers: [],
body: %{}
}}
end
end
defmodule MyApp.Inngest do
use Inngest.Client,
id: "my-app",
funcs: [MyApp.Function],
http_client: MyApp.InngestHTTPClient
endApplication config is still supported as a compatibility/test fallback:
config :inngest, http_client: MyApp.InngestHTTPClientIf you previously configured Tesla adapters, move that configuration into a
custom Inngest.HTTPClient implementation or switch to the built-in Finch or
Hackney adapters.