Skip to content

Add configurable liveness probe support for production monitoring #371

@dbfun

Description

@dbfun

Is your feature request related to a problem? Please describe.
Currently, the package does not provide any liveness probe mechanism. In production environments, Kafka connections can silently fail, and it is difficult to detect issues early. Adding a liveness probe would help monitoring systems detect when the package is not operating correctly.

Describe the solution you'd like
Add support for a liveness probe endpoint, for example /liveness, which returns JSON:

public function liveness(): JsonResponse
{
    return response()->json([
        'result' => 'ok', // return 'fail' in case of an error
    ]);
}

The idea is to update a timestamp in a persistent storage (Redis via Laravel Cache) during each iteration of the message loop, or at a configurable interval. The liveness probe should check the timestamp in Redis and fail if it has not been updated recently.
The Redis dependency should be optional; using Cache::store('redis') is sufficient. The update frequency and failure threshold should be configurable.

Describe alternatives you've considered

No probe (current state)

External monitoring scripts, but they are less integrated and require additional setup.

Additional context

This feature is important for production reliability. In real-world cases, Kafka connections can silently stop working, and a liveness probe would allow automatic detection and alerting.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions