Reputation: 319
My web process sends commands to the domain and handles events (to push through SIgnalR to browsers). It's running ASP.NET MVC3 and .NET 4 on IIS Express / Win7 x64
At random, and sometimes right from the start, it decides to stop distributing events to my handlers. The events are in the web endpoint's journal queue, but there is no other trace of them. They're missing from the log entirely, my breakpoints in the handlers are never hit, and both the endpoint and the error queue are empty.
Func<Type, bool> isMessage = t => typeof(IMessage).IsAssignableFrom(t);
Func<Type, bool> isCommand = t => typeof(ICommand).IsAssignableFrom(t);
Func<Type, bool> isEvent = t => typeof(IEvent).IsAssignableFrom(t);
Configure.WithWeb()
.NinjectBuilder(Kernel)
.DefineEndpointName("Hospital.Web")
.DefiningMessagesAs(isMessage)
.DefiningCommandsAs(isCommand)
.DefiningEventsAs(isEvent)
.Log4Net()
.JsonSerializer()
.MsmqTransport()
.UnicastBus()
.LoadMessageHandlers()
.PurgeOnStartup(true)
.CreateBus()
.Start();
Here's the NSB parts of my web.config:
<MsmqTransportConfig ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="Hospital.Commands" Endpoint="Hospital.CommandHandlers" />
<add Messages="Hospital.Events" Endpoint="Hospital.CommandHandlers" />
</MessageEndpointMappings>
</UnicastBusConfig>
Here's one of my handlers:
public class StatsHandler :
IHandleMessages<PatientAdmitted>,
IHandleMessages<BedAssigned>,
IHandleMessages<PatientDischarged>
{
private static readonly ILog Log = LogManager.GetLogger(typeof (StatsHandler));
private readonly IConnectionManager _connectionManager;
public StatsHandler(IConnectionManager connectionManager)
{
_connectionManager = connectionManager;
}
protected dynamic Clients
{
get { return _connectionManager.GetClients<StatsHub>(); }
}
public void Handle(PatientAdmitted message)
{
Log.DebugFormat("Admitted {0} {1}", message.FirstName, message.LastName);
Clients.patientAdmitted();
}
public void Handle(BedAssigned message)
{
Log.DebugFormat("Assigned {0} to {1}", message.PatientId, message.Bed);
Clients.bedAssigned();
}
public void Handle(PatientDischarged message)
{
Log.DebugFormat("Discharged {0}", message.PatientId);
Clients.patientDischarged();
}
}
I've also asked this question in the NServiceBus group. There's a log file attached to that message.
Upvotes: 2
Views: 568
Reputation: 5273
There was a bug in RC4 that could have caused this behavior, can you try RC5 and see if that helps?
Upvotes: 3