Skip to content

Lack of Exception Handling in PublisherServiceImpl Class #431

@sancheet230

Description

@sancheet230

Why do we need this improvement?

The current implementation of the PublisherServiceImpl class lacks proper exception handling mechanisms during Kafka message publishing. This omission can lead to unhandled exceptions, potentially causing application instability and message loss. Implementing robust exception handling is crucial to ensure reliable message delivery and maintain system resilience.

How will this change help?

Addressing this issue will enhance the reliability and stability of the Kafka producer by ensuring that exceptions are properly managed, thereby reducing the risk of message loss and application crashes.

Screenshots

NA

How could it be implemented/designed?

  1. Implement Asynchronous Send with Callback:

    Utilize the kafkaTemplate.send(message) method along with a ListenableFutureCallback to handle success and failure scenarios during message publishing.

  2. Introduce Synchronous Send with Exception Handling:

    Use the kafkaTemplate.send(message).get(10, TimeUnit.SECONDS) method within a try-catch block to manage potential exceptions such as InterruptedException, ExecutionException, and TimeoutException.

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

Yes I am willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions