Skip to content

ristica/distributed-system-with-nservicebus-and-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Distributed System

Example of a big company selling some kind of products. The workflow is complex and there is a requirement to create websites for departments (Crm, Shop itself, Sales, Shipping).

Further more, every one of them (department) wants to be notified if there are changes in the workflow that have to be handled by a particular department (they don't want to send mails about the order's state).

Crm => will have the responsibility to put a new products "in the shop" and take care about the price.

Workflow:

An order (Shop Website) has been placed by a customer, the Sales Department (Sales Website) should be notified about the new order (and to make some checks about it). After the Sales Department accepts (or denies => denying the order is not handled here) the order, it should let the Dispatching Department (Shipping Website) know about it, so it can dispatch the order to the customer's address. And the customer should be notified about the current state of the order too => because she wants to know if and when she gets the product(s) she ordered :-) ...

The focus in this app was on showing how a distributed application works - low coupling between services through event based architecture, message durability, service bus role in a distributed app and usage of NServiceBus. Therefore I didn't take care about MVVM (in Crm.Client.Wpf) nor using of some kind of IoC, or unit testing the code. Just for simplicity of this example

These are the projects that you`re going to start to see full power of the event nessaging:

Website (Shop) Website (Sales department) Website (Shipping department) Desktop App (CRM)

They are playing together through MSMQ. Events are being published through Microservices, based on Pub/Sub pattern.

To see complete workflow in action you'll need to open every solution and mark some projects as startable:

  1. CRM
  • Crm.Client.Wpf
  1. SALES
  • Sales.Client.Mvc (website)
  • Sales.Service.Host (SignalR hosting app)
  • Sales.Handler.OrderProcessor (handles order being processed by the client => website)
  • Sales.Handler.OrderForwarder (handles forwarding orders to the dispatcher)
  1. Shipping
  • Shipping.Client.Mvc (website)
  • Shipping.Service.Host (SignalR hosting app)
  • Shipping.Handler.OrderProcessor (handles order being processed by the sales department)
  • Shipping.Handler.ShippingProcessor ("dispatches" received orders)
  1. WEBSITE
  • Website.Client.Mvc (website)
  • Website.Service.Host (SignalR hosting app)
  • Website.Handler.OrderProcessor (handles order being processed by the HomeController because web app sholud not be used to publish any kind of messages)
  • Website.Handler.AcceptOrder (handles status changes of the order's lifecycle => from Sales department)
  • Website.Handler.ShippingProcessor (handles status changes of the order's lifecycle => from Shipping department)

And now start solutions mentioned above, create a couple of products and let the workflow go by placing an order...

About

Microservices Architecture in distributed world

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published