I open this new topic about my new module GAN devolpment
My module call a method ‘subscribe’ through GAN from a first gateway to another remote gateway. The remote gateway respond by calling a method ‘notify’
In this concept, on the first gateway, It seems that calling getService() method isblocking and terminate by 60s timeout because the remote gateway calling getService () first.
On the remote gateway, should i create a new task with the gateway taskmanager to notify asynchroniously and unblock the the situation or create a new runnable for each GAN method calling ?
Let me see if I understand what you are trying to do. You have services on two separate gateways, and you are trying to call them like so:
Gateway A calls subscribe() on Gateway B. On Gateway B, the subscribe() method calls notify() on Gateway A. But calling notify() on Gateway A doesn’t actually interact with the original subscribe() call, so Gateway A gives up after 60 seconds. Does this sound right? Are you trying to set up something like a push notification, where Gateway B sends something to Gateway A every X seconds, or is this a one-time call?
OK, I would do something like this. On Gateway B, I would set up the subscribe() method implementation to start an executor like so: GatewayContext.getExecutionManager().register()
Use this method to register a new Runnable that you create. You can control the rate at which the execution manager fires your Runnable. In your Runnable.run(), you would call the notify() method on Gateway A. You can set up the subscribe() method to return a String with the message “SUCCESS” or a message starting with “FAIL:” and the reason for the error to Gateway A. That way, Gateway A can be notified if Gateway B could not set up the subscription. To stop the subscription, you could code an unsubscribe() method in a similar way, where you call GatewayContext.getExecutionManager().unregister()
to remove your Runnable.
I have recheck my code and it appears that i already use the execution manager to execute runnable as you said.
But, i have see that i forced a notify to initiate value during subscribe. I correct and it s work fine.