Skip to content

Commit

Permalink
Added support for SASL
Browse files Browse the repository at this point in the history
  • Loading branch information
ktogias committed Sep 15, 2023
1 parent baff504 commit 20d6231
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dev/config/messaging.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
],
];

if (getenv('MESSAGE_BROKER_SECURITY_PROTOCOL') === 'SASL_SSL'){
$connectionConfig['global']['security.protocol'] = 'SASL_SSL';
$connectionConfig['global']['sasl.mechanisms'] = getenv('MESSAGE_BROKER_SASL_MECHANISMS')?:'PLAIN';
$connectionConfig['global']['sasl.username'] = getenv('MESSAGE_BROKER_SASL_USERNAME')?:'$ConnectionString';
$connectionConfig['global']['sasl.password'] = getenv('MESSAGE_BROKER_SASL_PASSWORD');
}

$channels = getenv('EVENT_CHANNELS');

$channelsConfig = array_filter(array_map(function(string $row){
Expand Down
32 changes: 32 additions & 0 deletions ops/envs/dev/comp/.dist.sasl.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
COMPOSE_PROJECT_NAME=evdobe-event-listener
TIME_ZONE=Europe/Athens
HTTP_PORT=9501
MESSAGE_BROKER_HOST=kafka
MESSAGE_BROKER_PORT=9093
MESSAGE_BROKER_SECURITY_PROTOCOL=SASL_SSL
MESSAGE_BROKER_SASL_MECHANISMS=PLAIN
MESSAGE_BROKER_SASL_USERNAME='$ConnectionString'
MESSAGE_BROKER_SASL_PASSWORD="Endpoint=sb://kafka/;SharedAccessKeyName=GlobalListener;SharedAccessKey=passssss"

MESSAGE_CONSUMER_GROUP=my-event-listener
EVENT_CHANNEL_1=test.global
EVENT_CHANNEL_2=another-channel
EVENT_CHANNEL_3=third-channel
EVENT_CHANNEL_4=forth-channel
EVENT_CHANNELS="
${EVENT_CHANNEL_1};\Application\Messaging\Impl\HeaderNameFilter|submitted|deleted
${EVENT_CHANNEL_2};\Application\Messaging\Plugin\InvalidFilter;\Application\Messaging\Plugin\ExampleTranslator2
${EVENT_CHANNEL_3}
${EVENT_CHANNEL_4}
"
INVALID_CHANNEL=global.invalid
MESSAGE_TOPICS="
${EVENT_CHANNEL_1}:1:1
${EVENT_CHANNEL_2}:1:1
${INVALID_CHANNEL}:1:1
${EVENT_CHANNEL_3}:1:1
${EVENT_CHANNEL_4}:1:1
"
STORE_DB_USER=adbuser
STORE_DB_PASSWORD=adbpass
STORE_DB_NAME=eventstore
4 changes: 4 additions & 0 deletions ops/envs/dev/comp/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ services:
AUTORELOAD_ANY_FILES: 0
MESSAGE_BROKER_HOST: ${MESSAGE_BROKER_HOST}
MESSAGE_BROKER_PORT: ${MESSAGE_BROKER_PORT}
MESSAGE_BROKER_SECURITY_PROTOCOL: ${MESSAGE_BROKER_SECURITY_PROTOCOL}
MESSAGE_BROKER_SASL_MECHANISMS: ${MESSAGE_BROKER_SASL_MECHANISMS}
MESSAGE_BROKER_SASL_USERNAME: ${MESSAGE_BROKER_SASL_USERNAME}
MESSAGE_BROKER_SASL_PASSWORD: ${MESSAGE_BROKER_SASL_PASSWORD}
MESSAGE_CONSUMER_GROUP: ${MESSAGE_CONSUMER_GROUP}
EVENT_CHANNELS: ${EVENT_CHANNELS}
INVALID_CHANNEL: ${INVALID_CHANNEL}
Expand Down

0 comments on commit 20d6231

Please sign in to comment.