We’ll first make a slight change in the Main method of Program.cs:Ĭonsole.Title = "This is the customer registration command receiver." Ĭonsole.WriteLine("CUSTOMER REGISTRATION COMMAND RECEIVER.") We’ve also registered an IConsumer called RegisterCustomerConsumer when building the bus control. It currently listens to commands on the queue called. We also have a project called MassTransit.Receiver in our demo project. When a new customer is registered then we won’t publish all the details to the consuming parties. It has some of the same properties as IRegisterCustomer. Go ahead and insert the following event interface into the library: Our demo project has a M圜ompany.Messaging C# library where we already have a command-style interface called IRegisterCustomer. We know from the previous post and the MassTransit documentation page we referred to that an event name consists of a noun, which is the resource or the domain, followed by a verb in past tense that describes what happened to the resource. The event will be consumed by 2 receivers that the event publisher will not have any knowledge of. The goal is to publish a customer registered event from the register customer command consumer. In this post we’ll extend our demo to publishing a message that can be consumed by multiple receivers. Our first example centred around sending a single command using a single queue. Instead, they are basic terminology in the world of messaging. Therefore commands and events are not some special C# language features in this case. Both are best encapsulated in an interface with get-set properties and separate naming conventions. The message type can by convention be an event or a command. We saw a very basic configuration of the bus control and how to register a consumer for a message type. We managed to send a message from a publisher to a consumer using the MassTransit/RabbitMq client library. In the previous post we got our hands dirty and started coding a small demo application around MassTransit.
0 Comments
Leave a Reply. |