Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evuez/exsozu
A resilient Elixir client for the Sōzu HTTP reverse proxy.
https://github.com/evuez/exsozu
Last synced: about 1 month ago
JSON representation
A resilient Elixir client for the Sōzu HTTP reverse proxy.
- Host: GitHub
- URL: https://github.com/evuez/exsozu
- Owner: evuez
- License: mit
- Created: 2017-07-20T16:44:42.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2020-11-20T08:36:46.000Z (about 4 years ago)
- Last Synced: 2024-10-09T09:51:46.519Z (about 1 month ago)
- Language: Elixir
- Homepage: https://hex.pm/packages/exsozu
- Size: 47.9 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ExSozu
[![CircleCI](https://circleci.com/gh/evuez/exsozu.svg?style=svg)](https://circleci.com/gh/evuez/exsozu)
A resilient Elixir client for the [Sōzu HTTP reverse proxy](https://github.com/sozu-proxy/sozu).
Answers are sent to the calling process via `Process.send/3` and should be handled in a `handle_info/2` or using `receive/1` (the messages are in this format: `{:answer, %ExSozu.Answer{}}`).
The documentation is available at [https://hexdocs.pm/exsozu](https://hexdocs.pm/exsozu).
## Installation
Add `exsozu` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:exsozu, "~> 0.4.0"}]
end
```## Examples
```elixir
iex> ExSozu.Command.list_workers() |> ExSozu.command()
iex> receive do: (m -> m)
{:answer,
%ExSozu.Answer{data: %{"data" => [%{"id" => 0, "pid" => 9,
"run_state" => "RUNNING"}], "type" => "WORKERS"}, id: "oA7iu2qVAL2JNkBg",
message: "", status: :ok}}
```Or, using `ExSozu.pipeline/1` to send multiple commands at once:
```elixir
iex> [ExSozu.Command.list_workers(), ExSozu.Command.status()] |> ExSozu.pipeline()
iex> receive do: (m -> m)
{:answer,
%ExSozu.Answer{data: %{"data" => [%{"id" => 0, "pid" => 9,
"run_state" => "RUNNING"}], "type" => "WORKERS"}, id: "...",
message: "", status: :ok}}
iex> receive do: (m -> m)
{:answer,
%ExSozu.Answer{data: nil,
id: "...",
message: "", status: :ok}}
```I also made a demo interface using ExSozu: [https://github.com/evuez/sozui](https://github.com/evuez/sozui).