This article follows on from a previous blog I wrote about sending and receiving messages between a single sender and single receiver using Azure Service Bus queues. Here I will expand on the FIFO queue functionality to describe how to implement a 1-to-many relationship using a publish and subscribe pattern, where multiple receivers can subscribe to receive the same messages.
All sample code is written in C# using .NET Core and can be found within my GitHub.
A message is sent from a sender,
Publisher, to an Azure Service Bus topic. A topic is very similar to a queue with…
How to process messages on an Azure Service Bus queue
Azure Service Bus is a managed messaging service used to send messages asynchronously between applications.
It works on two different models:
These work on a 1-to-1 relationship in a first-in-first-out (FIFO) order, where there is single sender and a single receiver.
ASP.Net provides us with many built in validation attributes that can be added to model properties and are used to validate user input on a UI. However, there are times when the default attributes don’t fit in with your validation requirements, at this point you should be looking to write your own custom validation attribute.
Let’s look into this a bit further using a simple, easy to follow example.
Default Validation Attributes
As already mentioned, there are many default validation attributes to choose from, some of these include:
There are many benefits to writing clean code, mainly that it makes your code easier to read and understand not just for yourself but also for other developers when they pick it up.
The 5 steps I’ve listed below are nothing new or difficult to understand, what they do is provide a nice introduction into how to start cleaning up your code.
1: Avoid Magic Numbers
Magic numbers refer to hardcoded numbers in code as opposed to using a named constant or enumerated type. …