Event-driven Architectures Jeopardy PDF
Document Details
Tags
Summary
This document covers event-driven architectures with explanations and examples. Concepts like concurrency patterns, service access patterns, and question-answer formats are included. Diagrams illustrate the different concepts and show examples in the context of software development.
Full Transcript
en t - d r i ve n Ev h i te c t u re s Arc Event-driven Architectures for $200 Imagine a library with a limited number of study rooms. Students can request access to a room by talking to a librarian. If a room is available, the librarian assigns it immediately. If no room is free, the s...
en t - d r i ve n Ev h i te c t u re s Arc Event-driven Architectures for $200 Imagine a library with a limited number of study rooms. Students can request access to a room by talking to a librarian. If a room is available, the librarian assigns it immediately. If no room is free, the students wait in line until the librarian informs them that a room has become available. The librarian ensures only one student can occupy a room at a time and manages the queue of waiting students. Select a concurrency pattern. Concurrency patterns Imagine a library with a limited number of study rooms. Students can request access to a room by talking to a librarian (monitor object). If a room is available, the librarian assigns it immediately. If no room is free, the students wait in line until the librarian informs them that a room has become available. The librarian ensures only one student can occupy a room at a time and manages the queue of waiting students. Specify designs for sharing resources among multiple threads or processes 1. Active object: decouples method execution from method invocation 2. Monitor object: synchronizes concurrent method execution to ensure that only one method at a time runs within an object Define higher-level concurrency architectures 3. Half-sync/half-async: decouples asynchronous and synchronous processing in concurrent systems, to simplify programming without reducing performance 4. Leader/followers: an efficient concurrency model where multiple threads take turns to share a set of event sources to detect, demultiplex, dispatch, and process service requests that occur on the event sources. LOG8430 – © F. Guibault et M. Fokaefs 3 Event-driven Architectures for $200 Imagine a library with a limited number of study rooms. Students can request access to a room by talking to a librarian (monitor object). If a room is available, the librarian assigns it immediately. If no room is free, the students wait in line until the librarian informs them that a room has become available. The librarian ensures only one student can occupy a room at a time and manages the queue of waiting students. What is… Monitor Object Monitor Object Librarian Student Monitor Object Structure : requestRoom() Client 2..* releaseRoom() uses 1..* uses Monitor Condition Monitor Lock wait() acquire() notify() release() LOG8430 – © F. Guibault et M. Fokaefs 5 Event-driven Architectures for $400 Chrome uses plugins to allow the presentation of certain media types, like Flash. When a page that contains such media needs to be loaded the browser checks if the appropriate plugin is installed. If it is, the browser automatically invokes the plugin to handle the media. Select a service access and configuration patterns Event-driven Architectures for $400 Chrome uses plugins to allow the presentation of certain media types, like Flash. When a page that contains such media needs to be loaded the browser checks if the appropriate plugin is installed. If it is, the browser automatically invokes the plugin to handle the media. Select a service access and configuration patterns 1. Wrapper Façade: encapsulates the functions and data provided by existing non-object-oriented APIs within OOP class interfaces 2. Component configurator: allows an application to link and unlink its component implementations at run-time without stopping 3. Interceptor: allows services to be added transparently to a framework and triggered automatically when certain events occur 4. Extension Interface: allows multiple interfaces to be exported by a component. Event-driven Architectures for $400 Chrome uses plugins to allow the presentation of certain media types, like Flash. When a page that contains such media needs to be loaded the browser checks if the appropriate plugin is installed. If it is, the browser automatically invokes the plugin to handle the media. What is… Interceptor Interceptor Objective: Allow services to be added in a framework in a transparent way and to be started automatically when certain events occur. LOG8430 – © F. Guibault et M. Fokaefs 9 Event-driven Architectures for $600 A FedEx Airbill contains a section labeled: 'Your Internal Billing Reference Information (Optional: First 24 characters will appear on invoice).’ The sender of a package uses this field as a confirmation. This confirmation is returned by FedEx to the sender with the invoice that notifies the sender that the transaction has completed. FedEx deliberately defines this field very loosely: it is a maximum of 24 characters, which are otherwise 'untyped.' Therefore, senders can use the field in a variety of ways. For example, a sender can populate this field with the index of a record for an internal database or with a name of a file containing a 'to- do list' to be performed after the acknowledgment of the FedEx package delivery has been received. Specify an event-handling patterns Event Handling patterns Specify architecture to develop synchronous service providers: 1. Reactor: allows event-driven applications to demultiplex and dispatch service requests that are delivered to an application from one or more clients. (Receiving a phone call) 2. Proactor: allows event-driven applications to efficiently demultiplex and dispatch service requests triggered by the completion of asynchronous operations (voice mail). Specify design to cover a broader range of event-driven application concerns 3. Asynchronous Completion Token: allows an application to demultiplex and process efficiently the responses of asynchronous operations it invokes on services (Cookie). 4. Acceptor-Connector: decouples the connection and initialization of cooperating peer services in a networked system from the processing they perform once connected and initialized (Manager and secretaries). LOG8430 – © F. Guibault et M. Fokaefs 11 Event-driven Architectures for $600 A FedEx Airbill contains a section labeled: 'Your Internal Billing Reference Information (Optional: First 24 characters will appear on invoice).’ The sender of a package uses this field as a confirmation. This confirmation is returned by FedEx to the sender with the invoice that notifies the sender that the transaction has completed. FedEx deliberately defines this field very loosely: it is a maximum of 24 characters, which are otherwise 'untyped.' Therefore, senders can use the field in a variety of ways. For example, a sender can populate this field with the index of a record for an internal database or with a name of a file containing a 'to-do list' to be performed after the acknowledgment of the FedEx package delivery has been received. Specify architecture to develop synchronous service providers: Reactor: (Receiving a phone call) and Proactor: (Voice mail). Specify design to cover a broader range of event-driven application concerns: Asynchronous Completion Token: (Cookie) and Acceptor-Connector: (Manager and secretaries). Event-driven Architectures for $600 A FedEx Airbill contains a section labeled: 'Your Internal Billing Reference Information (Optional: First 24 characters will appear on invoice).’ The sender of a package uses this field as a confirmation. This confirmation is returned by FedEx to the sender with the invoice that notifies the sender that the transaction has completed. FedEx deliberately defines this field very loosely: it is a maximum of 24 characters, which are otherwise 'untyped.' Therefore, senders can use the field in a variety of ways. For example, a sender can populate this field with the index of a record for an internal database or with a name of a file containing a 'to- do list' to be performed after the acknowledgment of the FedEx package delivery has been received. What is… Asynchronous Completion Token (ACT) Asynchronous Completion Token (ACT) Mail Sender FedEX Internal Billing Reference Information LOG8430 – © F. Guibault et M. Fokaefs et Z. Sharafi 14 Event-driven Architectures - Bonus A book is consisting of edited collections of papers that are organized into one or more 'themes'. For example, Pattern-Oriented Software Architecture book consist of individual papers that are organized into cohesive sections, such as event handling, or concurrency. Thus, readers who are interested in a particular topic area or domain can focus their attention on these sections, rather than having to locate each paper individually Select a service access and configuration patterns 1. Wrapper Façade: encapsulates the functions and data provided by existing non- object-oriented APIs within OOP class interfaces 2. Component configurator: allows an application to link and unlink its component implementations at run-time without stopping 3. Interceptor: allows services to be added transparently to a framework and triggered automatically when certain events occur 4. Extension Interface: allows multiple interfaces to be exported by a component. Wrapper Façade Paper 1 Book Paper 2 Chapter 1 (paper 1 and paper 2) Paper 3 Chapter N (paper 10, 11, 12) LOG8430 – © F. Guibault et M. Fokaefs 16