How to properly implement the reconnection to the server #3097
Unanswered
GaetanKorpys
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Type of issue
Current Behavior
Hello, I have several questions about reconnection mecanism :
Doc about TransferSubscription :
"Transfer after session reconnect: The client SessionReconnectHandler can not reconnect to the existing session, it creates a new session and tries to transfer a subscription before recreating the full subscriptions."
Does it mean that BeginReconnect will handle the creation of the subscription and monitored Item (not only the session) ? Even after a restart of the server (server is empty, subscriptions and monitored items are not persisted afer the restart) ?
Is it possible to reconnect (subscription and monitored working) using BeginReconnect method when the session is closed on the server (du to timeout for example) ?
If so, should the server implement DurableSubscription and TransferSubscription ?
In the sample, they use :
// support transfer
m_session.DeleteSubscriptionsOnClose = false;
m_session.TransferSubscriptionsOnReconnect = true;
I know sometimes the SDK send a new session with a different id from the previous one.
And in that case, my mind tell me that the sdk will transfer the subscriptions.
That the case in the sample, but it means that BeginReconnect will moves to that state on her own ?
If so, then the client can not really log when the reconnect is starting (not completed) if i'm correct.
When I set e.CancelKeepAlive at True, my method Session_KeepAlive continues to be trigger. I confirm that with logs. Do I missunderstand something in the use case ?
Does ReconnectPeriod means that BeginReconnect will try to reconnect each ReconnectPeriod ?
Expected Behavior
No response
Steps To Reproduce
No response
Environment
Anything else?
Sample code from ConsoleReferenceClient :
///
/// Handles a keep alive event from a session and triggers a reconnect if necessary.
///
private void Session_KeepAlive(ISession session, KeepAliveEventArgs e)
{
try
{
// check for events from discarded sessions.
if (m_session == null || !m_session.Equals(session))
{
return;
}
}
Beta Was this translation helpful? Give feedback.
All reactions