bug: pubsub connection attempts in endless loop
Describe the bug While attempting to run all of the go tests in this project from my personal machine, which I understand probably doesn't have the proper test environment, I noticed the pubsub tests attempting to make a connection to the pubsub in an endless loop.
{"level":"ERROR","time":"2024-10-18T15:18:45.425787-05:00","message":"error in subscription for topic products: consumer group id not provided","gofrVersion":"dev"}
{"level":"ERROR","time":"2024-10-18T15:18:45.425809-05:00","message":"cannot subscribe as consumer_id is not provided in configs","gofrVersion":"dev"}
{"level":"ERROR","time":"2024-10-18T15:18:45.425798-05:00","message":"error in subscription for topic order-logs: consumer group id not provided","gofrVersion":"dev"}
{"level":"ERROR","time":"2024-10-18T15:18:45.42582-05:00","message":"cannot subscribe as consumer_id is not provided in configs","gofrVersion":"dev"}
{"level":"ERROR","time":"2024-10-18T15:18:45.425826-05:00","message":"error while reading from topic order-logs, err: consumer group id not provided","gofrVersion":"dev"}
{"level":"ERROR","time":"2024-10-18T15:18:45.42583-05:00","message":"error in subscription for topic order-logs: consumer group id not provided","gofrVersion":"dev"}
{"level":"ERROR","time":"2024-10-18T15:18:45.425815-05:00","message":"error while reading from topic products, err: consumer group id not provided","gofrVersion":"dev"}
I think we should consider implementing some kind of exponential retry/backoff strategy here and consider returning an error.
To Reproduce Steps to reproduce the behavior, if applicable:
-
The code is
go test -v ./...
2. The error is
{"level":"ERROR","time":"2024-10-18T15:18:45.425787-05:00","message":"error in subscription for topic products: consumer group id not provided","gofrVersion":"dev"} {"level":"ERROR","time":"2024-10-18T15:18:45.425809-05:00","message":"cannot subscribe as consumer_id is not provided in configs","gofrVersion":"dev"} {"level":"ERROR","time":"2024-10-18T15:18:45.425798-05:00","message":"error in subscription for topic order-logs: consumer group id not provided","gofrVersion":"dev"} {"level":"ERROR","time":"2024-10-18T15:18:45.42582-05:00","message":"cannot subscribe as consumer_id is not provided in configs","gofrVersion":"dev"} {"level":"ERROR","time":"2024-10-18T15:18:45.425826-05:00","message":"error while reading from topic order-logs, err: consumer group id not provided","gofrVersion":"dev"} {"level":"ERROR","time":"2024-10-18T15:18:45.42583-05:00","message":"error in subscription for topic order-logs: consumer group id not provided","gofrVersion":"dev"} {"level":"ERROR","time":"2024-10-18T15:18:45.425815-05:00","message":"error while reading from topic products, err: consumer group id not provided","gofrVersion":"dev"}
**Expected behavior**
Should return an error eventually.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environments (please complete the following information):**
- OS: [e.g. Linux]
- gofr version [e.g. v1.5.0]
- go version [e.g. 1.21]
**More description**
Add any other context about the problem here.
@mfreeman451 This is not a retry connection, but a subscription issue with Kafka where when it is trying to subscribe to the topic, the consumer group ID is not provided, and it throws the error that you mentioned.
I think we should look for a solution where the subscription cannot start until the pubsub is connected and ready.
@mfreeman451 , can you help me understand , if this is a issue only during test or while actual implementation also ?
If it is in test we can close it since it's similar to issue #1882. Will check if it's during application run.