A sidecar implementation built on top of go-sqs intended to provide HTTP Endpoints for sending messages to and receiving them from AWS-SQS queues, which can be called by the main application inside a pod.
docker run -p <host-port>:<gim-producer-port> \
-e GIMCONFIG=<config-string> \
-e AWS_ACCESS_KEY_ID='foo' \
-e AWS_SECRET_ACCESS_KEY='bar' \
engelmic/gim
Where <config-string>
contains the configuration for all consumer and producer as well as the logger. The config definition can be seen in pkg/config/gim.go and examples/config/sample.json contains an example configuration.
An example on how to use gim
as a sidecar can be seen here.
The consume routine of the gim sidecar
looks roughly like this:
- listen for and collect batches of messages in the queue
- forward each message to the application
- process the message
- the application responds either with status code
200
for successfully processing the message orany other status code
if it failed processing it - on status code
200
,gim
removes the message from the queue and, otherwise, leaves the message in the queue for re-consumption
The produce routine of the gim sidecar
looks roughly like this:
- the application sends a
POST /<name-of-producer>/produce
request togim
gim
pushes the message to the specified queue- on success,
gim
responds with status code201
and, otherwise, with500