Sign inSign up

urbanstore/goconsumer

By urbanstore

Updated about 7 years ago

RabbitMQ consumer in Go for urbanstore

Image
0

10K+

urbanstore/goconsumer repository overview

The purpose is to subscribe to RabbitMQ and receive messages from there. This consumer lets us bind to a specific routingKey and get messages only for that routing key.

This image is builded with docker, so we can run tasks in other containers with exported - /var/run/docker.sock:/var/run/docker.sock:z

Configuration via ENV Variables

  • GC_AMQP - RabbitMQ address in format amqp://username:password@hostname:port/
  • GC_EXCHANGE - RabbitMQ exchange to use (main_exchange)
  • GC_EXEC_DOCKERCONTAINER - empty for standalone run or docker container name from which run command
  • GC_EXEC_COMMAND - command to run (php)
  • GC_EXEC_BOOTSTRAPPATH - first argument of command (path to php cli app)
  • GC_EXEC_ACTION - third argument of command (action argument of php cli app)
  • GC_ELASTICSEARCHURL - ElasticSearch address in format http://hostname:port

The idea

I based the consumer and developed the producer according to this tutorial.

I, as the tutorial says, made it possible to subscribe only to a subset of the messages. For example, now we can direct log messages to the log file or ElasticSearch, send e-mails, and add notifications through different rabbit queues, which is also helpful in the long run, as it maintains a level of asynchronous behaviour.

Here is a schema how the provider-queue-consumer should work:

a

Tag summary

Content type

Image

Digest

Size

476.5 MB

Last updated

about 7 years ago

docker pull urbanstore/goconsumer