Skip to content

Commit 124255b

Browse files
authored
Merge pull request #714 from ELIXIR-NO/fix/712
fix: renamed `LEGA_MQ_QUEUE` to `LEGA_MQ_ROUTING_KEY`
2 parents 72904e0 + 9754773 commit 124255b

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

e2eTests/docker-compose.template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ services:
145145
- CEGA_MQ_QUEUE=<<INTERCEPTOR_CEGA_MQ_QUEUE>>
146146
- LEGA_MQ_CONNECTION=<<INTERCEPTOR_MQ_CONNECTION>>
147147
- LEGA_MQ_EXCHANGE=<<INTERCEPTOR_LEGA_MQ_EXCHANGE>>
148-
- LEGA_MQ_QUEUE=<<INTERCEPTOR_LEGA_MQ_QUEUE>>
148+
- LEGA_MQ_ROUTING_KEY=<<INTERCEPTOR_LEGA_MQ_ROUTING_KEY>>
149149
- ENABLE_TLS=<<INTERCEPTOR_ENABLE_TLS>>
150150
- CA_CERT_PATH=<<INTERCEPTOR_CA_CERT_PATH>>
151151
- DEBUG=true

e2eTests/env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export INTERCEPTOR_CEGA_MQ_EXCHANGE=localega
9696
export INTERCEPTOR_CEGA_MQ_QUEUE=v1.files
9797
export INTERCEPTOR_MQ_CONNECTION=$MQ_CONN_STR
9898
export INTERCEPTOR_LEGA_MQ_EXCHANGE=sda
99-
export INTERCEPTOR_LEGA_MQ_QUEUE=files
99+
export INTERCEPTOR_LEGA_MQ_ROUTING_KEY=files
100100
export INTERCEPTOR_ENABLE_TLS=true
101101
export INTERCEPTOR_CA_CERT_PATH=/certs/CA.cert
102102

services/mq-interceptor/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The MQ-interceptor solves both of these problems by performing the following tas
3434

3535
- MQ-interceptor first connects to a PostgreSQL database server to access a table containing mappings between EGA user IDs and Elixir user IDs.
3636
- MQ-interceptor then connects to the Local MQ server and continuously consumes messages from the following queues: _inbox_, _verified_, _completed_ and _error_ (these names are hardcoded). The messages are reposted on the Central MQ server to the exchange configured by the `CEGA_MQ_EXCHANGE` environment variable. If the JSON-body of the message contains a "type" field, the new routing key will be based on this field. If not, the routing key will be set to the original queue name prefixed with "files." (hardcoded). For instance, messages read from the "verified" queue on the Local MQ server will be reposted with the routing key "files.verified" on the Central MQ server if they don’t have a "type" field.
37-
- MQ-interceptor also connects to the Central MQ server and continuously consumes messages from the single queue configured with the `CEGA_MQ_QUEUE` environment variable (usually "v1.files"). These messages are reposted on the Local MQ server to the exchange configured by the `LEGA_MQ_EXCHANGE` variable with a new routing key based on the `LEGA_MQ_QUEUE` variable. (Note that these messages may later be reposted internally on the Local MQ server with new routing keys by a second interceptor service, such as [SDA-interceptor](https://github.com/neicnordic/sensitive-data-archive/blob/main/sda/cmd/intercept/intercept.md)).
37+
- MQ-interceptor also connects to the Central MQ server and continuously consumes messages from the single queue configured with the `CEGA_MQ_QUEUE` environment variable (usually "v1.files"). These messages are reposted on the Local MQ server to the exchange configured by the `LEGA_MQ_EXCHANGE` variable with a new routing key based on the `LEGA_MQ_ROUTING_KEY` variable. (Note that these messages may later be reposted internally on the Local MQ server with new routing keys by a second interceptor service, such as [SDA-interceptor](https://github.com/neicnordic/sensitive-data-archive/blob/main/sda/cmd/intercept/intercept.md)).
3838
- Before any message is reposted, the MQ-interceptor checks the JSON-formatted body of the message and replaces the value of the "user" field (if present) based on mappings obtained from the PostgreSQL database. For messages sent from CEGA to LEGA, the EGA user ID in the original message is replaced with an Elixir user ID ([Life Science Login](https://lifescience-ri.eu/ls-login/) ID), and vice versa for the opposite direction.
3939
- If a message was successfully reposted, an ACK (acknowledgement message) is posted back on the channel that the message was obtained from.
4040
- If a message could not be successfully converted or reposted, a NACK (negative acknowledgement) is posted back on the channel that the message was obtained from. If the message could not be converted, an error message is also posted to the error channel (`CEGA_MQ_EXCHANGE` with routing key "files.error")
@@ -69,7 +69,7 @@ The MQ-interceptor service can be configured by setting the following environmen
6969
| CEGA_MQ_QUEUE | The name of the queue to read messages from on the Central MQ server. Suggested value: "v1.files" |
7070
| LEGA_MQ_CONNECTION | A connection string for connecting to the Local EGA message server.<br>`amqps://<user>:<password>@<host>:<port>/<vhost>[?parameters]` |
7171
| LEGA_MQ_EXCHANGE | The name of the exchange to post messages to on the Local MQ server. Suggested value: "sda" |
72-
| LEGA_MQ_QUEUE | The name of the queue in the Local MQ server that messages coming from Central MQ should be forwarded to. This value is used as the routing key. Suggested value: "files" |
72+
| LEGA_MQ_ROUTING_KEY | The name of the queue in the Local MQ server that messages coming from Central MQ should be forwarded to. This value is used as the routing key. Suggested value: "files" |
7373
| POSTGRES_CONNECTION | A connection string for the PostgreSQL database containing the user ID mappings.<br>`postgres://[username]:[password]@[host]:5432/[database]` |
7474
| VERIFY_CERT | If this is set to FALSE, the client will not verify the servers’ certificate chain and host name and will thus accept any certificate presented by the server and any host name in that certificate. This should only be set to FALSE for testing purposes. |
7575

services/mq-interceptor/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func forwardDeliveryTo(fromCEGAToLEGA bool, channelFrom MQChannel, channelTo MQC
156156
}
157157
// Forward all messages from CEGA to a local queue handled by the SDA intercept service
158158
if fromCEGAToLEGA {
159-
routingKey = os.Getenv("LEGA_MQ_QUEUE")
159+
routingKey = os.Getenv("LEGA_MQ_ROUTING_KEY")
160160
} else if messageType != nil {
161161
routingKey = messageType.(string)
162162
}

services/mq-interceptor/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var settings = map[string]string{
2222
"POSTGRES_CONNECTION": "postgres://postgres:p0stgres_passw0rd@postgres:5432/postgres?sslmode=disable",
2323
"LEGA_MQ_CONNECTION": "amqps://admin:guest@mq:5671/test",
2424
"LEGA_MQ_EXCHANGE": "sda",
25-
"LEGA_MQ_QUEUE": "files",
25+
"LEGA_MQ_ROUTING_KEY": "files",
2626
"CEGA_MQ_CONNECTION": "amqps://test:test@cegamq:5671/lega?cacertfile=/etc/ega/ssl/CA.cert",
2727
"CEGA_MQ_EXCHANGE": "localega.v1",
2828
"CEGA_MQ_QUEUE": "v1.files",

0 commit comments

Comments
 (0)