- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我是 NServiceBus 的新手,正在尝试开发一个发布者和单独的订阅者(我使用的是 v3.2.0.0),到目前为止,它工作正常——发布者和订阅者都在 NServiceBus 主机中运行.我的消息全部发布正常,但间歇性地没有被订阅者接收,发布者显示以下错误:
2012-09-05 14:27:37,491 [Worker.6] WARN NServiceBus.Unicast.UnicastBus [(null)] <(null)> - No handlers could be found for message type: MyNamespace.MyMessage
虽然所有消息都出现在 MSMQ 队列中,但此警告并未出现在所有消息中,因此如果我继续发布一条消息,我可能会看到其中一半显示消息,因此没有被订阅者接收到。
我承认我很难理解这个问题,所以到目前为止我的一些代码很可能完全是垃圾!
我按如下方式向 NSB 发布消息,消息输入是我定义的几种不同类型之一:
private void Publish<T>(T message)
{
var myBus = Configure.Instance.Builder.Build<IBus>();
myBus.Publish(message);
}
发布者的EndpointConfig如下:
[EndpointName("MyQueue")]
public class EndpointConfig : IConfigureThisEndpoint, AsA_Publisher, IWantCustomInitialization
{
/// <summary>
/// Initialisation for NServiceBus.
/// </summary>
public void Init()
{
Configure.With()
.DefaultBuilder()
.MsmqSubscriptionStorage()
.DisableTimeoutManager()
.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("MyNamespace"));
}
}
在订阅者端,我有以下 EndpointConfig:
[EndpointName("MyQueue")]
public class EndPointConfig : IConfigureThisEndpoint, AsA_Server, IWantCustomInitialization
{
public void Init()
{
Configure.With()
.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("MyNamespace"));
}
}
使用如下的 EventMessageHandler:
public class EventMessageHandler : IEvent, IHandleMessages<IMyMessage>
{
public void Handle(IMyMessage message)
{
Console.WriteLine(string.Format("Subscriber 1 received EventMessage with Id {0}.", message.Id));
}
}
订阅者的 app.config 是:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
</configSections>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error"/>
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="MyNamespace" Endpoint="MyQueue" />
</MessageEndpointMappings>
</UnicastBusConfig>
</configuration>
最佳答案
看起来您为发布者和订阅者使用了相同的端点名称。 NServiceBus 使用端点名称生成队列名称,这意味着两个进程最终使用相同的队列。
因此实际上您的发布者正在发布消息,但随后发布者和订阅者正在争夺谁来处理它们。
当订阅者获胜时,您会看到您的预期行为。
当发布者获胜时,该消息没有处理程序,因此 NServiceBus 显示警告。这并不总是一个问题;在某些情况下,您可能希望接收并简单地忽略一条消息,但此警告至少让您知道它正在发生,并且在您的情况下,它表示该消息未被预期的应用程序处理。
所以要修复它,只需更改端点名称即可。 MySubscriber 和 MyPublisher,或类似的东西。
您甚至不需要使用该属性,您只需命名实现 IConfigureThisEndpoint
的类,NServiceBus 将基于它构造端点名称。您甚至可以使用下划线,例如 MyProject_MyPublisher : IConfigureThisEndpoint
,NServiceBus 会将下划线转换为点,因此您将获得“MyProject.MyPublisher”的输入队列,当您有很多输入队列时,这对于命名空间非常有用端点跑来跑去。
关于c# - NServiceBus 警告 "No handlers could be found for message type",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12283490/
我尝试将 python 2.x 代码移植到 python 3。我正在努力解决的问题是 from mimetools import Message ... headers = Message(Strin
我有一个输入组件,它有三种类型的验证(required、validatorMessage、converterMessage),这个输入有自己的消息图标,整个表单有一个消息组件来显示所有组件的所有消息,
我有一个使用消息代理 (activemq) 的带有 spring 和 websockets 的 webapp。 这是我的配置类: @Configuration @EnableWebSocketMess
据我了解mbox Python 3.6 标准库中的类生成 email.message.Message 类型的旧式消息对象. 较新的类(class) email.message.EmailMessage
我使用的是mysql。 我有一个包含 userid、message_id、opened(true 或 false)、时间戳的消息表。 我希望所有未打开最近收到的 5 条消息的用户 这就是我现在拥有的:
我是 Android 的新手,发现要不断更新主视图,我必须创建一个线程来处理各种进程,然后将更新传回主视图。我决定使用 Handler 类来执行此操作。此示例中的 View 有一个用于激活代码的按钮和
我遇到了重定向符号的不同位置( > , &2 message message echo message >&2 message >&2 echo message message 对于所有表单,我得到了
我想使用 firebase 云函数发送通知,所以我尝试使用 firebase.messaging().getToken() 获取 token ,但我不断收到错误消息: TypeError: fireb
我实现了一个短信应用。现在我在使用 Oppo 设备时遇到了问题,因为无论何时收到消息,系统都会将默认应用程序更改为内置应用程序并显示此消息: For your messages security, S
我正在实现本指南:https://spring.io/guides/gs/centralized-configuration/关于Spring Cloud配置。 服务器: @EnableConfigS
我想在“匹配”之后,向所有比赛发送介绍信息。你知道一种轻松发送的方法吗?(我使用 Bluestacks) 提前致谢。问候。 最佳答案 只需传递 session.send()在session.dialo
在我们的应用程序中,我们使用 kafka 并有一个像这样的 Spring Cloud 输入流 @Component public interface SomeChannel { @Input(
这周我在通过 Node.js 库(代码相同,库版本相同等)向我的 iOS 设备发送消息时遇到了很多内部错误 很难调试,因为有时它会起作用。当我使用 for 循环发送 10 条消息时,我的设备将收到 3
我目前正在记录错误并希望获得尽可能多的描述性细节。我知道我可以捕获许多不同类型的异常,但 Exception.Message 之间有什么区别?和 Exception.InnerException.Me
我创建了一个映射到 MyBean.beansField 的表单。我使用 javax.validation.NotNull 注释来确保必须输入它。到目前为止一切正常,但错误消息如下所示: beansFi
我正在研究 Azure 服务总线。我的服务总线队列正在处理一条消息 3 次。我的消息锁定时间是5分钟。每条消息最多处理 2 分钟,但我不知道为什么队列会选择相同的消息并发送到处理,而重复的消息仅在 5
我正在使用最新的快速修复版本,即 1.6.0。我已经有针对 1.5.3 编写的代码,我想做的是将其升级到 1.6.0 我遇到的问题是,当我使用破解(msg,sessionID)方法时,它会抛出quic
当我调用 grails message()函数来查找和评估消息 key 对,它无法评估参数。 在我的 Controller 中,我调用消息函数: rejectWithError(message(cod
我使用一个小型 Spring 应用程序,其中数据库中的值很少,我想使用可变调用来检索它们。 API 在这里, @RestController @RequestMapping("/api/v1/prod
我在想在用以更好的方式,像这样: Please inform us about: 这个想法是以一种不同的方式向用户展示消息,具有更多的风格。这可能吗? 最佳答案 它们可通过 Fac
我是一名优秀的程序员,十分优秀!