Skip to content

Commit

Permalink
Add example RabbitMQ configuration and user files
Browse files Browse the repository at this point in the history
This is (at time of commit) the current rabbitmq configuration being applied
at Diamond, and an example of the folder to use for user generation.

Addresses request in #181.
  • Loading branch information
ndevenish committed Sep 6, 2023
1 parent 5dffc9a commit 077b108
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 0 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Expand Up @@ -4,6 +4,7 @@ History

Unreleased
----------
* Add example rabbitmq configuration and user files to ``contrib/`` (`#245 <https://github.com/DiamondLightSource/python-zocalo/pull/245>`_)

0.30.2 (2023-09-06)
-------------------
Expand Down
164 changes: 164 additions & 0 deletions contrib/rabbitmq-configuration.yaml
@@ -0,0 +1,164 @@
---
# RabbitMQ Configuration
#
# This is a snapshot of the active rabbitmq configuration used for the
# zocalo deployment at Diamond.
#
# This file is used to declare RabbitMQ queues and their configuration.
# Jenkins parses this file using the Python script in this directory to
# generate and deploy the actual RabbitMQ configuration.
#
# Queues are grouped together in groups, within a group every queue has
# the same settings. It is possible to optionally influence the RabbitMQ
# queue, exchange, and bindings settings per group.

# Note that no VHost is declared here - at time of writing, this is not
# handled very gracefully and changes are applied by deleting the VHost;
# which causes all queues, outstanding messages to be deleted.
#
# If you understand these risks and want to specify the vhost in this
# file, you can specify vhost as:
# # vhosts:
# # - zocalo


exchanges:
- name: delayed
vhost: zocalo
type: x-delayed-message
arguments:
x-delayed-type: direct
- name: results
vhost: zocalo
type: topic

policies:
- name: redelivery
definition:
delivery-limit: 5
vhost: zocalo
pattern: .*

- name: ttl
definition:
delivery-limit: 5
message-ttl: 60000
vhost: zocalo
priority: 1
pattern: ^xrc.*

- name: immediate
definition:
# delivery-limit: 5
message-ttl: 0
vhost: zocalo
priority: 1
pattern: per_image_analysis.ssx

- name: dlq
definition:
dead-letter-exchange: ''
vhost: zocalo

groups:

# No-prefetch queues
# These are the workhorse queues of Zocalo. Any listener will only get a
# single message from these queues, and only get the next message after
# acknowledging/rejecting the previous one.
- names:
- archive.filelist
- archive.pattern
- cluster.submission
- darc.dropzone
- dispatcher
- filewatcher
- htcondorwatcher
- images
- index
- ispyb_connector
- ispyb_pia
- mailnotification
- mimas
- mimas.held
- nexusparser.find_related_files
- notify_gda
- per_image_analysis
- per_image_analysis.hdf5_select
- processing_recipe
- pymca.fitter
- relion.dev.stop
- ssx.plot
- transient.destination
- transient.transaction
# - transient.system_test.{guid}
- trigger
- validation
- bridge.test

settings:
queues:
type: quorum
dead-letter-routing-key-pattern: dlq.{name}
bindings:
- ''
- delayed
vhost: zocalo

- names:
- per_image_analysis.ssx

settings:
queues:
type: quorum
# dead-letter-routing-key-pattern: per_image_analysis
# dead-letter-queue-create: false
bindings:
- ''
vhost: zocalo

# Single active consumer queues
# Every queue in this group only allows a single listener to read from the
# queue at any one time. That listener gets all the messages from the queue
# at once.
# https://www.rabbitmq.com/consumers.html#single-active-consumer
- names:
- reduce.dc_sim
- reduce.xray_centering
- statistics.cluster
- jsonlines
settings:
queues:
type: quorum
dead-letter-routing-key-pattern: dlq.{name}
single_active_consumer: true
bindings:
- ''
- delayed
vhost: zocalo

# Broadcast topics
# This is TBC. I suspect we can do something cleverer here, eg. have
# temporary queues tied to each connection or something like that.
- names:
- command
- transient.status
- transient.statistics.cluster
settings:
broadcast: true
queues:
type: quorum
vhost: zocalo

- names:
- xrc.i03
settings:
queues:
type: quorum
dead-letter-queue-create: false
vhost: zocalo

bindings:
- source: results
destination: xrc.i03
vhost: zocalo
8 changes: 8 additions & 0 deletions contrib/rabbitmq_users/README.md
@@ -0,0 +1,8 @@
# RabbitMQ Users Specification

The ini-files in this folder are examples of the folder used by the
`zocalo.configure_rabbitmq` tool. Use as:

```
zocalo.configure_rabbitmq rabbitmq-configuration.yaml --user-config <THIS FOLDER>
```
4 changes: 4 additions & 0 deletions contrib/rabbitmq_users/custom-user.ini
@@ -0,0 +1,4 @@
[rabbitmq]
username = custom
password = custompass
tags = administrator

0 comments on commit 077b108

Please sign in to comment.