Changes for page eMagiz State Generation
Last modified by Erik Bakker on 2024/08/13 12:05
From version 1.1
edited by eMagiz
on 2022/06/13 09:29
on 2022/06/13 09:29
Change comment:
There is no comment for this version
To version 28.1
edited by Erik Bakker
on 2024/08/13 08:04
on 2024/08/13 08:04
Change comment:
There is no comment for this version
Summary
-
Page properties (4 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,0 +1,1 @@ 1 +eMagiz State Generation - Parent
-
... ... @@ -1,0 +1,1 @@ 1 +WebHome - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. marijn1 +XWiki.ebakker - Content
-
... ... @@ -1,102 +1,111 @@ 1 -{{html wiki="true"}} 2 -<div class="ez-academy"> 3 - <div class="ez-academy_body"> 4 - 5 - 6 - <li class="doc-nav__item"><a href="../../docs/fundamental/index_academy_fundamental_all" class="doc-nav__link">Home</a></li> 7 - 8 - 9 - 10 - 11 - 12 -<div class="doc"> 13 - 1 +{{container}}{{container layoutStyle="columns"}}((( 2 +In this fundamental, we will explore the concept of state generation, its benefits, operations, and implementation within the context of real-time data processing. The text covers various aspects, including enrichment, aggregation, change detection, and duplicate detection, along with specific use cases in the context of eMagiz State Generation. 14 14 15 - 16 -= eMagiz Stateful = 17 - 18 -In this fundamental, we'll take a look at the capability of eMagiz around storing a state of a data packet of message send across the platform. 19 - 20 20 Should you have any questions, please get in touch with academy@emagiz.com. 21 21 22 -* Last update: March 7th, 2022 23 -* Required reading time: 10 minutes 24 - 25 25 == 1. Prerequisites == 26 26 27 27 * Take a closer look at the Fundamentals for Messaging, API Gateway and Event Streaming 28 28 10 +== 2. Key Concepts == 29 29 30 -== 2. Key concepts == 31 -All concepts are discussed in the section below.. 12 +In this microlearning, the concept of state generation will be explained. 32 32 14 +== 3. State Generation == 33 33 34 - 35 -== 3. Introducing Stateful == 16 +State generation concerns the generation of a stateful application or service. This means that, for the application or service to function, data is stored and past states are used to derive information. Such a state may e.g. be a temperature or heartrate measure. Stateful applications or services are opposed to stateless applications or services, which do not require data to function and merely represent the current state. 36 36 37 - Within eMagiz there is a capabilityto store pieces of dataofaspecificobject thatistransitbetween systems.Thebasis idea ofmessagesthat are processedbyeMagizisthatallofhese areintransit.However,in certainasesit isveryhelpfulto preserve astate ofanobject. Thatstatecanhelpto influence the nextatapackets thatarepassingthroughor triggera certainactionforanother system.18 +An example of a stateful application, is an application that obtains temperature measures in a room and presents a timeline of the temperature measures. A thermostat produces the temperature in this example, after which the data needs to be put into context, including the time at which a certain temperature was measured and the room in which it was measured. Then, the data can be evaluated over time, and tested against the norm. This ensures that real time actions can be generated, e.g. a fire alert can be generated when the temperature has risen by 25 degrees Celsius in 1 minute. 38 38 39 - An example might be a situation where a sensor is submittingtemperature data every 5 seconds on a data stream towards eMagiz. The interesting state of the machine where the sensor is attached to is the average temperature in the last hour.n this case the temperature that is send to the eMagiz should beused toupdate the state of the machine, andmore specifically the average temperature. One needs a datastream from the sensor, a way to aggregate & average out all messages fromthelast hour, andway to store the state. Once the temperature reaches a certainhreshold, the data issubmitted toanextsystem to raise an alertfor auser.20 +[[image:Main.Images.Fundamental.WebHome@fundamental-stateful-1.png]] 40 40 41 - Anotherexample might be a data stream that registers a click on a specific webpage.That data stream is connected to eMagiz, whereby the state ofthat specific webpage is updated with the number of clicks.Once the number of clicks in the last 30 minutes reaches for instance more than 50, a specific action might be triggered.If thatpagecontains a product, theactionmight be to displaythe number of web users active on that product in order to influence the sales of that product. One needs a data stream, a way to count the number of click, and a way to store the state of that webpage.22 +=== 3.1 Benefits and Operations === 42 42 43 - The example are purely illustrative tounderstand theconcept.24 +Benefits of real time state generation are, first of all, that data can be provided immediately and is always up-to-date. Secondly, it is possible to take real time action and take real-time decisions. Lastly, there is no need to store data unnecessarily. 44 44 45 - ==== 3.1StateStore====26 +Stateful data can be generated through four main operations. 46 46 47 - Thestate store refers to the storage location of the states of the specific objects in the environment.That storage location is part of the eMagiz platform, and embedded in the eMagiz runtime for now.The userneeds to define what objects and the attributes of that object are to be stored. Several different objects and states of the objects can be be defined & stored. A state store can be shared acrossmultipleprocesses that are allowed to update the state of anobject.28 +==== 3.1.1 Enrichment ==== 48 48 49 - ====3.2StateOperations====30 +First of all, through enriching data. This means that information should be added to the data, so that it has more meaning. This can be achieved by storing states in a database. For example, when it is known that, if a person works from home, this is stored as A, and if a person works in the office, this is stored as B, the data can be enriched with ‘Home’ and ‘Office’. To ensure this, a database should be present storing the connection between A and Home, and B and Office. 50 50 51 -Once the state store is defined, one needs different operations in order to update the state effectively. 52 -* Retrieve - get the values of an object and the attributes 53 -* Aggregate - Increment a attribute in a state store to +1 54 -* Enrich - add new attribute of an object in the state store based on joining several streams 55 -* Transform - filter data or translate formats 56 -* Time-window - to aggregate data over time 32 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-example-enrich.png]] 57 57 58 -==== 3. 3State Action& networks====34 +==== 3.1.2 Aggregation ==== 59 59 60 - Oncethestatestore hasvaluesstored,certain triggerscan bedefinedto causeaction.For instance, whenthetemperatureishigherthan20inthe exampleabove.Theseactionscanbedefined/modeledby the eMagizuserinsideflows, wherebythe evaluationofstatewouldsenda datapointtotheystemthatmanagestheaction. For instance,thesupport teamthatmanagestheserver park and needso verifyoftheairconditioningoftheserverroomis workingproperly(casehightemperature).36 +Secondly, stateful data can be obtained through aggregating data. Aggregation concerns a computation over a certain range of time, such as an average, minimum or maximum. Moreover, with state generation it is possible to define a trend, and recognize patterns in this trend. An advantage here, is that temporary states can be retained, instead of saving data for a longer period of time. 61 61 62 - Onecan imaginethatacertain actionwouldbeto update thestate ofanotherobject.Orthat thereareseveralotherdatastreams are updateseveral states.Inthat way, youcan imagineacompletenetworkof datathat work intertwinedforyoutodetectrollingrealityof datathatcanbeused for data analysisandreal-timedecision-making.38 +An example of aggregation is that, when the number of people working from home, or working at the office is stored, the average number of people working at home or at the office during the past 30 minutes can be determined. 63 63 64 - ==== 3.4 Speeddthroughput====40 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-example-aggregation.png]] 65 65 66 - Manyorganizationshold lots of data which canbe leveragedfor such usecases, and often include IoT like data. Therefore, the datais usually putonevent streams that are geared towards speed and throughput. In eMagiz you will find these data points usually in topics that are processed by Event Processor flows.42 +==== 3.1.3 Change Detection ==== 67 67 68 - ====3.5Patternspecifics====44 +Thirdly, change detection can be applied. This means that a change in the data can be detected. For example, when the temperature at home rises to more than 30 degrees, this can be detected. It can then be defined that, when the temperature at home is more than 30 degrees and the heating is on, the heating should be turned off. In this example, the data is enriched with the last state of the air conditioning. 69 69 70 - At first hand it looksasif these conceptswould onlyapply to EventStreaming.But capturing & storing a stateof an object wouldlso behandy in other patternssuch as Messaging. For instance, whentheorder of the messages being send matters,or whenthere is dependency between messages that isneededto determine when a message needs tobe send in time.46 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-example-change-detection.png]] 71 71 48 +==== 3.1.4 Duplicate Detection ==== 72 72 73 - ====3.6eMagizspecifics====50 +Lastly, duplicate detection can be applied, meaning that duplicate data can be detected. For example, if the number of people working from home is recorded twice at a certain moment, this can be detected, and the data can be adapted accordingly. 74 74 75 - The state storeis implemented inside the eMagiz runtime usingtheH2 database for now.or time related operations another technology isused (Esper), andthefunctionality is only availableon Dockerbased runtimes (to be release end Q2 2022). You wilfindthe specific Stateful components inside the Flow Designeras we use in eMagizto model the flow. Aligned with the general concept oflow-code developnmentin eMagiz. For Statestore models,theurrentdata modeling capabilities will be used.52 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-example-duplicate-detection.png]] 76 76 54 +=== 3.2 State Generation in eMagiz === 77 77 78 - =====Practice=====56 +State Generation components can be used in all eMagiz patterns. The enrich and aggregate functionalities are likely more fitting to Messaging and API Gateway as opposed to Event Streaming. For Event Streaming, the other two operations, change and duplicate detection, are more relevant. 79 79 80 - ==4.Keytakeaways==58 +A state can most logically be created in a central place through which the data flows. The reason for this, is that such a place has all the required information flowing through its processes to generate stateful data. 81 81 82 -* Stateful refers to the concept of storing a state of an object 83 -* Storing a state is different compared to data in transit which is often refered as stateless data (eMagiz doesn't store or update the data when sending across) 84 -* Stateful can be applied across all patterns in eMagiz and is embedded into the platform in such a way that it provided the same user experience 60 +The state store is implemented inside the eMagiz runtime using various support objects. Once you have agreed on the license you can find store items in the store and components inside the Flow Designer as we use in eMagiz to model the flow. Aligned with the general concept of low-code developnment in eMagiz. For State store models, the current data modeling capabilities will be used. 85 85 86 - <p align="center">[[image:ffundamental-stateful-1.png||]]</p>62 +=== 3.3 Use Cases === 87 87 64 +In the following, real-life implementations are given on how eMagiz State Generation has been realized through enrichment, aggregation, change detection, and duplicate detection. 88 88 66 +==== 3.3.1 Enrichment ==== 89 89 90 - ==5.Suggested AdditionalReadings==68 +Company A works with a backend system based on ID/Name combinations. These are different for each implementation, and can be retrieved through a unique API. A difficulty that arises, is that some APIs initially only return the IDs. To prevent multiple calls to our backend system, the key/value pairs (ID/Name) need to be stored, such that these can be used in subsequent calls. 91 91 92 - N/A70 +The eMagiz solution for Company A can be viewed below. 93 93 94 - == 6. Silent demonstrationvideo ==72 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-usecase-enrich.png]] 95 95 96 - N/A74 +==== 3.3.2 Aggregation ==== 97 97 98 -</div> 99 -</main> 100 -</div> 101 -</div> 102 -{{/html}} 76 +Company B provides contracts and files for their customers. Their customers manually upload contracts (one by one) to their files, which may take some time. It is desired by Company B that their customers receive a push notification once their files have been uploaded successfully. However, they do not wish to spam their customers by sending a push notification after each file upload when they are uploading several files. So, the push notification should be retained for some time, and should be sent once it is (almost) certain that no additional file will be uploaded. 77 + 78 +In the figure below, the eMagiz solution for Company B can be viewed. 79 + 80 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-usecase-aggregation.png]] 81 + 82 +==== 3.3.3 Change Detection ==== 83 + 84 +Company C tracks packages and parcels that have been ordered by their customers. When a package is not received within its expected timeframe, an exception occurs. It can happen that such an exception resolves itself, e.g. after rendering for some time, the package is not ‘stuck’ anymore, and is being processed. Before implementing state generation, such a change was never sent to the Alert Manager, because no new exception was triggered. As a result, the employees from Company C were still working under the assumption that the exception is valid, meaning that they could still be searching for a packet that had already been received. 85 + 86 +With state generation, changes in package statuses are sent to the Alert Manager, so that they are aware of any (resolved) exceptions. In the figure below, the eMagiz solution for Company C can be viewed. 87 + 88 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-usecase-change-detection.png]] 89 + 90 +==== 3.3.4 Duplicate Detection ==== 91 + 92 +Company D is concerned with receiving meter readings. From an external system, new meter readings, or corrected meter readings are received. To protect underlying applications, it needs to be checked whether a duplicate between the external system and their own internal system exists. This can be achieved through a check for each type of meter reading. When a duplicate is found, the meter reading is marked, such that it can be checked later in the process. 93 +The eMagiz solution for Company D can be viewed below. 94 + 95 +[[image:Main.Images.Fundamental.WebHome@fundamental-stategeneration-usecase-duplicate-detection.png]] 96 + 97 +== 4. Key Takeaways == 98 + 99 +* State generation concerns the generation of a stateful application or service 100 +* Stateful refers to the concept of storing a state of an object 101 +* Storing a state is different compared to data in transit which is often refered as stateless data (eMagiz doesn't store or update the data when sending across) 102 +* Stateful can be applied across all patterns in eMagiz and is embedded into the platform in such a way that it provided the same user experience 103 +* Stateful data can be generated through four main operations: enrichment, aggregation, change detection, duplicate detection 104 + 105 +== 5. Suggested Additional Readings == 106 + 107 +* [[Intermediate Level (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.WebHome||target="blank"]] 108 +** [[State Generation (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.State Generation.WebHome||target="blank"]] 109 +* [[State Generation (Search Result)>>url:https://docs.emagiz.com/bin/view/Main/Search?sort=score&sortOrder=desc&highlight=true&facet=true&r=1&f_space_facet=2%2FMain.eMagiz+Academy.Microlearnings.&f_type=DOCUMENT&f_locale=en&f_locale=&f_locale=en&text=%22state+generation%22||target="blank"]] 110 + 111 +)))((({{toc/}}))){{/container}}{{/container}}