If we look at the “ e.UseRetry(r => r.Immediate(5))” code line, we applied retry operation “5” more times with the “Immediate” policy before MassTransit automatically moves the message to error queue when any exception occurs in the system.Īlso, there are several retry policies you can use like below:Īlso, generally I prefer to use “Incremental” retry policy. It is possible to enable the retry function as below: IBusControl busControl = (cfg =>Ĭfg.ReceiveEndpoint(host, "queue_name", e =>Į.Consumer(() => new PaymentApprovedConsumer()) By the way, most of the time we will get a success for second tries. Some transient exceptions occurs because of our e-mail provider’s web service does not respond at a certain time. Let’s look at the above code block and imagine. Throw new Exception("Something's happened during processing.") In this situations, we can apply retrying option not to lose the messages.įor example: namespace ErrorAndRedeliverHandlingSample Maybe a web service could not return any response or maybe some deadlocks can occur in a database. Sometimes transient exceptions occur at a certain time. With default bus configuration, exceptions are caught by MassTransit middleware and related message moves automatically to “ _error” queues with any network monitoring tool and it will be wise to add some sensors on these, especially for production environment. MassTransit supplies some solutions to us for these situations. Well, if we face any exceptional situations during consuming process what are the next steps? These exceptional situations could be due to coding errors or it can also possible incomplete/ inconsistent messages. Public async Task Consume(ConsumeContext context) Public class PaymentApprovedConsumer : IConsumer namespace ErrorAndRedeliverHandlingSample namespace ErrorAndRedeliverHandlingSample.ContractsĪlso “IPaymentApproved” event’s consumer temporarily defined as below. “IPaymentApproved” event is defined as below. It is possible more than consumer can consume “IPaymentApproved” event and let’s think one of them is responsible for sending an e-mail to the customer about order details. When any order successfully processed on the system, then suppose the system published an event type of “IPaymentApproved”. Imagine, we are working on an e-commerce website. By the way, this is my first English blog post. Also, I will mention what kind of solutions we applied and what kind of solutions MassTransit supplied to us for these concerns. In this article, I will try to explain some of the problems like Error handling and message Redelivery that I have encountered in our transition processes to message architecture. net core Access Token actor model asp.net core asp.net core kubernetes Asp.Net Web API Asp.Net Web API Güvenlik Asp.net Web API Token Based Authentication Assembly azure kubernetes service Bearer Token c# messaging clean architecture CQRS docker dotnetconf dotnet core elasticsearch hexagonal architecture kubernetes masstransit MicroService microsoft orleans Mock Nedir Nesne Yönelimli Programlama NLog OAuth OAuth 2.0 object oriented prensipleri Object Oriented Programming OOP orleans Owin OAuth RabbitMQ Reflection Repository Pattern serverless service mesh Solid Strategy Pattern Token Based Authentication Transparent Proxy Unit Test Archives Nizamuddin on Implementation of Choreography-based Saga in.Gökhan Gökalp on Implementation of Choreography-based Saga in.Harun on Asp.Net Web API ve Mimari Özellikleri Kitabı.Recai on Asp.Net Web API – Token Based Authentication Refresh Token Kullanımı.Gökhan Gökalp on Asp.Net Web API ve Mimari Özellikleri Kitabı.Tasarım Prensipleri (Design Principles) (5).Tasarım Kalıpları (Design Patterns) (7).Nesne Yönelimli Programlama (Object Oriented Programming) (6).Kurumsal Tasarım Kalıpları (Enterprise Design Patterns) (2).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |