Skip to content

Commit

Permalink
Run multiple message consumers (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
webignition committed Nov 16, 2018
1 parent e81f588 commit c6b30aa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions docker/.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ ASYNC_HTTP_RETRIEVER_RABBITMQ_USER=guest
ASYNC_HTTP_RETRIEVER_RABBITMQ_PASS=guest
ASYNC_HTTP_RETRIEVER_RABBITMQ_MANAGEMENT_EXPOSED_PORT=15672
ASYNC_HTTP_RETRIEVER_EXPOSED_PORT=8001
ASYNC_HTTP_RETRIEVER_CONSUMER_COUNT=1
2 changes: 2 additions & 0 deletions docker/app-cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ ARG APP_ENV
ARG APP_SECRET
ARG CALLBACK_ALLOWED_HOSTS
ARG RETRIEVER_TIMEOUT_SECONDS
ARG CONSUMER_COUNT

ENV APP_SECRET=$APP_SECRET
ENV APP_ENV=$APP_ENV
ENV CALLBACK_ALLOWED_HOSTS=$CALLBACK_ALLOWED_HOSTS
ENV RETRIEVER_TIMEOUT_SECONDS=$RETRIEVER_TIMEOUT_SECONDS
ENV CONSUMER_COUNT=$CONSUMER_COUNT

RUN apt-get -qq update && apt-get install -qq -y librabbitmq-dev libssh-dev libmemcached-dev supervisor wget
RUN pecl -q install amqp
Expand Down
2 changes: 1 addition & 1 deletion docker/app-cli/supervisor/conf.d/app.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[program:async_http_retriever_messenger_consume_messages]
command = ./bin/console messenger:consume-messages
numprocs=1
numprocs=%(ENV_CONSUMER_COUNT)s
process_name = %(program_name)s-%(process_num)s
stopsignal=QUIT
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ services:
APP_SECRET: ${ASYNC_HTTP_RETRIEVER_APP_SECRET}
CALLBACK_ALLOWED_HOSTS: ${ASYNC_HTTP_RETRIEVER_CALLBACK_ALLOWED_HOSTS}
RETRIEVER_TIMEOUT_SECONDS: ${ASYNC_HTTP_RETRIEVER_RETRIEVER_TIMEOUT_SECONDS}
CONSUMER_COUNT: ${ASYNC_HTTP_RETRIEVER_CONSUMER_COUNT}
container_name: async-http-retriever-app-cli-${ID}
environment:
DATABASE_URL: mysql://${ASYNC_HTTP_RETRIEVER_DATABASE_USER}:${ASYNC_HTTP_RETRIEVER_DATABASE_PASSWORD}@mysql:3306/${ASYNC_HTTP_RETRIEVER_DATABASE_NAME}
Expand Down
3 changes: 3 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ Configuration You Can Optionally Set

Set these if you like, things will work just fine if you don't.

| ``ASYNC_HTTP_RETRIEVER_CONSUMER_COUNT``
| Number of parallel message consumers. Defaults to 1. Ideally set higher.
| ``ASYNC_HTTP_RETRIEVER_APP_SECRET``
| Private token used within the application. Set to whatever you like.
Expand Down

0 comments on commit c6b30aa

Please sign in to comment.