Message Broker Offset Handoffs for Multi-Version Microservices
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
When multiple versions of a microservice application run concurrently as message consumers for the same message broker topic, ensuring that each message is processed only once and avoiding data inconsistencies is challenging, particularly due to potential lags in processing caused by tenant assignment changes.
Innovation Solution
Designate one version of the microservice application as a leader and others as followers, implementing specialized rewind and fast-forward operations to manage tenant assignments and ensure each message is processed by a single version, using a tenant assignment component to handle changes and maintain data integrity.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If multiple versions of microservice application run concurrently as message consumers, then system adaptability and continuous deployment capability are improved, but message processing reliability and data consistency deteriorate due to potential duplicate processing or data loss
Solution Approach 1:
The patent segments the consumer group into multiple versions (v1, v2, etc.) that can coexist, with each version assigned specific tenants. This allows continuous deployment while maintaining reliability through controlled message routing and processing ownership for each version segment.
Solution Approach 2:
The patent introduces a message broker as an intermediary that manages message distribution between multiple microservice versions and tenants. The broker coordinates tenant assignments and ensures each message is routed to the correct version, preventing duplicate processing while enabling continuous deployment.
2Adaptability or versatility
If tenant assignments are dynamically changed between microservice versions, then system flexibility and adaptability are improved, but processing consistency and data integrity worsen due to potential lags and race conditions
Solution Approach 1:
The patent implements preliminary actions by establishing leader-follower relationships and pre-defining tenant assignment rules before changes occur. When a version becomes leader, it pre-establishes its tenant assignments, and follower versions adjust accordingly, preventing race conditions and maintaining processing consistency during transitions.
Solution Approach 2:
The patent implements feedback mechanisms where microservice versions report their processing status and tenant assignments to the message broker. The broker uses this feedback to coordinate assignments, detect lags, and resolve conflicts, ensuring data integrity even when tenant assignments change dynamically between versions.
3Reliability
If rewind and fast-forward operations are implemented to manage tenant assignments, then message processing reliability is improved, but system complexity and operational overhead increase
Solution Approach 1:
The patent implements self-service mechanisms where microservice versions autonomously perform rewind and fast-forward operations based on their own processing state and tenant assignment changes. The leader version automatically adjusts its processing position when taking over tenants, reducing the need for complex external coordination while maintaining reliability.
Data Source
AI summary
A solution is provided to ensure that messages in a message broker are handled by one and only one version of a microservice application despite there being multiple versions of the microservice application running in parallel. More particularly, one version of the microservice application is designated as the leader while the others are designated as followers. When a follower has a tenant that is then promoted to be handled by the leader via a tenant assignment change, a specialized process is started by the leader that determines the current offset with the offset where the follower stopped handling messages for that tenant. If the current offset is greater, then a specialized rewind operation is performed to process any unprocessed events from the gap. If the current offset is less or equal, then a specialized fast-forward operation is performed to discard the messages addressed to the promoted tenants on the follower.


