RawRabbit.Channel.ChannelFactory.CreateAndWireupAsync C# (CSharp) Method

CreateAndWireupAsync() private method

private CreateAndWireupAsync ( ) : Task
return Task
		internal virtual Task<IModel> CreateAndWireupAsync()
		{
			return GetConnectionAsync()
				.ContinueWith(tConnection =>
				{
					var channel = tConnection.Result.CreateModel();
					_logger.LogInformation($"Channel '{channel.ChannelNumber}' has been created.");
					var recoverable = channel as IRecoverable;
					if (recoverable != null)
					{
						recoverable.Recovery += (sender, args) =>
						{
							if (!_channels.Contains(channel))
							{
								_logger.LogInformation($"Channel '{_current.Value.ChannelNumber}' is recovered. Adding it to pool.");
								_channels.AddLast(channel);
							}
						};
					}
					_channels.AddLast(new LinkedListNode<IModel>(channel));
					return channel;
				});
		}