【发布时间】:2016-03-25 13:39:48
【问题描述】:
我使用以下示例实现了 MassTransit 解决方案: http://looselycoupledlabs.com/2014/06/masstransit-publish-subscribe-example/
当发布者和订阅者都在运行时,一切都按预期进行。
当我停止订阅者并发布更多消息时,我在 RabbitMQ 的 MtPubSubExample_TestSubscriber 队列中看到处于就绪状态的预期消息数。
当我重新启动时,订阅者启动它的总线并且只接收队列中的一条消息。剩余的消息被移动到 MtPubSubExample_TestSubscriber_error 队列。如果我将消息铲到原始 MtPubSubExample_TestSubriber 队列中,则正在运行的订阅者会毫无问题地接收消息。这似乎是仅在启动时出现的问题。
当我使用 MassTransit 2.x 版本(和相关代码)运行时,不存在此问题。当我升级到 MassTransit 3.1 时,问题才出现。
我正在使用以下内容: MassTransit 版本 3.1.0 二郎 OTP 18 (7.2.1) RabbitMQ 服务器版本 3.5.7
当我从错误队列中收到一条消息时,它具有以下详细信息:
交换:MtPubSubExample_TestSubscriber_error
路由密钥:
重新发送:○
属性:
message_id: 93f80000-b49a-a088-72a7-08d307cc086b
delivery_mode: 2
headers: Content-Type: application/vnd.masstransit+json
MT-Reason: fault
MT-Fault-Message: Duplicate type name within an assembly.
MT-Fault-Timestamp: 2015-12-18T16:55:40.9748103Z
MT-Fault-StackTrace: at System.Reflection.Emit.ModuleBuilder.CheckTypeNameConflict(String strTypeName, Type enclosingType)
at System.Reflection.Emit.AssemblyBuilderData.CheckTypeNameConflict(String strTypeName, TypeBuilder enclosingType)
at System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, ModuleBuilder module, PackingSize iPackingSize, Int32 iTypeSize, TypeBuilder enclosingType)
at System.Reflection.Emit.ModuleBuilder.DefineType(String name, TypeAttributes attr, Type parent, Type[] interfaces)
at MassTransit.Internals.Reflection.DynamicImplementationBuilder.CreateTypeFromInterface(ModuleBuilder builder, Type interfaceType)
MT-Host-MachineName: MACHINE1
MT-Host-ProcessName: LearningMT.TestSubscriber.vshost
MT-Host-ProcessId: 12700
MT-Host-Assembly: LearningMT.TestSubscriber
MT-Host-AssemblyVersion: 1.0.0.0
MT-Host-MassTransitVersion: 3.1.0.367
MT-Host-FrameworkVersion: 4.0.30319.42000
MT-Host-OperatingSystemVersion: Microsoft Windows NT 6.1.7601 Service Pack 1
content_type: application/vnd.masstransit+json
有效载荷 983 字节 编码:字符串
{
"messageId": "93f80000-b49a-a088-72a7-08d307cc086b",
"conversationId": "93f80000-b49a-a088-7353-08d307cc086b",
"sourceAddress": "rabbitmq://localhost:5672/bus-MACHINE1-LearningMT.TestPublisher.vshost-1xhyyyfwukoeogj1bdjox19zrq?durable=false&autodelete=true&prefetch=16",
"destinationAddress": "rabbitmq://localhost:5672/LearningMT.MessageContracts:ISomethingHappenedMessage",
"messageType": [
"urn:message:LearningMT.MessageContracts:ISomethingHappenedMessage"
],
"message": {
"what": "Fifth",
"when": "2015-12-18T16:55:28.5292293Z"
},
"headers": {},
"host": {
"machineName": "MACHINE1",
"processName": "LearningMT.TestPublisher.vshost",
"processId": 18992,
"assembly": "LearningMT.TestPublisher",
"assemblyVersion": "1.0.0.0",
"frameworkVersion": "4.0.30319.42000",
"massTransitVersion": "3.1.0.367",
"operatingSystemVersion": "Microsoft Windows NT 6.1.7601 Service Pack 1"
}
}
有没有人见过在订阅者启动时从队列中拉下时出现“程序集中的类型名称重复”的问题?
【问题讨论】:
标签: masstransit