%3CLINGO-SUB%20id%3D%22lingo-sub-2106983%22%20slang%3D%22en-US%22%3EEvent-Driven%20on%20Azure%3A%20Part%201%20%E2%80%93%20Why%20you%20should%20consider%20an%20event-driven%20architecture%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2106983%22%20slang%3D%22en-US%22%3E%3CP%3EEvent-driven%20architecture%20has%20become%20popular%20for%20its%20ability%20to%20ingest%2C%20process%2C%20and%20react%20to%20events%20in%20real-time.%20Event-driven%20is%20not%20a%20new%20paradigm%20however%20the%20proliferation%20of%20microservices%20and%20serverless%20computing%20has%20led%20to%20its%20ability%20to%20fully%20realize%20the%20benefit%20of%20its%20loosely%20coupled%20design%20to%20reach%20infinite%20scale%20without%20the%20need%20to%20manage%20infrastructure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMoving%20to%20an%20event-driven%20architecture%20requires%20a%20restructuring%20of%20how%20you%20think%20about%20your%20application.%20To%20adopt%20an%20event-first%20mindset%2C%20you%20should%20first%20consider%20what%20business%20processes%20could%20be%20optimized%20to%20deliver%20customer%20value.%20These%20business%20processes%20can%20then%20be%20distilled%20down%20to%20a%20workflow%20of%20events.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EWhat%20is%20an%20event%3F%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EAn%20event%20is%20a%20lightweight%20notification%20of%20a%20condition%20or%20a%20state%20change%20that%20occurs%20in%20your%20environment.%20Events%20are%20produced%20from%20event%20sources%20where%20the%20state%20change%20has%20taken%20place.%20Events%20exist%20in%20many%20forms%20from%20checking%20code%20into%20source%20control%20or%20hiring%20a%20new%20employee%20and%20now%20several%20actions%20need%20to%20follow.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EWhat%20is%20event-driven%20architecture%3F%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EEvent-driven%20architecture%20is%20a%20distributed%20system%20pattern%20that%20uses%20events%20to%20communicate%20between%20loosely%20coupled%20microservices%20to%20produce%20highly%20scalable%20applications.%20An%20event-driven%20architecture%20consists%20of%20event%20producers%20that%20generate%20a%20stream%20of%20events%2C%20and%20event%20ingestion%20that%20processes%20messages%20to%20the%20appropriate%20event%20consumers.%20Producers%20and%20consumer%20services%20are%20decoupled%2C%20which%20allows%20them%20to%20be%20scaled%2C%20updated%2C%20and%20deployed%20independently.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22sheltongraves_0-1611855997658.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F250348iF72ABECB9437F017%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22sheltongraves_0-1611855997658.png%22%20alt%3D%22sheltongraves_0-1611855997658.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EPolling%20based%20vs%20event-driven%20architectures%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EIn%20a%20polling%20based%20architecture%20when%20you%20want%20to%20respond%20to%20events%20it%20can%20be%20difficult%20to%20discover%20those%20events%2C%20often%20you%20must%20write%20specific%20code%20across%20different%20API%E2%80%99s%20and%20SDK%E2%80%99s%20to%20continuously%20poll%2C%20looking%20for%20changes%20from%20the%20desired%20event%20source.%20Polling%20based%20architectures%20are%20synchronous%20so%20clients%20must%20wait%20for%20initial%20processes%20to%20complete%20before%20it%20can%20move%20onto%20the%20next%20one.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20an%20event-driven%20architecture%2C%20events%20are%20processed%20asynchronously%20which%20keeps%20threads%20running%20independently%2C%20instead%20of%20having%20to%20wait%20for%20a%20reply%20before%20moving%20onto%20the%20next%20task.%20One%20of%20the%20best%20practices%20for%20event%20driven%20architectures%20is%20using%20an%20event%20broker.%20Event%20producers%20and%20event%20consumers%20aren't%20tightly%20coupled%2C%20so%20you%20can%20change%20producers%20and%20consumers%20just%20by%20communicating%20with%20the%20broker.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fevent-grid%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Event%20Grid%3C%2FA%3E%20is%20the%20event%20broker%20backplane%20that%20enables%20event-driven%2C%20reactive%20programming.%20You%20can%20publish%20any%20event%20to%20event%20grid%2C%20add%20consumers%20to%20event%20grid%20and%20lower%20costs%20by%20eliminating%20the%20need%20for%20constant%20polling.%20Event%20grid%20is%20serverless%20so%20you%20get%20the%20benefits%20of%20publishing%20and%20subscribing%20to%20messages%20without%20the%20overhead%20of%20setting%20up%20the%20necessary%20infrastructure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESince%20event-driven%20architectures%20are%20composed%20of%20loosely%20coupled%20distributed%20services%2C%20serverless%20application%20components%20can%20react%20to%20events%20in%20near%20real-time%20with%20virtually%20unlimited%20scalability.%20Services%20such%20as%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Ffunctions%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Functions%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Flogic-apps%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELogic%20Apps%3C%2FA%3E%20easily%20integrate%20with%20Event%20Grid%20allowing%20you%20to%20build%20serverless%20event-driven%20applications.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22sheltongraves_1-1611855997686.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F250350iE870B855E6D42F9C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22sheltongraves_1-1611855997686.png%22%20alt%3D%22sheltongraves_1-1611855997686.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EWhat%20are%20the%20benefits%20of%20event-driven%3F%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ELoosly%20coupled%3C%2FSTRONG%3E%3A%20can%20add%2C%20remove%2C%20version%20as%20your%20architecture%20grows.%26nbsp%3B%20You%20can%20easily%20add%20in%20a%20new%20event%20consumer%20and%20the%20other%20ones%20don't%20have%20to%20know%20about%20it%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EHighly%20composable%3C%2FSTRONG%3E%3A%20can%20use%20and%20reuse%20different%20event%20driven%20components%20throughout%20your%20solution%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%22Single%20purpose%22%20units%20of%20code%3C%2FSTRONG%3E%3A%20Event%20driven%20architecture%20can%20help%20you%20keep%20your%20code%20from%20getting%20too%20complex%20by%20breaking%20into%20more%20discrete%20parts%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EMaps%20to%20the%20business%20need%3C%2FSTRONG%3E%3A%20Your%20team%20is%20building%20code%20based%20off%20of%20the%20actual%20business%20events.%26nbsp%3B%20%22When%20a%20sale%20happens%22%20is%20the%20event%2C%20so%20what%20should%20happen%20when%20a%20sale%20happens%3F%26nbsp%3B%20Ideally%20the%20real%20world%20events%20are%20represented%20in%20your%20solution.%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EExample%20Scenario%20%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22sheltongraves_2-1611855997703.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F250349i103AA2A4FE2EAEFF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22sheltongraves_2-1611855997703.png%22%20alt%3D%22sheltongraves_2-1611855997703.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-center%22%3EEvent-driven%20architecture%3C%2FP%3E%0A%3CP%20class%3D%22lia-align-center%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOne%20of%20the%20more%20common%20event%20patterns%20is%20when%20a%20customer%20places%20an%20order%20on%20an%20e-commerce%20site.%20When%20an%20order%20is%20placed%2C%20an%20event%20is%20created%20with%20all%20the%20information%20necessary%20for%20other%20services%20to%20carry%20out%20the%20completion%20of%20the%20order.%26nbsp%3B%20The%20task%20of%20completing%20the%20order%20would%20involve%20several%20actions%20that%20would%20be%20processed%20by%20different%20systems%3A%20payment%20is%20processed%2C%20an%20email%20is%20sent%20to%20a%20customer%2C%20inventory%20is%20accounted%20for%2C%20the%20shipping%20label%20is%20produced%2C%20etc.%20These%20actions%20occur%20asynchronously%20so%20services%20do%20not%20have%20to%20wait%20on%20another%20to%20complete%20their%20task.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3EWhen%20you%20should%20use%20this%20architecture%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3EUse%20cases%20for%20event-driven%20architecture%20are%20typically%20driven%20by%20the%20need%20to%20have%20near%20real-time%20processing%20and%20multiple%20subsystems%20processing%20the%20same%20events.%20Many%20of%20the%20common%20applications%20include%20IoT%20applications%2C%20e-commerce%2C%20financial%20systems%2C%20and%20data%20analytics.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20decision%20to%20use%20a%20request-driven%20vs%20event-driven%20architecture%20ultimately%20boils%20down%20to%20what%20problem%20are%20trying%20to%20solve%20and%20how%20you%20will%20benefit%20from%20the%20solution.%20Event-driven%20is%20not%20the%20answer%20for%20all%20scenarios%20however%20it%20is%20a%20great%20first%20step%20to%20begin%20thinking%20about%20business-processes%20as%20first-class%20events%20that%20ultimately%20derive%20customer%20value.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%225%22%3ESummary%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3ETransitioning%20to%20an%20event-driven%20architecture%20is%20an%20opportunity%20to%20modernize%20your%20systems%20to%20keep%20up%20with%20the%20fast-changing%20business%20environment.%20Paired%20with%20a%20serverless%20infrastructure%2C%20event-driven%20architecture%20provides%20the%20agility%20necessary%20to%20scale%20on-demand%20and%20independently%20make%20changes%20or%20update%20services.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20next%20blog%20in%20the%20series%2C%20I%20will%20focus%20on%20how%20you%20can%20build%20event-driven%20applications%20using%20common%20messaging%20patterns%20and%20capabilities%20in%20Azure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20learn%20more%20about%20event-driven%20architecture%20on%20Azure%2C%20check%20out%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Farchitecture%2Fguide%2Farchitecture-styles%2Fevent-driven%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EEvent-driven%20architecture%3C%2FA%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2106983%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Blog%20Post%20Image.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F250346i15901EB17464A9C7%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Blog%20Post%20Image.png%22%20alt%3D%22Blog%20Post%20Image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWhat%20does%20%22event-driven%22%20mean%20and%20why%20should%20you%20use%20it%3F%20An%20introduction%20to%20event-driven%20architecture.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2106983%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3Eazure%20event%20grid%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%20Logic%20Apps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EServerless%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2112069%22%20slang%3D%22en-US%22%3ERe%3A%20Event-Driven%20on%20Azure%3A%20Part%201%20%E2%80%93%20Why%20you%20should%20consider%20an%20event-driven%20architecture%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2112069%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20looks%20great%20on%20paper%20until%20you%20actually%20try%20to%20integrate%20event%20grid%20into%20a%20property%20secured%20vnet%20integrated%20environment.%20Event%20Grid%20does%20not%2C%20will%20not%20and%20cannot%20deliver%20messages%20to%20a%20vnet-integrated%20function%20trigger.%20The%20internal%20design%20precludes%20this%20because%20it%20is%20bafflingly%20designed%20around%20a%20true%20%22push%22%20model%2C%20which%20prevents%20event%20grid%20from%20traversing%20a%20vnet%20boundary.%20It%20was%20extremely%20disappointing%20to%20discover%20this.%20We%2C%20the%20consumers%20(devs)%20of%20Azure%2C%20don't%20care%20about%20the%20internal%20design%20decisions%20-%20we%20only%20care%20about%20the%20higher%20level%20semantics%2C%20and%20the%20choices%20made%20for%20Event%20Grid%20shot%20itself%20in%20the%20foot.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Event-driven architecture has become popular for its ability to ingest, process, and react to events in real-time. Event-driven is not a new paradigm however the proliferation of microservices and serverless computing has led to its ability to fully realize the benefit of its loosely coupled design to reach infinite scale without the need to manage infrastructure.

 

Moving to an event-driven architecture requires a restructuring of how you think about your application. To adopt an event-first mindset, you should first consider what business processes could be optimized to deliver customer value. These business processes can then be distilled down to a workflow of events.

 

What is an event?

An event is a lightweight notification of a condition or a state change that occurs in your environment. Events are produced from event sources where the state change has taken place. Events exist in many forms from checking code into source control or hiring a new employee and now several actions need to follow.

 

What is event-driven architecture?

Event-driven architecture is a distributed system pattern that uses events to communicate between loosely coupled microservices to produce highly scalable applications. An event-driven architecture consists of event producers that generate a stream of events, and event ingestion that processes messages to the appropriate event consumers. Producers and consumer services are decoupled, which allows them to be scaled, updated, and deployed independently.

sheltongraves_0-1611855997658.png

 

Polling based vs event-driven architectures

In a polling based architecture when you want to respond to events it can be difficult to discover those events, often you must write specific code across different API’s and SDK’s to continuously poll, looking for changes from the desired event source. Polling based architectures are synchronous so clients must wait for initial processes to complete before it can move onto the next one.

 

In an event-driven architecture, events are processed asynchronously which keeps threads running independently, instead of having to wait for a reply before moving onto the next task. One of the best practices for event driven architectures is using an event broker. Event producers and event consumers aren't tightly coupled, so you can change producers and consumers just by communicating with the broker. 

 

Azure Event Grid is the event broker backplane that enables event-driven, reactive programming. You can publish any event to event grid, add consumers to event grid and lower costs by eliminating the need for constant polling. Event grid is serverless so you get the benefits of publishing and subscribing to messages without the overhead of setting up the necessary infrastructure.

 

Since event-driven architectures are composed of loosely coupled distributed services, serverless application components can react to events in near real-time with virtually unlimited scalability. Services such as Azure Functions or Logic Apps easily integrate with Event Grid allowing you to build serverless event-driven applications.

sheltongraves_1-1611855997686.png

 

 

What are the benefits of event-driven?

  • Loosly coupled: can add, remove, version as your architecture grows.  You can easily add in a new event consumer and the other ones don't have to know about it
  • Highly composable: can use and reuse different event driven components throughout your solution
  • "Single purpose" units of code: Event driven architecture can help you keep your code from getting too complex by breaking into more discrete parts
  • Maps to the business need: Your team is building code based off of the actual business events.  "When a sale happens" is the event, so what should happen when a sale happens?  Ideally the real world events are represented in your solution. 

 

Example Scenario  

 

sheltongraves_2-1611855997703.png

Event-driven architecture

 

One of the more common event patterns is when a customer places an order on an e-commerce site. When an order is placed, an event is created with all the information necessary for other services to carry out the completion of the order.  The task of completing the order would involve several actions that would be processed by different systems: payment is processed, an email is sent to a customer, inventory is accounted for, the shipping label is produced, etc. These actions occur asynchronously so services do not have to wait on another to complete their task.

 

When you should use this architecture

Use cases for event-driven architecture are typically driven by the need to have near real-time processing and multiple subsystems processing the same events. Many of the common applications include IoT applications, e-commerce, financial systems, and data analytics.

 

The decision to use a request-driven vs event-driven architecture ultimately boils down to what problem are trying to solve and how you will benefit from the solution. Event-driven is not the answer for all scenarios however it is a great first step to begin thinking about business-processes as first-class events that ultimately derive customer value.

 

Summary

Transitioning to an event-driven architecture is an opportunity to modernize your systems to keep up with the fast-changing business environment. Paired with a serverless infrastructure, event-driven architecture provides the agility necessary to scale on-demand and independently make changes or update services.

 

In the next blog in the series, I will focus on how you can build event-driven applications using common messaging patterns and capabilities in Azure.

 

To learn more about event-driven architecture on Azure, check out Event-driven architecture.

1 Comment
Regular Visitor

This looks great on paper until you actually try to integrate event grid into a property secured vnet integrated environment. Event Grid does not, will not and cannot deliver messages to a vnet-integrated function trigger. The internal design precludes this because it is bafflingly designed around a true "push" model, which prevents event grid from traversing a vnet boundary. It was extremely disappointing to discover this. We, the consumers (devs) of Azure, don't care about the internal design decisions - we only care about the higher level semantics, and the choices made for Event Grid shot itself in the foot.