Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
cours:service_oriented_computing_and_web_services_2017_2018:lab_eventing_and_wstutorial:publish_subscribe_pattern_for_eventing_with_web_services [2018/03/29 10:27] tigli [Event Based Communication and Architecture with web services] |
cours:service_oriented_computing_and_web_services_2017_2018:lab_eventing_and_wstutorial:publish_subscribe_pattern_for_eventing_with_web_services [2018/03/29 11:33] (Version actuelle) tigli [Create WCF Service Library (EventsLib.dll)] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ====== Event Based Communication and Architecture with web services ===== | + | ====== Event based Communication and Event driven Architecture with web services ===== |
+ | <note warning> | ||
+ | The solution of the first part of this tutorial is provided below. | ||
- | ===== Your first step by step eventing communications between Web service and Client ===== | + | Add the solution(s) of the second part of this tutorial on your Github repository ! |
+ | </note> | ||
+ | |||
+ | ===== Introduction : Why Event driven Architecture ? ===== | ||
+ | |||
+ | |||
+ | {{ :cours:service_oriented_computing_and_web_services_2017_2018:lab_eventing_and_wstutorial:eda_schema.png?150|}} | ||
+ | |||
+ | Classical Request–response, or request–reply, is one of the basic methods computers use to communicate with each other, in which the first computer sends a request for some data and the second computer responds to the request. | ||
+ | |||
+ | Using request/response communication, client must implement active loop to read periodically a data to refresh its value locally and detect changes. | ||
+ | |||
+ | A typical domain with such a problem is Internet of Things like for example sensors networks. | ||
+ | In fact it's easy to understand that for N sensors, the client must send N requests periodically to test if one sensor measure changed since last requests ! | ||
+ | |||
+ | Event-driven architecture (EDA), is a software architecture pattern promoting the production, detection, consumption of, and reaction to events. | ||
+ | |||
+ | An event can be defined as "a significant change in state". | ||
+ | |||
+ | Some Middleware like [[https://en.wikipedia.org/wiki/MQTT|MQTT]] are specificaly design to implement such event driven architectures. | ||
+ | |||
+ | |||
+ | ===== PART 1 : Your first step by step eventing communications between Web service and Client ===== | ||
==== Events Introduction ==== | ==== Events Introduction ==== | ||
Ligne 25: | Ligne 49: | ||
* **.Net Framework Class Library** (EventsLib.dll): Actual Service logic, which defines a Service Contract Interface, OperationContract, and implements them, and exposes few functions to the world to use them | * **.Net Framework Class Library** (EventsLib.dll): Actual Service logic, which defines a Service Contract Interface, OperationContract, and implements them, and exposes few functions to the world to use them | ||
- | * **Console Application** to host the WCF Service Library EventsLibHost.exe): Host the WCF library | + | * **Console Application** to host the WCF Service Library EventsLibHost.exe): Host the WCF library |
- | * | + | |
On the client side : | On the client side : | ||
- | * Console Client Application (EventsClient.exe): Client Application which will use this service. | + | * ** Console Application ** (EventsClient.exe): Client Application which will use this service. |
<note warning> | <note warning> | ||
Ligne 46: | Ligne 69: | ||
=== Defining Interface ICalcServiceEvents (ICalcServiceEvents.cs) === | === Defining Interface ICalcServiceEvents (ICalcServiceEvents.cs) === | ||
- | + | ||| | |
- | ** Exercice: ** | + | |
Now Let's define interface for the events published by the service. | Now Let's define interface for the events published by the service. | ||
Ligne 341: | Ligne 363: | ||
<note warning> | <note warning> | ||
+ | Here, is the solution of the first part | ||
</note> | </note> | ||
Ligne 365: | Ligne 388: | ||
=== Action<T> Delegate === | === Action<T> Delegate === | ||
https://msdn.microsoft.com/en-us/library/018hxwa8(v=vs.110).aspx | https://msdn.microsoft.com/en-us/library/018hxwa8(v=vs.110).aspx | ||
- | ===== Advanced use of Eventing ===== | + | ===== PART 2 : Advanced use of Eventing ===== |
Thanks to the previous example, create a central WS that accept data modification from "Publishers" clients and send event on these modifications to "subscribers" clients. | Thanks to the previous example, create a central WS that accept data modification from "Publishers" clients and send event on these modifications to "subscribers" clients. | ||
Test it with a simple shared data like a count value, with one pupblisher and various subscribers. | Test it with a simple shared data like a count value, with one pupblisher and various subscribers. | ||