Skip to content

v0.0.41 - @kaapi/kafka-messaging: Error Handling, Batch Publishing & DX Improvements

Choose a tag to compare

@demingongo demingongo released this 17 Jan 18:30

@kaapi/kafka-messaging

✨ Features

  • publishBatch() - Publish multiple messages in a single call for high-throughput scenarios
  • onError callback - Custom error handling in subscribe() for alerting, metrics, or external logging
  • fetchTopicOffsets() - Public method to retrieve partition offset information
  • groupId / 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: true is set
  • logOffsets opt-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

Note: Existing consumers will join new consumer groups. Plan accordingly if you need offset continuity.