Skip to content

Commit

Permalink
Renamed INewMessageBus to IMessageBus.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed Sep 7, 2012
1 parent d35e8fc commit 4416f65
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ PublishProfiles/
*.ncrunchsolution
*.log
SignalR.Client.JS.Tests/temp/*
SignalR.Client.JS.Tests/CommandLineBridge.js
SignalR.Client.JS.Tests/CommandLineBridge.js
*.vspx
8 changes: 4 additions & 4 deletions SignalR.Stress/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static void StressGroups()
if (!countDown.Wait(TimeSpan.FromSeconds(10)))
{
Console.WriteLine("Didn't receive " + max + " messages. Got " + (max - countDown.Count) + " missed (" + String.Join(",", list.Select(i => i.ToString())) + ")");
var bus = host.DependencyResolver.Resolve<INewMessageBus>();
var bus = host.DependencyResolver.Resolve<IMessageBus>();
Debugger.Break();
}
}
Expand All @@ -139,7 +139,7 @@ private static void RunConnectionTest()
string payload = GetPayload();

var dr = new DefaultDependencyResolver();
MeasureStats((MessageBus)dr.Resolve<INewMessageBus>());
MeasureStats((MessageBus)dr.Resolve<IMessageBus>());
var connectionManager = new ConnectionManager(dr);
var context = connectionManager.GetConnectionContext<StressConnection>();

Expand Down Expand Up @@ -176,7 +176,7 @@ private static void RunMemoryHost()

string payload = GetPayload();

MeasureStats((MessageBus)host.DependencyResolver.Resolve<INewMessageBus>());
MeasureStats((MessageBus)host.DependencyResolver.Resolve<IMessageBus>());

Action<PersistentResponse> handler = (r) =>
{
Expand Down Expand Up @@ -234,7 +234,7 @@ private static void RunConnectionReceiveLoopTest()
string payload = GetPayload();

var dr = new DefaultDependencyResolver();
MeasureStats((MessageBus)dr.Resolve<INewMessageBus>());
MeasureStats((MessageBus)dr.Resolve<IMessageBus>());
var connectionManager = new ConnectionManager(dr);
var context = connectionManager.GetConnectionContext<StressConnection>();

Expand Down
2 changes: 1 addition & 1 deletion SignalR.Tests/Server/ConnectionFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ConnectionFacts
[Fact]
public void SendingCommandObjectSetsCommandOnBus()
{
var messageBus = new Mock<INewMessageBus>();
var messageBus = new Mock<IMessageBus>();
Message message = null;
messageBus.Setup(m => m.Publish(It.IsAny<Message>())).Callback<Message>(m => message = m);
var serializer = new JsonNetSerializer();
Expand Down
4 changes: 2 additions & 2 deletions SignalR.Tests/Server/Connections/DisconnectFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ private class ServerNode

private IConnection _connection;

public ServerNode(INewMessageBus bus)
public ServerNode(IMessageBus bus)
{
// Give each server it's own dependency resolver
Server = new MemoryHost(new DefaultDependencyResolver());
Connection = new FarmConnection();

Server.DependencyResolver.Register(typeof(FarmConnection), () => Connection);
Server.DependencyResolver.Register(typeof(INewMessageBus), () => bus);
Server.DependencyResolver.Register(typeof(IMessageBus), () => bus);

var context = Server.ConnectionManager.GetConnectionContext<FarmConnection>();
_connection = context.Connection;
Expand Down
4 changes: 2 additions & 2 deletions SignalR/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SignalR
{
public class Connection : IConnection, ITransportConnection, ISubscriber
{
private readonly INewMessageBus _bus;
private readonly IMessageBus _bus;
private readonly IJsonSerializer _serializer;
private readonly string _baseSignal;
private readonly string _connectionId;
Expand All @@ -20,7 +20,7 @@ public class Connection : IConnection, ITransportConnection, ISubscriber
private bool _aborted;
private readonly Lazy<TraceSource> _traceSource;

public Connection(INewMessageBus newMessageBus,
public Connection(IMessageBus newMessageBus,
IJsonSerializer jsonSerializer,
string baseSignal,
string connectionId,
Expand Down
2 changes: 1 addition & 1 deletion SignalR/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private IConnection GetConnection(string connectionName)

// Give this a unique id
var connectionId = Guid.NewGuid().ToString();
return new Connection(_resolver.Resolve<INewMessageBus>(),
return new Connection(_resolver.Resolve<IMessageBus>(),
_resolver.Resolve<IJsonSerializer>(),
connectionName,
connectionId,
Expand Down
4 changes: 2 additions & 2 deletions SignalR/Infrastructure/DefaultDependencyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ private void RegisterDefaultServices()
var serverMessageHandler = new Lazy<IServerCommandHandler>(() => new ServerCommandHandler(this));
Register(typeof(IServerCommandHandler), () => serverMessageHandler.Value);

var newMessageBus = new Lazy<INewMessageBus>(() => new MessageBus(this));
Register(typeof(INewMessageBus), () => newMessageBus.Value);
var newMessageBus = new Lazy<IMessageBus>(() => new MessageBus(this));
Register(typeof(IMessageBus), () => newMessageBus.Value);

var serializer = new Lazy<JsonNetSerializer>();
Register(typeof(IJsonSerializer), () => serializer.Value);
Expand Down
6 changes: 3 additions & 3 deletions SignalR/Infrastructure/ServerCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace SignalR.Infrastructure
/// </summary>
public class ServerCommandHandler : IServerCommandHandler, ISubscriber
{
private readonly INewMessageBus _messageBus;
private readonly IMessageBus _messageBus;
private readonly IServerIdManager _serverIdManager;
private readonly IJsonSerializer _serializer;
private const int MaxMessages = 10;
Expand All @@ -20,14 +20,14 @@ public class ServerCommandHandler : IServerCommandHandler, ISubscriber
private static readonly string[] ServerSignals = new[] { ServerSignal };

public ServerCommandHandler(IDependencyResolver resolver) :
this(resolver.Resolve<INewMessageBus>(),
this(resolver.Resolve<IMessageBus>(),
resolver.Resolve<IServerIdManager>(),
resolver.Resolve<IJsonSerializer>())
{

}

public ServerCommandHandler(INewMessageBus messageBus, IServerIdManager serverIdManager, IJsonSerializer serializer)
public ServerCommandHandler(IMessageBus messageBus, IServerIdManager serverIdManager, IJsonSerializer serializer)
{
_messageBus = messageBus;
_serverIdManager = serverIdManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@

namespace SignalR
{
public interface INewMessageBus
public interface IMessageBus
{
/// <summary>
///
/// </summary>
/// <param name="source"></param>
/// <param name="eventKey"></param>
/// <param name="value"></param>
/// <param name="message"></param>
/// <returns></returns>
Task Publish(Message message);

/// <summary>
Expand All @@ -20,6 +19,7 @@ public interface INewMessageBus
/// <param name="subscriber"></param>
/// <param name="cursor"></param>
/// <param name="callback"></param>
/// <param name="maxMessages"></param>
/// <returns></returns>
IDisposable Subscribe(ISubscriber subscriber, string cursor, Func<MessageResult, Task<bool>> callback, int maxMessages);

Expand Down
2 changes: 1 addition & 1 deletion SignalR/MessageBus/MessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace SignalR
/// <summary>
///
/// </summary>
public class MessageBus : INewMessageBus
public class MessageBus : IMessageBus
{
private readonly ConcurrentDictionary<string, Topic> _topics = new ConcurrentDictionary<string, Topic>();
private readonly Engine _engine;
Expand Down
2 changes: 1 addition & 1 deletion SignalR/MessageBus/MessageBusExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace SignalR
{
public static class MessageBusExtensions
{
public static Task Publish(this INewMessageBus bus, string source, string key, string value)
public static Task Publish(this IMessageBus bus, string source, string key, string value)
{
return bus.Publish(new Message(source, key, value));
}
Expand Down
4 changes: 2 additions & 2 deletions SignalR/PersistentConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public abstract class PersistentConnection
{
private const string WebSocketsTransportName = "webSockets";

protected INewMessageBus _newMessageBus;
protected IMessageBus _newMessageBus;
protected IJsonSerializer _jsonSerializer;
protected IConnectionIdGenerator _connectionIdGenerator;
private ITransportManager _transportManager;
Expand All @@ -31,7 +31,7 @@ public virtual void Initialize(IDependencyResolver resolver)
return;
}

_newMessageBus = resolver.Resolve<INewMessageBus>();
_newMessageBus = resolver.Resolve<IMessageBus>();
_connectionIdGenerator = resolver.Resolve<IConnectionIdGenerator>();
_jsonSerializer = resolver.Resolve<IJsonSerializer>();
_transportManager = resolver.Resolve<ITransportManager>();
Expand Down
2 changes: 1 addition & 1 deletion SignalR/SignalR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<Compile Include="Infrastructure\ServerIdManager.cs" />
<Compile Include="IPersistentConnectionContext.cs" />
<Compile Include="Infrastructure\IServerCommandHandler.cs" />
<Compile Include="MessageBus\INewMessageBus.cs" />
<Compile Include="MessageBus\IMessageBus.cs" />
<Compile Include="MessageBus\ISubscriber.cs" />
<Compile Include="MessageBus\MessageBus.cs" />
<Compile Include="MessageBus\IIdGenerator.cs" />
Expand Down

0 comments on commit 4416f65

Please sign in to comment.