internal async Task Start() { Address address = UriUtil.ToAddress(remoteUri, Info.username, Info.password); underlyingConnection = await transport.CreateAsync(address, CreateOpenFrame(Info), OnOpened); underlyingConnection.AddClosedCallback(Provider.OnInternalClosed); // Create a Session for this connection that is used for Temporary Destinations // and perhaps later on management and advisory monitoring. // TODO: change the way how connection session id is obtained SessionInfo sessionInfo = new SessionInfo(Info.Id); sessionInfo.AcknowledgementMode = AcknowledgementMode.AutoAcknowledge; connectionSession = new AmqpConnectionSession(this, sessionInfo); await connectionSession.Start(); }
internal async Task Start() { Address address = UriUtil.ToAddress(remoteUri, Info.UserName, Info.Password); this.tsc = new TaskCompletionSource <bool>(TaskCreationOptions.RunContinuationsAsynchronously); underlyingConnection = await transport.CreateAsync(address, new AmqpHandler(this)).ConfigureAwait(false); underlyingConnection.AddClosedCallback(OnClosed); // Wait for connection to be opened await this.tsc.Task.ConfigureAwait(false); // Create a Session for this connection that is used for Temporary Destinations // and perhaps later on management and advisory monitoring. NmsSessionInfo sessionInfo = new NmsSessionInfo(Info, -1); sessionInfo.AcknowledgementMode = AcknowledgementMode.AutoAcknowledge; connectionSession = new AmqpConnectionSession(this, sessionInfo); await connectionSession.Start().ConfigureAwait(false); }