Replies: 5 comments 1 reply
-
do you test like this?
|
Beta Was this translation helpful? Give feedback.
-
The test above also does not work and results in the following exception after the provider disconnects and then terminates
Although the test above can be modified to work (surround service.addListener with catch RpcException) I do not think it would be a very good solution. I don't think the application code should be expected to implement a loop with a sleep as it is 'leaking' reconnection concerns into the application code. I would also be concerned with a potential memory leak if this was to be the suggested solution, I did a quick check using Yourkit memory profiler and could see the object count increasing each time service.addListener() was called. If we think about the standard (non callback) consumer DubboReference it will cope with reconnections without any extra code implemented by the application. I think the same should happen for a callback i.e. the Dubbo library code should handle the reconnection (this may entail it being responsible for it re adding the listener or other?) In the mean time, the best I could think of was to periodically use the Echo service to check for connectivity, and re add the listener if necessary as follows
Usage
However I think the Dubbo library could do better than this as by the looks of the logging I think it must know when a disconnection/reconnection event occurs and hence be able to hook into that somehow. |
Beta Was this translation helpful? Give feedback.
-
As for me, it's not dubbo client duty to reconnect because callback is triggered by the server side, let say, kill the service and restart the service, how could it know there are clients are waiting for the callback? |
Beta Was this translation helpful? Give feedback.
-
you are wrong, if the connection is broken, |
Beta Was this translation helpful? Give feedback.
-
ReconnectTimerTask does what you said, but it has nothing to do with current rpc operation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Pre-check
Apache Dubbo Component
Java SDK (apache/dubbo)
Details
Hi,
when a Provider disconnects, a service annotated with @DubboReference behaves as expected i.e. if the Consumer calls a method on the proxy a RpcException is thrown. When the Provider reconnects, methods on the service can be called again with no issue.
However, if it is a Callback service (ref https://dubbo.apache.org/en/overview/mannual/java-sdk/tasks/framework/more/callback-parameter/), after reconnecting, the listener will not be invoked when the Callback service is invoked by the Provider even though I can see from the log on the consumer a "Received invokers changed event from registry Urls Size : 1. Invokers Size : 1. Available Size: 1 ..."
Is this a bug? Or is this expected behaviour? If so, what is the recommended way of detecting a reconnection event on the Consumer and then 'reconnecting' the listener to the proxy (or other)?
Regards,
Tim
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions