Bonus Multitenancy Support
Configuration required in bonus-bff-service
The bonus-bff-service is designed to support multitenancy. To enable the bonus feature for a new tenant, simply add the tenant-specific environment variables in the Helm configuration.
env:
bonus:
<tenantId>:
MC_BONUS_MEASURES_ENDPOINT: "https://mockapimgmt.azure-api.net/bonus/measures"
MC_BONUS_SERVICE_ENDPOINT: "https://mockapimgmt.azure-api.net/bonus/policies"
BONUS_VALIDATION_LIMIT: 10
BONUS_MEASURES_CONFIRMED_STATUS: 3
BONUS_UNMAPPED_UUID_LIMIT: 1
Configure ReplyKafkaProducer & KafkaListener
While onboarding this feature for a new tenant, ensure the tenant has its own ReplyKafkaProducer to be able to produce the message from bonus-bff-service and expect reply on a tenant specific topic.
Topic is configured as <tenantId>-health-goal-update-ack-request
.
-
Authorize the tenant specific topic.
-
Open Contract Service should have tenant specific ReplyKafkaProducer and this ReplyKafkaProducer should be used in bonus-bff-service to publish the message to topic
<tenantId>-health-goal-creation-update-request
. -
From the bonus-bff-service, the kafka message will be published with ReplyKafkaProducer configured for the tenant.
-
KafkaMessage listener in the data-store service will consume the message and reply back to the tenant specific acknowledgement topic.
Tenant-Specific ReplyKafkaProducer & KafkaListener
To onboard Kafka messaging support for a new tenant in the bonus-bff-service
, follow the steps below to set up tenant-specific ReplyKafkaProducer
.
1. Topic Configuration & Authorization
For every tenant, a separate reply kafka topic must be created and authorized.
Reply Topic: <tenantId>-health-goal-update-ack-request
.
2. Tenant-Specific ReplyKafkaProducer Configuration (Open Contract Service)
In the open-contract-service, a separate ReplyKafkaProducer
instance is configured for each tenant. This producer should be tailored to:
- Send messages to the tenant-specific request topic
- Expect replies on the corresponding acknowledgement topic
3. Publishing Messages in bonus-bff-service
In the bonus-bff-service, ensure that:
- The service selects and uses the appropriate
ReplyKafkaProducer
instance for the tenant. - Messages are published to the topic:
<tenantId>-health-goal-creation-update-request
. - The producer expects reply from the corresponding reply topic to ensure the publishing went through successfully -
<tenantId>-health-goal-update-ack-request
.
This enables asynchronous request-reply communication where the bonus-bff-service expects a reply from the downstream system.
4. Kafka Listener in data-store-service
In the data-store-service, Kafka Listener will consuming the messages from - <tenantId>-health-goal-creation-update-request
Upon processing the message, this service sends a reply message back to the acknowledgment topic - <tenantId>-health-goal-update-ack-request
.