Skip to content

Implement batch-based Kafka producer logic #1194

@Ahmed-Ghanam

Description

@Ahmed-Ghanam

Description

Publishing and consuming messages individually has proven inefficient for high-volume workloads. To improve throughput and reduce latency, a batch-oriented producer will be implemented in the Altinn Notifications API.

This enhancement will enable the API to publish batches of newly registered notification orders, email notifications, and SMS notifications for processing.

This issue focuses on the producer-side implementation and adds a new batching method alongside the existing single-message API to maintain backward compatibility.

Acceptance Criteria

  • Add a new batching method to IKafkaProducer.
  • Implement batching in KafkaProducer.
  • Improve producer configuration.
  • Enhance topic-creation logic.
  • Add structured batch logging.

Non-Goals

  • Updating consumers to handle batch consumption (covered in a separate issue).
  • Changing message schema or Kafka topic structure.

Tasks

  • Extend IKafkaProducer with a new batch API.
  • Implement batch processing in KafkaProducer.
  • Add metrics instrumentation.
  • Enhance logging and error handling.
  • Add/update unit tests.

Additional Notes

Batching functionality will be introduced alongside existing single-message publishing to ensure backward compatibility. A future cleanup may remove the single-message method once consumers and upstream services have migrated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

💻 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions