gpt4 book ai didi

c# - 订户未阅读事件消息

转载 作者:太空宇宙 更新时间:2023-11-03 13:20:54 25 4
gpt4 key购买 nike

我有一个基于 NServiceBus 构建的小型服务,旨在监听其他地方发生的某些事件。端点配置类如下所示:

public class EndpointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
{
public void Init()
{
var container = new WindsorContainer();

try
{
SetLoggingLibrary.Log4Net(() => XmlConfigurator.Configure());

Configure.Serialization.Xml();
Configure.Features.Enable<Sagas>();
Configure.With()
.CastleWindsorBuilder(container)
.DefiningCommandsAs(t =>
t.GetCustomAttributes(typeof(CustomCommandAttribute), false)
.GetLength(0) > 0)
.DefiningEventsAs(t =>
t.GetCustomAttributes(typeof(CustomEventAttribute), false)
.GetLength(0) > 0)
.Log4Net()
.UseNHibernateTimeoutPersister()
.UseNHibernateSagaPersister()
;
}
catch (Exception ex)
{
throw new Exception("Configuration did not work. " + Environment.NewLine +
string.Format("Config file: {0}", AppDomain.CurrentDomain.SetupInformation.ConfigurationFile) +
Environment.NewLine +
ex.Message, ex);
}
//More stuff adding other non-NSB facilities into the container.
//Pretty certain it's not relevant here, but if people think it is it can be added
}
}

该服务包含一个处理程序,它处理一个事件 - 事件类本身用 CustomEventAttribute 属性修饰,已构建其他订阅以订阅同一发布者并订阅同一事件。一切似乎都很好。

服务启动,我可以在发布者的订阅数据库中看到一个条目:

SubscriberEndpoint                  MessageType                            Version       TypeName
----------------------------------- -------------------------------------- ------------- ---------------------------
MySubscriber@MySubscribersMachine Namespaces.PrincipalAdded,1.1.3.37147 1.1.3.37147 Namespaces.PrincipalAdded

此后,发布者发布了 4 条此类消息,我可以在 MySubscribersMachine 上的 MySubscriber 队列中看到 4 条消息。然后 - 没有任何反应。

我们的 log4net 配置将 NServiceBus 记录为 DEBUG 级别 - 例如,我看到同一服务每分钟轮询一次 NSB 超时 - 但我没有看到任何有关它的信息甚至尝试使用这些消息并调用处理程序。

此时我该怎么做才能获得更好的诊断信息?

NServiceBus 的版本是 4.3。服务器是 Windows Server 2008 R2。

最佳答案

显然,如果运行该服务的用户帐户无权访问其自己的队列,则不值得向日志中发送任何内容。

我们已授予该帐户从队列中读取的权限,现在它可以正常运行。

关于c# - 订户未阅读事件消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24280774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com