2014-03-26 55 views
0

我使用MassTransit和RaabbitMQ和之前發佈尚未證實當我嘗試發送郵件我得到這個錯誤:MassTransit - 通道關閉

rabbitmq://localhost/FilesVersioning => An exception was thrown during Send 

at MassTransit.Transports.Endpoint.Send[T](ISendContext`1 context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Endpoint.cs:line 116 
at MassTransit.Transports.Endpoint.Send[T](T message) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Endpoint.cs:line 125 
at ServicesImplementation.DVService.<>c__DisplayClass7.b__6() in D:\MyProject\trunk\ServicesImplementation\DocVersioningService.cs:line 111 
at FileSystemIO.FileSystemTransaction.ExecutePreCommitActions() in D:\MyProject\trunk\FileSystemIO\FileSystemTransaction.cs:line 106 
at Domain.Repositories.NHibernateSessionModule.EndSession(ISession session) in D:\MyProject\trunk\Domain\Repositories\NHibernateSessionModule.cs:line 205 
at Domain.Repositories.NHibernateSessionModule.ContextEndRequest(Object sender, EventArgs e) in D:\MyProject\trunk\Domain\Repositories\NHibernateSessionModule.cs:line 137 
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

___________________________________ 
rabbitmq://localhost/FilesVersioning => Publisher did not confirm message 

at MassTransit.Transports.RabbitMq.OutboundRabbitMqTransport.<>c__DisplayClass3.b__0(RabbitMqConnection connection) in d:\BuildAgent-02\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.RabbitMq\OutboundRabbitMqTransport.cs:line 87 
at MassTransit.Transports.ConnectionHandlerImpl`1.<>c__DisplayClass3.b__2() in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionHandlerImpl.cs:line 91 
at MassTransit.Transports.DefaultConnectionPolicy.Execute(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\DefaultConnectionPolicy.cs:line 42 
at MassTransit.Transports.ConnectionPolicyChainImpl.Next(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionPolicyChainImpl.cs:line 49 
at MassTransit.Transports.ConnectOnFirstUsePolicy.Execute(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectOnFirstUsePolicy.cs:line 34 
at MassTransit.Transports.ConnectionPolicyChainImpl.Next(Action callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionPolicyChainImpl.cs:line 49 
at MassTransit.Transports.ConnectionHandlerImpl`1.Use(Action`1 callback) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\ConnectionHandlerImpl.cs:line 86 
at MassTransit.Transports.RabbitMq.OutboundRabbitMqTransport.Send(ISendContext context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\Transports\MassTransit.Transports.RabbitMq\OutboundRabbitMqTransport.cs:line 50 
at MassTransit.Transports.Transport.Send(ISendContext context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Transport.cs:line 50 
at MassTransit.Transports.Endpoint.Send[T](ISendContext`1 context) in d:\BuildAgent-02\work\aa063b4295dfc097\src\MassTransit\Transports\Endpoint.cs:line 110 

___________________________________ 
rabbitmq://localhost/FilesVersioning => Publish not confirmed before channel closed 
___________________________________ 

我在一個web請求結束髮送消息HTTP模塊。

有誰知道這個錯誤是什麼意思?

據我所知,我沒有關閉與MassTransit相關的任何內容。

編輯:

據我看到的,它在這個LAMDA拋出: https://github.com/phatboyg/MassTransit/blob/master/src/Transports/MassTransit.Transports.RabbitMq/OutboundRabbitMqTransport.cs#L51

EDIT2:

我初始化服務總線這樣的:

 var _bus = ServiceBusFactory.New(sbc => 
     { 
      sbc.UseRabbitMq(); 
      sbc.ReceiveFrom("rabbitmq://localhost/queue0"); 
      sbc.ReceiveFrom("rabbitmq://localhost/queue1"); 
      sbc.ReceiveFrom("rabbitmq://localhost/queue2"); 
      sbc.Validate(); 
      sbc.Subscribe(a => a.Handler<Item0>((msg, item) => new Item0Handler().Handle(msg))); 
      sbc.Subscribe(a => a.Handler<Item1>((msg, item) => new Item1Handler().Handle(msg))); 
      sbc.Subscribe(a => a.Handler<Item2>((msg, item) => new Item2Handler().Handle(msg))); 
     }); 

...我用_bus發送和接收消息。 我是MassTransient中的一名初學者,所以此配置可能也是錯誤的...

回答

0

好的。問題似乎是我在一條總線上使用了許多輸入隊列(在ServiceBusFactory.New()內部有很多sbc.ReceiveFrom()調用)。

最後,我創造了很多公交車,像這樣:

var _bus = ServiceBusFactory.New(sbc => 
    { 
     sbc.UseRabbitMq(); 
     sbc.ReceiveFrom("rabbitmq://localhost/queue0"); 
     sbc.Validate(); 
     sbc.Subscribe(a => a.Handler<Item0>((msg, item) => new Item0Handler().Handle(msg))); 
     sbc.Subscribe(a => a.Handler<Item1>((msg, item) => new Item1Handler().Handle(msg))); 
     sbc.Subscribe(a => a.Handler<Item2>((msg, item) => new Item2Handler().Handle(msg))); 
    }); 

    var _bus2 = ServiceBusFactory.New(sbc => 
    { 
     sbc.UseRabbitMq(); 
     sbc.ReceiveFrom("rabbitmq://localhost/queue1"); 
     sbc.Validate(); 
     sbc.Subscribe(a => a.Handler<Item0>((msg, item) => new Item0Handler().Handle(msg))); 
     sbc.Subscribe(a => a.Handler<Item2>((msg, item) => new Item2Handler().Handle(msg))); 
    });