v0.0.41 - @kaapi/kafka-messaging: Error Handling, Batch Publishing & DX Improvements
@kaapi/kafka-messaging
✨ Features
publishBatch()- Publish multiple messages in a single call for high-throughput scenariosonErrorcallback - Custom error handling insubscribe()for alerting, metrics, or external loggingfetchTopicOffsets()- Public method to retrieve partition offset informationgroupId/groupIdPrefix- Flexible consumer group ID configuration
⚡ Improvements
- Race condition fix - Promise-based locks prevent duplicate producer/admin creation under concurrent calls
- Lazy admin initialization - Shared admin only connects when
logOffsets: trueis set logOffsetsopt-in - Offset logging now disabled by default to reduce overhead- Group ID separator - Changed from
---to.(e.g.,my-service.my-topic)
📚 Documentation
- Complete JSDoc for all public methods and interfaces
- Updated README with API tables, examples, and Docker setup
- Added CHANGELOG.md
🧪 Testing
- Added comprehensive mock tests (no Kafka broker required)
- Integration tests with real Kafka broker
- Separate npm scripts:
test,test:mock,test:integration,test:all
⚠️ Breaking Changes
- Consumer group ID separator changed from
---to.- Before:
my-service---my-topic - After:
my-service.my-topic
- Before:
Note: Existing consumers will join new consumer groups. Plan accordingly if you need offset continuity.