# alternera_plugin_sqs

[![CI](https://github.com/10e-ab/alternera-sqs/actions/workflows/ci.yml/badge.svg)](https://github.com/10e-ab/alternera-sqs/actions/workflows/ci.yml)

The Amazon SQS plugin for [Alternera](https://github.com/10e-ab/alternera)
pipelines: a step sends a message to an SQS queue, or receives, deletes or
releases messages, in SQS's JSON protocol, each call signed with AWS
Signature Version 4. Receiving runs from a message trigger (`Sqs.Source`,
an SQS queue as a message source), or from a pipeline a continuous trigger
runs. It works with any service that speaks SQS's JSON protocol.

The package builds on the plugin SDK and the editor contract
([alternera-sdk](https://github.com/10e-ab/alternera-sdk)) and calls nothing
of the proxy: the call goes through `Plugin.Provisional.Outbound` as a proxy
user of the tenant, and the secret access key is a tenant secret revealed
with `Plugin.Secret.reveal/3`. Alternera ships it: the proxy depends on it
and lists `Alternera.Plugins.Sqs` among its shipped plugins.

## Tests

`test/` checks the signer against the AWS SigV4 test-suite vectors, and the
contract and the calls with the SDK's kit, with no proxy around:

```bash
mix deps.get
mix test
```

Tagged `elasticmq`, a real round trip against ElasticMQ, left out by
default:

```bash
docker run -d --name alternera-elasticmq -p 9324:9324 softwaremill/elasticmq-native
mix test --only elasticmq
```

To test against an unreleased SDK, point `ALTERNERA_SDK_PATH` at an
absolute path to a checkout of alternera-sdk.

## Documentation

- `docs/sqs.md`: the user guide page, which the proxy serves as
  `plugin-sqs` (`use Alternera.Plugin, docs:`);
- `docs/guide.md`: the notes the proxy's assistant reads (`guide:`);
- `docs/internals.adoc`: the internals chapter, how the step, the client,
  the signer, the source and the editor work.

## Working on it with Alternera

Alternera takes this package from Hex. To change it and the proxy together,
check this repository out and point `ALTERNERA_SQS_PATH` at that checkout
(an absolute path) when building Alternera; it then takes the package from
there. Release this package first, then the Alternera change that requires
the new version.

## 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.
