I have an MVC3 app that sends commands (messages) to a console app server.
There server is setup as such:
private static void Main(string[] args)
{
var host = new RemoteAppDomainHost(typeof (BootStrap));
host.Start();
Console.WriteLine("Starting to process messages");
Console.ReadLine();
}
When a message is consumed, I am also publishing a new event message:
public void Consume(InactivateProgramCommand message)
{
var program = dbContext.Get<ProgramEntity>(message.ProgramId);
program.Inactivate();
serviceBus.Notify(new ProgramInactivatedEvent{ProgramId = message.ProgramId});
}
And then consuming that new message in another consumer.
This appears to be working fine, but I am wondering if this is the "preferred" way to do this?
One the things that concern me is the transactions. I have a NHibernateMessageModule in place similar to the module in Ayende's Alexandria and when watching the sessions in NHProf I can see that each session comes in and the first statement is "enlisted session in distributed transaction with isolation level: ReadCommitted", then the SQL then "commit transaction".
I am thinking these are two separate transactions and there is NOT one transaction wrapping them both, which is what I want. I want each consumer on its own transaction. Is this correct?
Thanks,
Joe