IMessageSender GetMessageSender(string queue) { return(_messageSenders.GetOrAdd(queue, _ => { var connectionStringParser = new ConnectionStringParser(_connectionString); var connectionString = connectionStringParser.GetConnectionStringWithoutEntityPath(); var messageSender = new MessageSender( connectionString, queue, retryPolicy: DefaultRetryStrategy ); _disposables.Push(messageSender.AsDisposable(t => AsyncHelpers.RunSync(async() => await t.CloseAsync().ConfigureAwait(false)))); return messageSender; })); }