
Design and implement secure microservices with a custom identity service, JWT-based authentication, and an API gateway, while exploring event-driven messaging with RabbitMQ and Azure Service Bus.
design, deploy, and test azure-hosted microservices—api gateway, product, inventory, identity, and notification—via postman, with token authentication and monitoring azure service bus and email notifications.
Explore flexible study paths for advanced microservices with .NET, focusing on identity service, API gateway, event-driven patterns, Redis cache, and NuGet packages, with Azure deployment and RabbitMQ integration.
Begin the implementation by creating NuGet packages, starting with the auth library, followed by the response wrapper library, with an overview and introduction in those sections.
Master cross-cutting concerns in dotnet microservices by building a private nuget package for authentication and permissions, publishing to azure devops, and configuring it in visual studio.
Create a C# class library project in Visual Studio 2022 for a NuGet package using dotnet eight, then add an authentication constants folder with app service and identity service constants.
Define application actions for create, read, update, and delete and build a permission model with a helper that creates strings like permission.identity.users.create from service, feature, and action, including group-based roles.
Define and organize app permissions using a public EB role group, then build identity permissions for the users feature, roles, and role claims with CRUD actions in system access grouping.
Define a private field and expose it with public static read-only permission lists, including all permissions and non-admin (non-basic) ones. Demonstrate filtering, converting to an array, and preferring interfaces over concrete implementations in .NET microservices.
Define and use JWT claim constants, including permission, exp, and issuer (gateway), to support token generation and validation in .NET microservices and Azure deployments.
Define a permission requirement and a permission policy provider to enforce access, implement IAuthorizationRequirement with a permission, and set up the authorization package for dotnet eight.
Create a permission policy provider that dynamically builds authorization policies from defined permissions, using a default policy provider as fallback, and implement a permission requirement for claims.
Implement a permission authorization handler to evaluate user claims against a permission requirement using a policy provider, claims, and issuer checks against the gateway, with async evaluation.
Create a custom authorize attribute in the attributes folder to enable permission based authorization by composing permissions from service, feature, and action and mapping them to a policy.
Add package metadata to document a library, including generate package on build, unique package ID, author, company, description, license acceptance, and project URL; commit, push, and monitor the pipeline.
Update the pipeline to pass license checks by adding an MIT license, verify changes, re-run the Azure Pipelines workflow, and publish library version 1.0.2 to a private NuGet feed.
Build a lightweight response library to host cross-cutting models, including a response wrapper, centralized event definitions for service bus publishing, and custom exceptions for global handling across services.
Learn to implement response wrapper interfaces in a dotnet eight class library: a non-generic interface with messages and isSuccessful, and a generic interface adding a data property for returning content.
Implement non-generic response wrappers in a .NET microservices context by creating a public class that implements interfaces, with fail and success helpers, and synchronous and asynchronous overloads for messaging.
Develop a generic api response wrapper in .NET by extending the base response wrapper, implementing data properties, and adding synchronous and asynchronous fail and success methods with optional messages.
implement a generic asynchronous response wrapper for microservices in .NET, turning synchronous success and fail paths into async task results, with multiple overloads and custom exceptions.
Create a public custom validation exception with error messages, a friendly message, and an http status code, and throw it on validation failures to enable global exception handling middleware.
Create a service unavailable exception for gateways, implement a response wrapper extension to deserialize http responses into a generic wrapper with json options and reference handling for robust inter-service communication.
Develop a non-generic to response extension method for deserializing response wrappers without a specific type, then publish a new nuget package and push the commit.
Configure NuGet package metadata for the global response wrapper, set the package id and MIT license, then create an Azure DevOps repo and pipeline to publish to a NuGet feed.
Develop and deploy .NET microservices by configuring a CI-CD pipeline, linking to repos, building and packaging NuGet packages, and publishing to Azure Artifacts for automated release.
Learn to build an identity service for microservices with .NET, enabling user CRUD, roles and claims, login with JWT, and a gateway using EF Core, CQRS with mediator, and FluentValidation.
Build a clean-architecture identity service in .NET by creating layered projects (application, infrastructure, web API) and planning microservices with independent repositories and an API gateway.
Install essential packages in the application and infrastructure layers, including mediator, mapster, flow and validation, and dependency injection, then configure entity framework core identity with sql server for dotnet eight.
Extend the ASP.NET identity model by inheriting IdentityUser to create an application user with first name, last name, a JWT refresh token, its expiry, and an active flag.
Create an application role that inherits identity role, add a description and a role claim with a group, then extend the models and ASP.NET Identity DB context.
Build a startup extension to register the application db context via dependency injection, read the default connection string, and configure EF core with migrations history and retry logic.
Execute EF Core migration using the package manager console in the web api starter project, create the first db generation, and apply it to the identity schema and tables.
Design and implement identity service request and response models for API integration, using an API gateway, a response wrapper, and a shared NuGet package for front-end and back-end use.
Create a root models folder with identity request and response subfolders, then design a user registration request model including first name, last name, email, username, and password.
Explore identity models for microservices, including update user (using user IDs), create and update role (using role IDs), login token, refresh token, and password and status change requests.
Create identity responses for user and role, expose properties to the front end, and define a user role view model for assignment state and an update user roles request.
Design a role claim view model to map identity claims and permissions for a role, including claim type, value, description, group, and assignment status.
Implement update role claims request to assign or unassign permissions for a role, and return a token with a refresh token for seamless frontend authentication.
Commit identity request and response models, push to Azure, prepare a pull request, and publish a NuGet package version 1.0.1 while updating the identity service in the application layer.
Update the NuGet package from a private feed and confirm the latest version is applied. Implement CQRS in the application layer with mediator for user management and identity features.
Change the NuGet package ID to Cloud Toys dot response wrapper, publish to the public and private feeds, update the release pipeline, and verify the new package installs without conflicts.
Implement a user registration command with mediator, create a user registration request and a handler implementing IRequestHandler with an asynchronous handle method to register a user via a dedicated interface.
Define a public user service interface in the application layer and implement asynchronous user registration via a contract-driven architecture, with dependency injection and separate infrastructure implementation.
Learn to assign new users to a default basic role using the user manager and define application roles, basic and admin, with a default roles list for secure access control.
Implement user registration flow by validating email uniqueness, creating an ASP.NET identity user with hashed password, and assigning the user to a basic role after ensuring the role exists.
Define the update user command and its mediator handler to perform an asynchronous update using the update user request and user service, returning a response wrapper.
Implement update user in user service by locating a user by id, updating first name, last name, and phone number, persisting with update async, handling missing users and identity errors.
Add user service signatures to the interface to accelerate the tutorial. Implement methods like get user by id, get all users, change user password, and get user by email address.
Implement get user by id in a .NET microservice, fetch the user from the database, map to a user response DTO, and return a success or not-found result.
Implement get all users async with mapping to user responses and return success or no users found; enable change password async and change user status async with validation.
Implement get user roles async by injecting the role manager, retrieving all roles, and marking which are assigned to the user in a list of user role view models.
Implement get user roles asynchronously using a role manager to fetch all roles and mark each as assigned to the user, returning a list of user role view models.
Implement asynchronous update of user roles with a safeguard using a constant admin credential to prevent admin role removal, verify user exists, then remove and reassign roles.
Create a change user password command as a mediator request with a change password payload—user, current, new, and confirmation—and handle it via a dedicated handler calling the user service asynchronously.
Learn how to implement change user status and update user roles commands via a mediator pipeline that runs validations, with async handlers, response wrappers, and a user service interface.
Develop first user queries: get all users, get user by id, and get user roles, using public queries with a response wrapper and injected user service.
Define and implement the role service interface for managing roles in a .NET microservices architecture, including create, update, delete, lookup, and permissions handling with role manager and user manager.
Validate the role’s existence and ensure it’s not an admin role. Verify no user is assigned via the user manager; if unassigned, delete via the role manager and report success.
Explore get by id and get all roles, update safeguards for admin roles, and mapping domain roles to role responses with success or failure outcomes.
Update role permissions by performing a drop-and-lift of role claims, validate that admin role cannot be changed, map view models to application role claims, and persist changes with the application db context.
Implement get permission async to return all permissions from constants, flag those assigned to a role, validate a role, and map role claims into role claim response using OAuth library.
Build role management with commands and queries using mediator requests, implementing create, update, delete, and update role permissions commands with dedicated handlers and a role service, returning response wrappers.
inject the role service and implement get roles, get role by id, and get permissions queries, returning success or not found messages.
Register identity and role services in the infrastructure layer via a startup extension, wiring IUserService and IRoleService as transient dependencies and exposing them to the web API with identity services.
Seed roles, users, and permissions in an application database by migrating the database, creating default roles admin and basic, and assigning permissions via a role manager and user manager.
Seed identity data by creating admin and basic users, hash passwords, and assign the basic and admin roles via the user manager, ensuring no duplicates and enabling startup seeding.
Add a transient database seeder to the dependency injection pipeline by creating a startup extension on the web API, resolving ApplicationDbContext and running SeedIdentityDatabase asynchronously in development.
Examine the database before and after seeding, then resolve DI errors by wiring identity settings in the web api, including application user and role, and permission policy provider.
Troubleshoot database seeding by resolving foreign key conflicts, normalize emails to lowercase, create a basic user and admin user, and assign the basic role.
define a public token service interface with get token async and refresh token async methods to issue a jwt token and refresh token using token request models.
Implement a token service in the infrastructure, wiring login to issue a JSON web token after validating credentials, using user manager and role manager, with token settings loaded from configuration.
Inject token settings via the I options pattern, validate the user in the database, check active and email confirmed, then generate a refresh token and JWT.
Build an authentication token by aggregating user claims, roles, and permissions, and include name identifier, email, first name, last name, and phone number in the token.
Learn to create private helpers for obtaining signing credentials from app secrets, generate and encrypt JSON Web Tokens, and return a token response with refresh token handling in .NET.
Implement a refresh token flow by validating expired tokens with configured issuer, audience, and signing key, extracting claim principals to issue a new json web token via a private helper.
Generate and validate a refresh token by extracting the email from the user principal, verify against the database, update the user's refresh token and expiry, and return the token response.
Implement dependency injection for token services by adding a transient AI token service and the token service, ensuring they are injected into the program and the web API.
Develop token features in the application layer by building two mediator queries (get token and generate refresh token) with a token service and integrate with controllers.
Create a startup extension on the application layer’s service collection to register dependencies and MediatR, using the executing assembly and register from assemblies.
Build a login endpoint in a .NET web api using a generic base controller that injects mediator, then a token controller that handles login via http post and returns token.
Implement a refresh token endpoint via http post, using the request body, invoking a GetRefreshTokenQuery through mediator, and returning ok or bad request with the response.
Register JSON web token authentication into dependency injection by configuring a JWT bearer in startup, including token validation, issuer, audience, signing key, and events for expired tokens.
Iterate nested app permissions, use reflection to read public static permission constants, and add them to in-memory authorization options; configure JWT with token settings and test login.
Login test returns 200 with a jwt and refresh token, detailing user claims, roles, and permissions. Protect endpoints with the authorize attribute and test token-based access via swagger.
Create a secured users controller with endpoints for register, get by id, get all, update, change password, change status, and update roles, protected by a must-have-permission attribute on identity service.
Create a roles controller with endpoints to create, delete, update roles and update role permissions, plus get role by id, get all roles, and get permissions for a role.
Demonstrate role controller endpoints for create, get all, get by id, update, and delete, protected by permissions, and show role permission queries and updates in the ASP.Net identity context.
Enable Swagger to receive JWT bearer tokens from the authorization header by configuring SwaggerGen with security definitions and requirements, and wire this into the DI container.
Align JWT validation parameters, generate tokens with issuer and audience, and test protected endpoints using bearer tokens to enforce permission-based access in a microservices identity setup.
Explore user request validation in a clean architecture identity service using fluent validation and MediatR pipeline behavior, comparing validation without and with the mediator pipeline for the user registration endpoint.
Learn how to implement fluent validation for a user registration request, register validators via dependency injection, and validate at the controller level without a pipeline, returning 400 with error messages.
Shows fluent validation for registration, highlighting missing first name and invalid email errors, and explains moving from manual validation to a mediator pipeline for global validation.
Implement a mediator pipeline behavior for validation in the application layer, wiring fluent validators, executing all validations, handling failures, and conditionally invoking the next handler.
Register the pipeline in dependency injection as a transient, resolve the pipeline behavior and validation, and route requests through the mediator pipeline to enforce validation before handling.
Develop an api gateway with ocelot to centralize access to the identity service and microservices, validate tokens with JWT bearer, forward headers, and implement retries with Polly and custom middleware.
Review the Ocelot repository to learn how to build an API gateway, explore the docs and features, and prepare to implement routing using the official documentation.
Create a new api gateway project in Visual Studio with dotnet eight, remove swagger and controllers, adjust program.cs and endpoints, and prep to install the required packages for deployment.
Install and configure essential microservice packages using the package manager, add the Ocelot provider for retries, include JWT bearer authentication, and create an app settings json for the api gateway.
Define upstream and downstream routing in an api gateway to expose a login endpoint that forwards to the identity service, using https, a post method, and route paths like /auth/login.
Configure program.cs to read ocelot.json with builder.configuration, making it required and reloadable, register ocelot in dependency injection, and use the ocelot middleware for api gateway testing with postman.
Set up a Postman workspace and abc retail collection, configure URL and bearer token, and build a login post endpoint with username and password in JSON for api gateway testing.
Launches the identity service and API gateway, handling a swagger 404 caused by a missing file. Uses postman to obtain a json web token via the gateway and confirms access to downstream services.
Replace the swagger launch with a custom api gateway landing page by adding index.html to wwwroot and enabling static files and routing.
Configure the API gateway to validate incoming user tokens with a JWT bearer, read the secret from configuration, and forward valid tokens to downstream services while protecting endpoints.
Implement JWT bearer authentication in the gateway, handling token expired and validation events with identity bearer events, and configure Program.cs to register JWT authentication and enforce protected endpoints.
Extend the dependency injection setup by implementing an internal static extension method on IServiceCollection to register the authorization policy provider and authorization handler with identity settings.
Define an upstream route for user registration, secure it with bearer JWT at the gateway and downstream identity service, and forward the authorization header to the downstream endpoint.
test a user registration endpoint with postman by sending a post request to the identity service behind an api gateway, using a jwt bearer token and json body.
Explore how to automate token handling in Postman using pre-request and post-response scripts to extract a login token and set the authorization variable for subsequent requests.
Set up upstream and downstream routes in the API gateway to get a user by id from the identity service. Authenticate with a bearer token and test endpoint via Postman.
Demonstrates how the API gateway handles a down identity service by replacing 502 with a custom middleware that throws a service unavailable exception and returns a global 503 response.
Implement a custom error handling middleware in .NET microservices to convert 502 service unavailable responses into friendly json errors using a global response wrapper and a dedicated exception.
Test the gateway and identity service, observe 503 service unavailable, and learn to report specific unavailable services (A, B, C) to streamline debugging, with upcoming handler changes.
Create a private static helper to derive the downstream domain from the HTTP context by reading downstream routes and assembling scheme, host, and port for API gateway routing.
Implement a dotnet api gateway with ocelot to show friendly 'service temporarily unavailable' messages when downstream services fail, using configured routes.
Push the implemented API gateway to Azure DevOps source control, create the A, B, C gateway repo, and prepare to integrate the next microservice behind the gateway.
Configure cors in the api gateway through dependency injection. Define a policy named abc client that allows any origin, method, and header, then enable the cors middleware.
Review the architectural diagram and mark completed components, the gateway and identity service are functional and pushed to the repo. Begin phase two by starting development of a service.
Clarifies system assumptions and shows how to design domain-specific microservices using the identity service and API gateway, with authenticated inter-service calls and event-driven messaging.
Design and implement the product catalog API for a microservices inventory, publishing product added and removed events to RabbitMQ or Azure Service Bus, with Redis caching and CQRS via mediator.
Define and implement a product service using clean architecture in .NET 8, creating domain, application, infrastructure, and web API projects with Swagger OpenAPI, and wiring up project references.
Define Brent (brand), product, and image entities with keys and navigation properties in entity framework, linking images to products and handling base64 data and a reorder threshold.
Install EF Core packages for SQL Server in dotnet eight: Microsoft Entity Framework Core, design, SQL Server, and tools. Then create the DB context to enable database creation and interaction.
Create the application db context with entity framework core, define db sets for Brent, product, and images, and register it via dependency injection using the default connection string.
Complete the DPA context and dependency injection setup, then implement CRUD by adding brand, product, and image request and response models inside the response wrapper NuGet package for frontend access.
Define product response models, including brand and image responses, with navigation properties and encapsulation to exclude audit fields; prepare the NuGet package IDs Cloud Toys dot response wrapper.
Install the chosen NuGet package in the application layer, from the private feed, then install MapTo to map incoming requests to domain entities and map domain entities to outgoing responses.
define a features folder to group capabilities, implement brand with cqrs by commands and queries via mediator, and expose an IBrandService with async create, update, delete, and get by id.
Define image and product service interfaces, create CRUD endpoints for images and products, and implement get by id and get by product to return image lists for specific products.
Implement the product service in the infrastructure layer with entity framework, injecting the application DbContext to create a product, save changes, and return the new product id.
Implement a complete product service in a .NET microservice, covering delete, get all, get by id, and update operations with proper null checks, context removal, and save changes.
Implement image service for products by creating, saving, retrieving, and deleting images via the application db context, with existence validation and product id queries.
Build the brand service by completing the skeleton to implement the I brand service interface, matching the previously implemented image and product services.
Refactor the brand service to move product existence checks and property mapping to the application layer, while the service layer's update async uses the DbContext to update and save.
Register your application services into the dependency injection container by creating an extension on IServiceCollection, wiring IProductService and IImageService to their concrete implementations as scoped services.
Create a brand command with mediator, wire a handler using dependency injection and a brand service to create the brand, and return the new id in a response wrapper.
Use fluent validation to require brand name and description, and copy the identity service validation pipeline into the application layer with IValidateMe and mediator.
Create a static startup grouping for dependency injection in the application layer, wiring mediator, fluent validation, and a custom validation pipeline behavior.
Create brand command validators by moving validation to a dedicated create brand request validator in the mediator pipeline, enforcing name not empty with max 60 and description max length 450.
Create a brand API controller endpoint that uses mediator to send a create brand command, wire dependencies, run validation, and return success or bad request responses before database migrations.
Configure the connection string to the product database, register the DbContext, run and name the initial migration, and apply it to create brand, product, and image tables with constraints.
Test and validate the create brand command within a .NET microservice pipeline by inspecting requests, applying the create brand command validator, and handling 400 errors or successful database creation.
Implement the update brand command using a mediator pattern, mapping the update request to a domain brand, updating via the print service, and returning a brand response.
Implement domain-level validation for update brand request by injecting the brand service to asynchronously get by id and ensure it exists, while validating name and description.
Learn command-level validation for updating a brand, set up a put endpoint using a mediator, and validate the update against the domain with existence checks.
Explain domain level validation fix for get by id in brand service: return a new brand when not found and validate the ID is greater than zero to confirm existence.
Demonstrate testing the update brand endpoint with a non-existent id, triggering validation, 400 bad request handling, and debugging the change tracker issue in the service.
Explore how to handle Entity Framework Change Tracker errors when updating a brand, using no-tracking reads for validation and ensuring updates respect the same primary key.
Introduce a clean change tracker solution by using a no-tracking get by id and a does exist async lookup to verify brand existence without loading the full entity.
Apply consistent authentication and authorization across API gateway and downstream services to enforce all-level security. Protect product service endpoints with token validation and permissions to prevent unauthorized access.
Define product service permissions in the earth library, register features such as brands, products, and images, and publish these permissions to support token generation by the identity service.
Upgrade the auth library in the identity service to version 4, seed basic and admin roles with permissions, and apply the product service permissions via application role claims for deployment.
implement authorization in the product service by validating json web tokens, wiring token settings, and integrating a permission-based policy provider and authorization handler with swagger security.
Expose swagger ui in production by updating the custom swagger documentation. Enforce must have create and update permissions on endpoints via app service and product service, then test with postman.
Configure the API gateway to expose product service endpoints (create product, add brand, update brand), forward JWT in the authorization header, and configure Postman tests.
Push your product service code to an azure devops repository, authenticate with visual studio, and include a readme to document what the api does as you push to master.
Configure a postman product service endpoint to post a brand in JSON to the API gateway, secured by a bearer token with a shared secret from token settings.
Test the create brand and update brand endpoints while explaining a switch of development machines to ensure audio and video stay in sync, improve performance, and invite feedback.
Validate token-based configuration across product, identity, and API gateway services, log in as admin, verify permissions with jwt.io, and create a brand via secured endpoints using the authorization token.
Update a brand via a put request with bearer token, include the brand id and updated body, verify the database update, and show a 'brand updated successfully' message.
Commit all changes and push the branch to enable collaboration in a shared source control environment. Review identity service updates and package changes, then focus on the product service.
Practice implementing the remaining brand endpoints in the product service using CQRS, validations, and API gateway configuration; test deletion, query by ID, and query all brands via Postman.
We review current progress on the product catalog service API and note that brand management within product has been implemented. Next, implement CRUD operations for the product entity.
Create a product command in the product service using MediatR, map the create product request to domain product, and return a response wrapper containing the product ID.
Create a product endpoint in a .NET microservices architecture, leveraging mediator, base controller inheritance, and asynchronous post requests to create a product and route it through the API gateway.
Protect the product creation endpoint by enforcing permissions and forwarding the JSON web token through the API gateway to the product service feature products create endpoint, and test with Postman.
Configure a postman request to create a product, linking to a brand with a JSON body and token authentication, then validate the RabbitMQ-driven product added event.
Create a product request validator by implementing a fluent validation for the create product request, validating brand existence, name constraints, and domain checks, and wiring it to the command.
Develop a create product command validator with a reorder threshold rule for integers, ensuring not empty and not default zero, implementing IRequest and IValidateMe.
Test product creation in postman against a brand foreign key, verifying empty or non-existent brand IDs trigger validation errors and showing all validations at once.
Create an end-to-end update product workflow with a command, handler, validations, and service update, then expose a secured put endpoint and map the result to a product response.
Implement update product validations by creating an update product request validator, adding does exist async checks against the product service, and a command validator wiring product and brand domain checks.
In postman tests for the product service, validate validators by testing non-existent product 11 and brand 11, confirming not exist responses and a bad request when validation fails.
Implement a delete product command and endpoint by looking up the product, deleting asynchronously via the service, and returning a success or failure message in a response wrapper.
Configure and test the delete product endpoint in postman, with authorization and an id route, validating successful deletion and error handling for missing id or unavailable service.
Set up a get product by id query via mediator, route through the product service, map to a product response with mapster, and return failure if not found.
Develop and test a get product by id endpoint secured with read permission, using mediator queries and a downstream gateway, validated by postman; plan Redis cache and RabbitMQ.
Implement a get all products query with a response wrapper, map results to a product response, and return success or not found; configure the api gateway and test with Postman.
Explore Redis cache to temporarily store response data, speed reads from cache, and support scalable microservices with a local Redis server and a Redis desktop manager.
Implement a pipeline level cache in the product service using Redis, defining a generic cache pipeline behavior and a cacheable interface with key, bypass, and sliding expiration, configured via options.
Implement a cache pipeline in .NET microservices by checking bypass flags, deserializing cached data, reading and writing cache with a structured key, and applying sliding and absolute expiration.
Add and bind cache settings in appsettings, configure them via an IServiceCollection extension, and register a Redis cache in program.cs with a 5-minute sliding expiration for the product service.
Configure Redis cache in the .NET microservices pipeline by implementing the Ike interface with a cache key, registering Redis in program.cs, and using a cache-aside strategy.
Implement product list caching in a .NET microservices setup by defining a cacheable interface, building a cache key from the application name and request details, and testing with postman.
Assess cache behavior for get all products by validating cache writes, sliding and absolute expiration, and using the cache aside pattern to read from cache instead of the database.
Review progress by confirming Redis cache in the product API is complete. Prepare to publish events to RabbitMQ once the inventory API is created, with services subscribing to those events.
Install Ealing and RabbitMQ server on your Windows machine to run locally, download the 64-bit Windows installer, and access the management dashboard at localhost:15672 to view queues.
Install MassTransit packages in the infrastructure layer to enable publishing to RabbitMQ, then configure MassTransit to use RabbitMQ, with future compatibility for Azure Service Bus.
Configure rabbitmq in the dependency injection container using mass transit, connect to a local rabbitmq host with guest credentials, inside a .NET web api startup.
Publish product created events to the service bus via rabbitmq by defining event models in the response wrapper package, including id, name, and quantity for inventory creation.
Update and verify package installation, restore NuGet packages, and update to version 4.0.4. Then implement a service bus publishing interface following the CRUD pattern to enable message publishing on RabbitMQ.
Implement a generic event publisher using MassTransit’s publish endpoint to publish messages to RabbitMQ, injected via DI as a scoped service.
This lecture shows publishing a product created event after product creation, injecting an event publisher, and sending the event to RabbitMQ with id, name, threshold, and quantity.
Publish a product created event to RabbitMQ, create and bind a durable queue to the exchange, and confirm the message is published and ready for consumers.
Discover a quick RabbitMQ overview: nodes, connections via dependency injection, channels, exchanges, and a queue. See messages wait with zero consumers, illustrating a disconnected architecture.
Publish the product deleted event to services, exposing a product removed event package and wiring it into the delete flow with rabbitmq exchanges and queues to notify the inventory service.
Address product quantity technical debt by adding a quantity property to the product entity, running migrations to update the database, and enforcing quantity is not empty on create and update.
Update: the product catalog API is at 95% with Redis cache and RabbitMQ publishing; we will implement synchronous calls with inventory, then create the inventory service as a separate application.
Onboard and implement the inventory service from scratch, creating inventory items for each new product via the product service's event, while defining auth permissions for inventory management.
Update the identity service with the package, including the auth library and response wrapper, rebuild to verify zero failures, commit and push to master, then proceed to inventory service development.
Open Visual Studio and create a blank solution for an inventory service, then define domain, application, infrastructure, and Web API layers in dotnet eight with swagger and controllers.
Define an inventory item entity with id as primary key, productId as foreign key, a barcode, a status string, and createdOn timestamp, preparing a database table with Entity Framework Core.
Install EF Core packages from infrastructure and create a db context for inventory items. Configure dependency injection, read the connection string from configuration, and define a migration schema and table.
Create and apply an inventory migration in the web api project to generate the database and tables with EF, then verify and correct spelling for a proper inventory schema.
Install MassTransit RabbitMQ packages and configure consumption of product events in the inventory service, enabling publishing from infrastructure and consuming in the application layer.
Create a product created event consumer in the inventory service using MassTransit and RabbitMQ, binding the event type to the consumer and reading the payload from the consume context.
Wire RabbitMQ into dependency injection with a dedicated extension method. Configure MassTransit, host, username, and password, a product created consumer, and a receive endpoint with retries and prefetch.
Learn how to test a product created event by consuming messages with a dedicated inventory service via RabbitMQ, demonstrating a disconnected microservice architecture and message logging.
Define inventory and inventory item models, create request and update status requests, and implement a response wrapper to support listing inventory items via a NuGet package.
Defines and implements a public inventory item service for bulk creation, retrieval, status updates, and deletion, then wires it into dependency injection and configures it in program startup.
Install mediator in the application layer, define CreateInventoryItemCommand with a handler, and map product created events to domain inventory items, setting created on to utc now before persisting items.
Builds inventory item requests from a given quantity and generates barcodes. Uses a barcode helper to combine product ID with a unique timestamp and sends the data via mediator command.
Prepare dependency injection by creating a startup extension to add MediatR, resolving assemblies, and wiring mediator into the service container. Configure the consumer to publish messages to RabbitMQ on localhost.
Explore building decoupled microservices with .NET and Azure by publishing product created events to RabbitMQ, consuming them in an inventory service, and enforcing authentication on each request.
Create a consumer for the product deleted event on the product deleted event queue, then update inventory item statuses based on the removed product message.
This lecture explains implementing change inventory item status command and its interface changes to mark all inventory items for a deleted product as removed, via a product deleted event consumer.
Register and inject a product deleted consumer in a .NET microservices app, wiring mediator and RabbitMQ endpoints to consume deleted product events from the deleted queue.
Consume the product deleted event end-to-end, verify the message context and IDs, and update inventory statuses to removed via the gateway and product service.
Announces excluding the supplier service due to course length; demonstrates event bus via product catalog and inventory, and implements only the notification (email) service.
Implement the inventory delete item command with a request handler that calls delete item asynchronously, returns the removed item id, and uses a response wrapper via a controller endpoint.
Implement a get inventory items query as a mediator request returning list of inventory responses, using Redis cache, mapping results, and returning a no inventory items were found message.
Implement a get inventory item by id query in a .NET microservices architecture, including a response wrapper, mapping, Redis cache integration, and proper not found handling.
Implement get inventory items by product id: filter by product id, call async get items, map to inventory item responses, or return not found message with the product id.
Create a mediator-driven change item status endpoint in the inventory items controller, receiving status and id from the request body, and returning 404 when no item exists.
Add endpoints for get all inventory items, get inventory item by id, and get inventory items by product id; enforce security measures across all APIs.
Configure API gateway routes for the inventory backend, defining endpoints for all inventory and items, including get by id and get by product id, with update and postman testing.
Create a Postman configuration for inventory service, organizing commands and queries, adding requests for get all inventory items, get inventory item by id, and update status with bearer token authorization.
Refactor inventory items endpoint testing to ensure id is passed from upstream to downstream, validate get by id and status updates via the api gateway and database.
Implement a separate change inventory item status command, fetch the item by ID, update its status from the request, and apply the change via the inventory service, with controller updates.
Run and test the change inventory item status command, update an item to on hold, verify the status via get by id, and outline creating a single-item deletion endpoint.
Implement and test the delete item by id endpoint via the api gateway, authenticating requests and confirming a 200 success with the item removed from the inventory service.
update the inventory item response model to include the product object by a synchronous call from the inventory service to the product service, enabling eager loading of product details.
Update a package to version 1.0.8, restore dependencies, and extend inventory item by id with product data through inter-service communication, mapping, and product service integration via the api gateway.
Implement token forwarding with a middleware token forwarding handler in the inventory service that reads the authorization header and forwards the JWT via the API gateway to the product service.
Register a named http client in dependency injection to route product service calls through a gateway, configure base address, add token forwarding, and implement a Polly exponential backoff retry policy.
Define and implement GetProductByIdAsync to call the product service by id, fetch product details, and attach them to the inventory item response.
Shows invoking get inventory by ID, conditionally loading product details from the product service, mapping results, and returning a mapped inventory item with optional product data and messages.
Test get inventory item by id with eager loading from the product service in a .NET microservices setup, demonstrating inter-service communication through the API gateway and identity service.
Move rabbitmq host, user, password, and receive endpoints from magic strings into configuration, bind them to a rabbitmq settings model, and inject via DI for configurable retries.
Move RabbitMQ values into configuration and wire them through dependency injection in the product service, using host, username, and password for publish-only messaging while preparing inventory and a notification service.
Develop the notification service to send emails when a product is created or removed, notifying admin users, and expose endpoints to list communications and email delivery status.
Set up a blank solution in Visual Studio for a notification service, building domain, application, infrastructure, and web API projects with an endpoint to retrieve sent emails.
Define a notification domain entity with a primary key id, from, to, isSuccessful, and sendDate, supporting multiple recipients as comma or semicolon separated values, persisted via Entity Framework.
Configure EF Core ORM in microservices by installing EF packages, defining a DB context, wiring DI, and running migrations to create a notifications table in the notification DB.
Set up a web api as startup, run add-migration in the NuGet Console, and apply migration to create notification db and tables. Verify success and subscribe to bus events.
Implement create notification and update success commands, define create notification request and notification response, and release a central response wrapper package for frontend querying.
Learn how to install and register application-layer packages for a notification service, including mass transit, mediator, and response wrapper, using dependency injection in .NET microservices.
Design and implement a create notification command within the application layer using MediatR, defining a command, handler, and response wrapper for notification creation in the naughty vacations feature.
Define INotificationService with CreateAsync, implement it in infrastructure using the ORM DbContext to persist domain notifications via Mapster adapt, and inject via dependency injection.
Register and implement a rabbitmq consumer to process product created events in the notification service, configure rabbitmq settings, and wire the consumer with dependency injection.
Register RabbitMQ in the infrastructure using dependency injection and MassTransit, configure RabbitMQ settings, and enable a product created event to be consumed by inventory and notification services.
Sign up for SendGrid and integrate it with a dotnet web api using c sharp, create and secure an api key, and enable sender authentication.
Install SendGrid NuGet package in the infrastructure layer, define a generic IEmailSender with a sendEmailAsync method that accepts a message object, a title, recipients, and a subject for email delivery.
Configure SendGrid email settings by defining an email settings module with apiKey, fromEmail, and fromName, read them from configuration, and register via dependency injection in startup.
Implement an email sender inside infrastructure, using SendGrid, injected via ioptions config, and render an html template from the templates folder for product created events.
Implement an email sender that reads an HTML template, replaces placeholders including title and date, and sends the message via SendGrid with from, to, subject, and HTML content.
Configure the UseStaticFiles middleware to serve static templates by registering options with a physical file provider for the template directory and mapping the request path, and test to prevent 404s.
Demonstrate wiring an email sender into a microservice consumer with dependency injection, and configure RabbitMQ to broadcast product created events to multiple consumers via separate queues and bindings.
Demonstrates end-to-end email notifications for a new product, showing login, product creation, event publishing, email sending with SendGrid, and message consumption by inventory and notification services.
After sending an email, this lecture logs a database notification by invoking the create notification command via mediator, including from emails, status codes, and the send date with comma-separated recipients.
Test the email notification entry to database by sending emails and confirming they are logged as records in the database.
Expose an endpoint to list all notifications by querying the database asynchronously with EF Core and mapping domain notifications to a response for audit purposes.
Create a get all notifications endpoint in a .NET microservices app by building a notification controller that uses mediator, inherits a base controller, and secures the route with permissions.
Onboard the notification service into the auth library and define the notification app feature. Create a communications group, assign read notification permissions to the basic role, and release the package.
Upgrade notification and identity packages, register dependencies, and configure token settings for JWT-based authentication. Enforce read permission on the notification service and enable swagger across environments.
Configure the gateway to route the get all notifications endpoint to the notification service and test it with postman using a bearer token. Verify identity and notification services operate together.
Push and organize the notification service into an azure devops repository, create a readme, commit code, review the act diagram, and assign homework to implement product removal.
Deploy resources to the Azure portal by creating a resource group with web apps for identity, product, inventory, notifications, and API gateway, plus four SQL databases.
Create a resource group in Azure central US and deploy an identity app service using .NET 8 on Windows, enable App Insights, public access, and a standard S1 plan.
Create an api gateway as an Azure app service in central us with dotnet eight, enable basic authentication and app insights, and plan deployment center for ci/cd and environment slots.
Recap the completed app services—API gateway, identity service, inventory, notification, and product service—within a resource group, plus filtering and stopping services to test downstream offline scenarios.
Create a SQL database server named ABC retail DB server in Central US with SQL authentication ABC retail_admin, enable firewall for Azure services, and then create databases inside the server.
Create identity, inventory, notification, and product databases in the same resource group and server for production, then enable the current IP firewall and use connection strings in pipelines.
Run Entity Framework Core migrations for each service to create identity and product tables, update the connection string in app settings, and apply migrations using update-database.
Migrate and configure the product database by applying migration scripts, creating tables for product, inventory, and notification, and managing sensitive connection strings in the identity and service setup.
Complete migration of inventory and notification databases, validating inventory item and notification tables, and plan to create Azure Cache for Redis and a Service Bus before pipelines and testing.
Learn how to create an Azure cache for Redis, configure subscription, resource group, DNS name, region, size up to 250 MB, public endpoint, and access key authentication for connection strings.
Create an Azure service bus in central US with standard tier and public authentication, validating topic access for future pipelines connecting app services, databases, and Azure Redis.
Learn to set up CI/CD pipelines with Azure DevOps, manage organization and project settings, and enable release pipelines for build and deployment.
Create a service connection in Azure DevOps to link your Azure subscription via Azure Resource Manager and authenticate, then grant access to all pipelines.
Set up an identity service CI pipeline in Azure Pipelines classic editor to restore packages from a private NuGet feed, build the solution, and publish a drop artifact for release.
Configure a release pipeline to deploy the identity service artifact from the CI build to an Azure app service, enabling continuous deployment and swagger verification.
Verify the latest code deployed to Azure by inspecting the identity service overview, default domain, and Swagger documentation. Confirm the identity service and weather forecast endpoint are live.
Prioritize environment variables over appsettings for seed data and configuration, ensuring seed logic runs in all environments, including production, with explicit handling of connection strings in Azure deployments.
Add custom configurations in a production release by modifying Azure DevOps deployment tasks, including token settings, expiry, refresh token expiry, app settings, and connection strings for the identity service.
Add the default connection string in the release pipeline, sourced from the identity database. Hide credentials in the pipeline and enable Azure deployment with environment-variable seed logic.
Validate json, convert integers to strings, deploy via release pipeline, seed identity data, configure app settings and environment variables, verify login and token issuance.
Configure a product service ci/cd pipeline with nuget feeds, restore, build, publish, and release deployment to azure app service, with continuous integration triggered by master branch pushes.
Migrate the product service configurations from RabbitMQ to Azure Service Bus by updating code to use MassTransit and replacing RabbitMQ settings with Service Bus and Redis cache configurations.
Set up a service bus topic with subscriptions for product added and removed events, configure a topic-level shared access policy and connection strings, and migrate code to use service bus.
Install MassTransit Azure Service Bus package, align versions with MassTransit, create a service bus settings model with connection string and topic name, distinct from RabbitMQ, then wire into dependency injection.
Configure mass transit to use Azure Service Bus instead of RabbitMQ, wiring service bus settings, connection strings, and topic names for product created and deleted events.
This lecture demonstrates configuring the product service with service bus topic, Azure Redis Cache, environment variables and connection strings, and validating deployments via CI/CD pipelines.
Test the product service end-to-end by authenticating via swagger, creating a brand and a product, and publishing events to service bus; verify Redis cache integration.
Switch to Azure Service Bus with MassTransit for the inventory service, subscribing to the product topic and configuring consumers for product created and deleted events in the application layer.
Configure a service bus subscription and topic, set up a product created event consumer with retry and message filtering, and switch from rabbitmq to service bus for the release pipeline.
Set up an Azure DevOps ci/cd pipeline for the inventory service, restore and build, publish artifacts, and deploy to Azure app service with service bus and environment variables.
Deploys and verifies the inventory service release, confirms swagger access, and tests service bus topic subscriptions, highlighting a dead-letter for a mismatched product removed event and verifying four inventory records.
Illustrate how a service bus topic broadcasts to multiple subscribers, and how filters keep each subscription aligned with relevant events, using dead letter queue for failed message processing.
Publish messages with a dedicated event name header and implement service bus subscription filters to route product created event and product deleted event, plus a catch-all subscription for failures.
Implement service bus subscription filters by using the event name header to route product created events, verify headers, and validate inventory updates through a live ci/cd deployment and testing workflow.
Validate service bus subscriptions filters by simulating product creation and deletion events, verify messages reach the correct subscribers, including catch-all, and confirm end-to-end processing with inventory updates.
Migrate the notification service to Azure Service Bus, configure Service Bus settings, and subscribe to product added and product removed events via MassTransit, updating app settings and DI.
Demonstrates building and deploying a notification service with service bus integration, a CI/CD pipeline, and production deployment, plus end-to-end email testing using SendGrid.
Configure the API gateway with environment-variable support via ocelot.json, add downstream endpoints for the identity service, and automate releases in Azure DevOps to deploy to an Azure App Service.
Learn to configure an api gateway with detailed routes in Azure App Service. Explore upstream and downstream definitions, authentication, and json-based pipeline configurations.
Apply manual api gateway configuration in azure by adding environment variables via advanced edit, validating downstream service endpoints and deployment through ci pipeline and postman verification.
Verify the Azure API gateway base URL via Postman after deployment, log in, and test identity, inventory, product, and notification endpoints to confirm success.
Review the Azure deployment of identity, product, inventory, and notification services with the api gateway and four sql databases, plus Redis cache and Service Bus migration for multi-consumer events.
Are you ready to take your .NET development expertise to new heights? "Advanced Microservices with .NET: Development & Cloud Deployment" is the ultimate guide to mastering the art and science of building modern, cloud-ready microservices. Designed for developers and architects, this course dives deep into advanced patterns, tools, and best practices to equip you with the skills needed to design, implement, and deploy scalable, secure, and maintainable microservices architectures.
In this hands-on course, you’ll start with the foundational principles of microservices and gradually explore advanced topics such as event-driven communication, synchronous messaging, authentication and authorization, and custom NuGet package creation. Using industry-leading tools like MassTransit, RabbitMQ, and Azure Service Bus, you’ll learn how to build systems that handle real-world challenges like distributed communication, data consistency, and fault tolerance.
Throughout the course, you’ll explore critical design patterns like CQRS, the Cache-Aside Pattern, and Clean Architecture, ensuring your solutions are robust, flexible, and easy to maintain. You’ll also learn how to integrate cutting-edge technologies like Ocelot API Gateway, MediatR, and Azure Cache for Redis, and leverage Azure DevOps to automate your CI/CD pipelines for seamless cloud deployment.
This course is packed with practical project, and detailed demonstrations to ensure you can confidently apply what you learn in any professional setting.
Course Highlights
End-to-End Microservices Development
Build, deploy, and manage microservices from scratch, using .NET to tackle real-world challenges.
Practical Cloud Deployment
Learn how to deploy microservices to Azure, configure production-ready environments, and ensure scalability with tools like Azure Cache for Redis and SQL Databases.
Cross-Cutting Concerns
Implement critical features like centralized logging, caching, and robust error handling to ensure your microservices are reliable and maintainable.
Hands-On Learning
Work on practical projects that mimic real-world scenarios, giving you the confidence to apply your skills immediately.
Comprehensive Messaging Frameworks
Master asynchronous communication with RabbitMQ, MassTransit, and Azure Service Bus, ensuring your services can handle complex distributed workflows.
Why Take This Course?
Comprehensive coverage of microservices architecture, tools, and patterns.
Focused on practical, hands-on project that deliver immediate, real-world value.
In-depth exploration of .NET tools and frameworks like MediatR, Ocelot, and MassTransit.
Step-by-step guidance on deploying microservices to Azure.
Detailed tutorials on creating custom NuGet packages, enhancing reusability and consistency across your microservices.
This course isn’t just about learning microservices—it’s about mastering the advanced skills and tools required to excel in building and deploying modern, cloud-based systems. If you’re ready to transform your development career, join us and become The Microservices Architect!