所以我得到了我的主机处理消息。它能做什么?获取包含电子邮件地址,正文和主题的邮件。并使用smtp发送电子邮件。
所以在生产中,在我们的一个客户端中,我看到队列中有370条消息。没有消息从队列中消失。只有新消息进入。
我查看了日志。看到的是:
2016-04-28 17:35:10,243 [DAPROD01] [3] [] INFO : Failed to process message
System.Net.Mail.SmtpException: The operation has timed out.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at EmailServiceHost.Utilities.EmailSender.Send(String recipient, String subject, String body) in e:\r-release\src\EmailServiceHost\Utilities\EmailSender.cs:line 24
at NServiceBus.Unicast.HandlerInvocationCache.Invoke(Object handler, Object message, Dictionary`2 dictionary) in :line 0
at NServiceBus.Pipeline.Behaviors.InvokeHandlersBehavior.DispatchMessageToHandlersBasedOnType(IBuilder builder, LogicalMessage toHandle, LoadedMessageHandlers loadedHandlers, BehaviorContext context) in :line 0
at NServiceBus.Pipeline.Behaviors.InvokeHandlersBehavior.Invoke(BehaviorContext context, Action next) in :line 0
at NServiceBus.Sagas.SagaPersistenceBehavior.Invoke(BehaviorContext context, Action next) in :line 0
at NServiceBus.Pipeline.Behaviors.LoadHandlersBehavior.Invoke(BehaviorContext context, Action next) in :line 0
at NServiceBus.Pipeline.Behaviors.CallbackInvocationBehavior.Invoke(BehaviorContext context, Action next) in :line 0
at NServiceBus.Pipeline.Behaviors.ApplyIncomingMessageMutatorsBehavior.Invoke(BehaviorContext context, Action next) in :line 0
at NServiceBus.Pipeline.Behaviors.ExtractLogicalMessagesBehavior.Invoke(BehaviorContext context, Action next) in :line 0
at NServiceBus.Pipeline.Behaviors.ApplyIncomingTransportMessageMutatorsBehavior.Invoke(BehaviorContext context, Action next) in :line 0
at NServiceBus.UnitOfWork.UnitOfWorkBehavior.Invoke(BehaviorContext context, Action next) in :line 0
2016-04-28 17:35:10,602 [DAPROD01] [48] [] ERROR: Message has failed FLR and will be moved to the configured error q, ID=ec40ebe5-90a5-4014-be42-a5f500877d2a.
2016-04-28 17:36:50,689 [DAPROD01] [48] [] INFO : Failed to process message
System.Transactions.TransactionAbortedException: The transaction has aborted.
at System.Transactions.TransactionStatePromotedAborted.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState)
at System.Transactions.CommittableTransaction.Commit()
at System.Transactions.TransactionScope.InternalDispose()
at System.Transactions.TransactionScope.Dispose()
at NServiceBus.Transports.Msmq.MsmqDequeueStrategy.Action() in :line 0
所以你注意到第一个错误包含smtp客户端的超时。 接下来的200个错误只表示无法处理消息。
消息没有离开私人队列。
答案 0 :(得分:0)
messagehandler处理Transaction中的消息。当它在处理消息时收到异常时,将回滚事务并将消息放回队列中。
看起来你的messagehandler无法发送邮件。 smtp服务器已关闭,不可用或防火墙禁止与其连接。您获得的超时异常会导致事务回滚。
最终,NServiceBus应该移动一条消息,使其无法进入错误队列。我不知道这里发生了什么。也许你只是等不够久?顺便说一下,我认为默认设置是5个FLR和3个SLR。