Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example RabbitMQ configuration and user files #245

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ History

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

0.32.0 (2024-04-05)
-------------------
Expand Down
164 changes: 164 additions & 0 deletions contrib/rabbitmq-configuration.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[rabbitmq]
username = custom
password = custompass
tags = administrator
Loading