[feature] expose error to user when producer reconnect to broker failed#648
[feature] expose error to user when producer reconnect to broker failed#648yorkhellen wants to merge 13 commits intoapache:masterfrom
Conversation
|
@yorkhellen Good patch, can you add test case for this change? |
cckellogg
left a comment
There was a problem hiding this comment.
What do other clients (like the java one) do in this situation? How are they notified?
| topic string | ||
| log log.Logger | ||
| cnx internal.Connection | ||
| err error |
There was a problem hiding this comment.
hello @cckellogg , It seems that some of our Error messages are not fully exposed, such as sending failures after reaching the Backlog threshold. It seems that @yorkhellen is encapsulating their business based on the Go SDK, and may need to process specific business logic based on these specific errors. It seems that it is OK to expose the error field to the user here. This way the business can be more flexible in error handling.
There was a problem hiding this comment.
Can you provide some examples on the use case and or what the business logic will do with these errors? I'm just trying to understand better. Also, I think this should not be part of the 0.7.0 release so we can think about it more. If we are going to bubble some more errors up we should come up with a good api.
There was a problem hiding this comment.
Sure, I will provide a code example later to illustrate this matter.
Yes, we always include this change in 0.7.0
|
cc @cckellogg PTAL again, thanks. |
| callback(nil, msg, errProducerClosed) | ||
| return | ||
| } | ||
| if p.err != nil { |
There was a problem hiding this comment.
This now changes the current behavior. Before if there was room the message would be added to the pending queue and sent when a new connection is established. Now the message will not be added. I'm not sure changing the default behavior is the correct approach here. Also, there could be a race condition checking the error and sending it since the the error is set in another go routine?
How do you envision your application handling this error?
Create producer failed will return error message to user. In some case broker notify producer close and producer can't reconnect broker successfully, but we can't get the error message when producer internal reconnect broker failed. We need handle error message. so expose error to user when producer reconnect to broker failed.