Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (32 sloc) 1.34 KB
using System.Threading.Tasks;
namespace SignalR.SqlServer
{
public class SqlMessageBus : ScaleoutMessageBus
{
private readonly string _tableName = "SignalR_Messages";
private readonly SqlInstaller _installer;
private readonly SqlSender _sender;
private readonly SqlReceiver _receiver;
public SqlMessageBus(string connectionString, int tableCount, IDependencyResolver dependencyResolver)
: this(connectionString, tableCount, null, null, null, dependencyResolver)
{
}
internal SqlMessageBus(string connectionString, int tableCount, SqlInstaller sqlInstaller, SqlSender sqlSender, SqlReceiver sqlReceiver, IDependencyResolver dependencyResolver)
: base(dependencyResolver)
{
_installer = sqlInstaller ?? new SqlInstaller(connectionString, _tableName, tableCount);
_installer.EnsureInstalled();
_sender = sqlSender ?? new SqlSender(connectionString, _tableName);
_receiver = sqlReceiver ?? new SqlReceiver(connectionString, _tableName, OnReceived);
}
protected override Task Send(Message[] messages)
{
return _sender.Send(messages);
}
public override void Dispose()
{
_receiver.Dispose();
base.Dispose();
}
}
}
Jump to Line
Something went wrong with that request. Please try again.