# \[ANN\] GoAWS.jl

**URL:** <https://discourse.julialang.org/t/ann-goaws-jl/106578>\
**Category:** Package Announcements\
**Created:** [November 22, 2023, 2:47pm UTC](https://discourse.julialang.org/t/ann-goaws-jl/106578 "2023-11-22T14:47:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [November 22, 2023, 2:47pm UTC](https://discourse.julialang.org/t/ann-goaws-jl/106578/1 "2023-11-22T14:47:20Z")

</div>

[GoAWS.jl](https://github.com/beacon-biosignals/GoAWS.jl) wraps the go library [goaws](https://github.com/Admiral-Piett/goaws) to provide a clone of Amazon Web Services (AWS) SQS and SNS services. This facilitates testing and development of code interacting with these services without needing to spin up and authenticate to cloud resources.

SQS stands for Simple Queue Service, and provides a simple and robust message queue. For example, it can be used as a work queue, where one pushes messages describing the work to be done onto the queue, and workers can poll the queue to retrieve assignments.

Here is an example of using GoAWS.jl’s SQS features from the package’s README:

```julia
using AWS, GoAWS
@service SQS use_response_type = true

with_go_aws() do aws_config
    # Create the queue
    result = parse(SQS.create_queue("my_queue"; aws_config))
    queue_url = result["CreateQueueResult"]["QueueUrl"]

    # Send a message
    ret = parse(SQS.send_message("hello", queue_url; aws_config))
    id = ret["SendMessageResult"]["MessageId"]

    # Receive the message
    messages = parse(SQS.receive_message(queue_url, Dict("WaitTimeSeconds" => 1); aws_config))

    @test messages["ReceiveMessageResult"]["Message"]["Body"] == "hello"
    receipt = messages["ReceiveMessageResult"]["Message"]["ReceiptHandle"]
    @test startswith(receipt, id)

    # Delete the message to mark is as done
    SQS.delete_message(queue_url, receipt; aws_config)

    # Here we clean up by deleting the queue
    SQS.delete_queue(queue_url; aws_config)
end

```

This code spins up a GoAWS server on localhost and provides an `aws_config` to interact with it using AWS.jl. However one can also construct an [`GoAWSConfig()`](https://beacon-biosignals.github.io/GoAWS.jl/dev/#GoAWS.GoAWSConfig) directly, e.g. to communicate with a server spun up elsewhere (perhaps in a kubernetes namespace or docker-compose environment), or a GoAWS.jl server on another process.

I have not used SNS (via AWS or GoAWS), so I can’t comment on that.

The API and package code is based on @ExpandingMan’s [Minio.jl](https://expandingman.gitlab.io/Minio.jl/) which similarly provides a clone of AWS s3.

I chose `goaws` over other SQS clones because it [clearly describes the APIs it supports](https://github.com/Admiral-Piett/goaws#snssqs-api-status) (which includes the ones I need) and because go code is very simple to package into an JLL. So far it has been working well enough for my needs. I will call out two things I have noticed so far:

- [the default `goaws` config connects to a live SNS server](https://github.com/Admiral-Piett/goaws/blob/9aafff92436a6b4b387d7803cd75553fdf16c6cb/app/conf/goaws.yaml#L38) presumably for testing purposes. GoAWS.jl provides [it’s own default config](https://github.com/beacon-biosignals/GoAWS.jl/blob/main/src/default_config.yaml) which does not create any queues or connect to any SNS servers by default.
- Passing floating point values to `SQS.change_visibility_timeout` is not supported by AWS. If you do so with GoAWS, it does not provide a nice error, but rather obscure `go` panics. I have added this to a [troubleshooting](https://beacon-biosignals.github.io/GoAWS.jl/dev/#Troubleshooting-steps) section of the docs.

This code was developed at [Beacon Biosignals](https://beacon.bio/) and open-sourced today. It will be registered in General 3 days.
