masstransit

MassTransit Get Started->

半腔热情 提交于 2020-09-29 15:47:04
MassTransit:是一款.NET的分布式应用程序框架(开源、免费)。通过MassTransit,可以轻松创建利用基于消息的、松耦合异步通信的应用程序和服务,以提高可用性,可靠性和可伸缩性。 MassTransit本身定位轻量级的服务总线,并支持多种传输方式如:RabbitMQ、Azure Service Bus、ActiveMQ、Amazon SQS、Kafka、Azure Event Hub。消息异常处理:重试配置、重新交付、erro管道、死信管道。分布式事务处理:sagas、Courier。容器支持:.NETcore自身的、autofac、castle windsor等、调度支持:Quartz 、hangfire。更多功能参考官网文档。 MassTransit目前已经发布到了第7个版本了,7.0版本新增了对Kafka 的支持,构建仅支持.NET Standard 2.0...其他改动不大。MassTransit社区使用也是很活跃的,对于首次接触的,通过本篇文章(基于rabbitmq)帮你快速入门! 一个应用程序或服务可以使用两种不同的方法来生产消息,主要区别是sent需要指定具体的端点地址,而pub不需要,下面的代码会演示这两种方式。 发布事件(多个接收者) 发送命令(一个接收者) 发布事件(事件消息) 场景假设:在xx项目中,需要与第三方进行交互。比如:订单发货之后

Masstransit EndpointConvention Azure Service Bus

时光毁灭记忆、已成空白 提交于 2020-07-19 19:00:09
问题 I'm wondering if I'm doing something wrong, I expected MassTransit would automatically register ReceiveEndpoints in the EndpointConvention . Sample code: services.AddMassTransit(x => { x.AddServiceBusMessageScheduler(); x.AddConsumersFromNamespaceContaining<MyNamespace.MyRequestConsumer>(); x.UsingAzureServiceBus((context, cfg) => { // Load the connection string from the configuration. cfg.Host(context.GetRequiredService<IConfiguration>().GetValue<string>("ServiceBus:ConnectionString")); cfg

Masstransit EndpointConvention Azure Service Bus

情到浓时终转凉″ 提交于 2020-07-19 18:58:30
问题 I'm wondering if I'm doing something wrong, I expected MassTransit would automatically register ReceiveEndpoints in the EndpointConvention . Sample code: services.AddMassTransit(x => { x.AddServiceBusMessageScheduler(); x.AddConsumersFromNamespaceContaining<MyNamespace.MyRequestConsumer>(); x.UsingAzureServiceBus((context, cfg) => { // Load the connection string from the configuration. cfg.Host(context.GetRequiredService<IConfiguration>().GetValue<string>("ServiceBus:ConnectionString")); cfg

MassTransit Consumer never receives message

▼魔方 西西 提交于 2020-07-16 07:20:49
问题 I'm building a demo application following along the documentation for using MassTransit with RabbitMQ and Autofac in an ASP.NET Core application: My program code: namespace MessageDemo { public class Program { public static void Main(string[] args) { var host = Host.CreateDefaultBuilder(args) .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webHostBuilder => { webHostBuilder .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration()

How to configure MassTransit to retry context.Publish() in case of failure?

青春壹個敷衍的年華 提交于 2020-07-11 06:47:28
问题 How to configure MassTransit to retry context.Publish() before failing, for example when RabbitMQ server is temporary unavailable? 回答1: The problem with retry in this context is that the only real reason a Publish call would fail is if the broker connection was lost (for any reason: network, etc.). In that case, the connection which was used to receive the message is also lost, meaning that another node connected to the broker may have already picked up the message. So a retry in this case

How to specify which Azure Service Bus Topic to use with MassTransit

浪尽此生 提交于 2020-06-27 16:39:51
问题 I've tried using MassTransit to publish a message to a topic named events in an Azure Service Bus. I have problem configuring MassTransit to use my predefined topic events , instead it creates a new topic named by the namespace/classname for the message type. So I wonder how to specify which topic to use instead of creating a new one. This is the code I've tested with: using System; using System.Threading.Tasks; using MassTransit; using MassTransit.AzureServiceBusTransport; using Microsoft

How to specify which Azure Service Bus Topic to use with MassTransit

蓝咒 提交于 2020-06-27 16:39:24
问题 I've tried using MassTransit to publish a message to a topic named events in an Azure Service Bus. I have problem configuring MassTransit to use my predefined topic events , instead it creates a new topic named by the namespace/classname for the message type. So I wonder how to specify which topic to use instead of creating a new one. This is the code I've tested with: using System; using System.Threading.Tasks; using MassTransit; using MassTransit.AzureServiceBusTransport; using Microsoft

RabbitMQ - access to vhost 'XXX' refused for user 'guest'

佐手、 提交于 2020-06-27 09:21:16
问题 I am using RabbitMQ 3.0.3 version. The service was working fine for last 4-5 years. Recently some updates patches were installed on the server and the Service stopped responding. This is what is happening: The RabbitMQ service (windows service) is running but not responding. In the log file I see error access to vhost 'XXX' refused for user 'guest' The management console is throwing site cannot be reached error What options do I have here? I cannot update RabbitMQ version as my code starts to