Skip to content

Move away from Storage Queues#21

Merged
c-w merged 19 commits intomasterfrom
servicebus
Jun 16, 2018
Merged

Move away from Storage Queues#21
c-w merged 19 commits intomasterfrom
servicebus

Conversation

@c-w
Copy link
Member

@c-w c-w commented Jun 13, 2018

This change removes the use of Azure Storage Queues from the system. Instead, we now use Azure ServiceBus for the queuing mechanism.

This has several advantages. Notably, ServiceBus has a push-style API (via AMQP) and Storage Queues only expose a REST API. This means that to integrate with Storage Queues we had to periodically poll the REST API, check if there are new messages and then act on them. With ServiceBus, we can instead just define an event listener for incoming messages and act on them as they get pushed to the receiver via AMQP. This is neater in terms of code and also more efficient in terms of processing.

Note that the push-style API for ServiceBus is not available in the Python SDK so the queue listener is implemented in C#. The listener indefinitely waits for messages from ServiceBus and on receipt makes a request to a Python service running in the same pod which then acts on the message. All the previous queue processing jobs have thus been converted to HTTP endpoints so that the queue listener can easily interact with them.

The new separation of concerns also has a few incidental added benefits. For instance, the distinction between business logic (processing of the queue message) and action triggers (receipt of the queue message) is now very neat and clear. Additionally, we now have a unified interface for all the actions in the system: everything can be triggered via a simple HTTP call whereas previously we had a mix of Python HTTP endpoints and Python daemons. This new uniformity for example simplifies local testing.

The approach implemented by this change is similar to what I described in this article: https://medium.com/@clemens.wolff/using-the-ambassador-pattern-for-reliable-pipes-and-filters-text-processing-9ebbea8f82c4

There are also a few other changes included in this pull request including:

  • Connection strings are now stored in Docker secrets where previously they were stored in environment variables. The client code stays the same since there's a docker-entrypoint script that loads the secrets into environment variables at runtime.
  • Adding some new IDE folders to git-ignore and docker-ignore.
  • I was using some of the checked-in raw MIME emails for testing and was surprised that they didn't get processed by the system. This is because we only accept emails that are sent to a subdomain of lokole.ca, so I updated our test data to reflect that.

Resolves #16

@c-w c-w merged commit b26f15d into master Jun 16, 2018
@c-w c-w deleted the servicebus branch June 16, 2018 16:24
c-w added a commit that referenced this pull request Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant