Warning, /swf-testbed/docs/artemis-queue-configuration.md is written in an unsupported language. File is not indexed.
0001 # Artemis Queue Configuration Guide
0002
0003 How to modify ActiveMQ Artemis queue configurations on pandaserver02.
0004
0005 ## Configuration File
0006
0007 ```
0008 /var/lib/swfbroker/etc/broker.xml
0009 ```
0010
0011 ## Routing Types
0012
0013 Artemis has two routing types:
0014
0015 | Type | Behavior | Use Case |
0016 |------|----------|----------|
0017 | **anycast** | Load-balanced (one consumer gets each message) | Work queues, worker pools |
0018 | **multicast** | Fanout (all consumers get every message) | Broadcast topics, monitoring |
0019
0020 ## Clean Modification Procedure
0021
0022 ### 1. Backup Current Config
0023
0024 ```bash
0025 sudo cp /var/lib/swfbroker/etc/broker.xml \
0026 /var/lib/swfbroker/etc/broker.xml.backup.$(date +%Y%m%d_%H%M%S)
0027 ```
0028
0029 ### 2. Edit Configuration
0030
0031 ```bash
0032 sudo vi /var/lib/swfbroker/etc/broker.xml
0033 ```
0034
0035 **Example: Anycast queue (workers compete)**
0036 ```xml
0037 <address name="/queue/panda.transformer.slices">
0038 <anycast>
0039 <queue name="/queue/panda.transformer.slices" />
0040 </anycast>
0041 </address>
0042 ```
0043
0044 **Example: Multicast topic (broadcast)**
0045 ```xml
0046 <address name="epictopic">
0047 <multicast />
0048 </address>
0049 ```
0050
0051 **Example: Divert (copy messages to another address)**
0052 ```xml
0053 <diverts>
0054 <divert name="transformer-slices-monitor-divert">
0055 <address>/queue/panda.transformer.slices</address>
0056 <forwarding-address>/topic/panda.transformer.slices.monitor</forwarding-address>
0057 <exclusive>false</exclusive> <!-- false = copy, true = move -->
0058 </divert>
0059 </diverts>
0060 ```
0061
0062 ### 3. Clear Old Bindings (Required When Changing Routing Types)
0063
0064 When changing an address from multicast to anycast (or vice versa), Artemis's persistent bindings will conflict with the new config. You must clear them:
0065
0066 ```bash
0067 sudo systemctl stop artemis.service
0068 sleep 2
0069 sudo rm -f /var/lib/swfbroker/data/bindings/*.bindings
0070 ```
0071
0072 **Warning:** This clears all queue bindings. Any pending messages in queues will be lost. Only do this on development systems or when queues are empty.
0073
0074 ### 4. Restart Artemis
0075
0076 ```bash
0077 sudo systemctl start artemis.service
0078 sleep 5
0079 ```
0080
0081 ### 5. Verify Configuration
0082
0083 Check startup logs for errors:
0084 ```bash
0085 sudo journalctl -u artemis.service --since "1 minute ago" | grep -E 'error|warn|ANYCAST|MULTICAST|divert'
0086 ```
0087
0088 Verify server is active:
0089 ```bash
0090 sudo journalctl -u artemis.service --since "1 minute ago" | grep "AMQ221007"
0091 # Should show: "Server is now active"
0092 ```
0093
0094 Check system status:
0095 ```bash
0096 cd /eic/u/wenauseic/github/swf-testbed && source .venv/bin/activate && source ~/.env
0097 python report_system_status.py
0098 ```
0099
0100 ## Current Queue Layout (as of 2025-12-23)
0101
0102 | Address | Routing | Purpose |
0103 |---------|---------|---------|
0104 | `epicqueue` | anycast | General work queue |
0105 | `epictopic` | multicast | Workflow broadcast (run_imminent, stf_gen, etc.) |
0106 | `/queue/panda.transformer.slices` | anycast | TF slice work queue (workers compete) |
0107 | `/topic/panda.transformer.slices.monitor` | multicast | Monitor receives copy of all slices |
0108 | `/topic/panda.results` | multicast | Processing results |
0109 | `/topic/panda.transformer` | multicast | Transformer events |
0110 | `/topic/tf.slices` | multicast | TF slice events |
0111 | `/topic/panda.harvester` | multicast | Harvester events |
0112
0113 ## Troubleshooting
0114
0115 ### "Queue already exists on address" Error
0116
0117 This means old bindings conflict with new config. Solution:
0118 ```bash
0119 sudo systemctl stop artemis.service
0120 sudo rm -f /var/lib/swfbroker/data/bindings/*.bindings
0121 sudo systemctl start artemis.service
0122 ```
0123
0124 ### Artemis Won't Start
0125
0126 Check for XML syntax errors:
0127 ```bash
0128 xmllint --noout /var/lib/swfbroker/etc/broker.xml
0129 ```
0130
0131 Check full error logs:
0132 ```bash
0133 sudo journalctl -u artemis.service -n 50
0134 ```
0135
0136 ### Restore from Backup
0137
0138 ```bash
0139 sudo systemctl stop artemis.service
0140 sudo cp /var/lib/swfbroker/etc/broker.xml.backup.YYYYMMDD_HHMMSS \
0141 /var/lib/swfbroker/etc/broker.xml
0142 sudo rm -f /var/lib/swfbroker/data/bindings/*.bindings
0143 sudo systemctl start artemis.service
0144 ```
0145
0146 ## Reference
0147
0148 - Artemis Address Model: https://activemq.apache.org/components/artemis/documentation/latest/address-model.html
0149 - Diverts: https://activemq.apache.org/components/artemis/documentation/latest/diverts.html
0150 - Colleague's setup guide: https://github.com/wguanicedew/documents/blob/main/artemis/configure.md