Changes for page Communication between models
Last modified by Erik Bakker on 2026/01/02 10:29
From version 6.1
edited by Erik Bakker
on 2022/07/26 08:31
on 2022/07/26 08:31
Change comment:
There is no comment for this version
To version 26.1
edited by Erik Bakker
on 2026/01/02 10:29
on 2026/01/02 10:29
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - expert-create-your-transformations-xpath-expert1 +Communication between models - Default language
-
... ... @@ -1,0 +1,1 @@ 1 +en - Content
-
... ... @@ -1,5 +1,5 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 - Within the crash course, we already explained XPath conceptually.In thatsamemicrolearning,welooked at some more uncomplicated cases of usingXPath within yourtransformation.If you need to brushup on that knowledge, please check out this [[microlearning>>doc:Main.eMagizAcademy.Microlearnings.CrashCourse.CrashCoursePlatform.crashcourse-platform-create-transformation-xpath-basic.WebHome||target="blank"]].In theintermediate microlearning onthissubject, we built uponthat knowledge.Pleasecheck outthis[[microlearning>>doc:Main.eMagizAcademy.Microlearnings.IntermediateLevel.Createyourtransformations.intermediate-create-your-transformations-xpath-intermediate.WebHome||target="blank"]] if you need a refresher onthat.In the [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.AdvancedLevel.Create your transformations.advanced-create-your-transformations-xpath-advanced.WebHome||target="blank"]]that followed, webuilt uponthatknowledgeandlookedatsomeconcrete, practicalexamplesthat couldbeuseful in yourproject.Inthis microlearning,wewillwrap theconcept of XPath by lookingatthreecomplexXPathalternativesthataresometimes neededwhen dealing with messagesineMagiz.2 +In this microlearning explains about sharing data across systems in a multi-model environment using event streaming and web services. It discusses the processes, best practices, and considerations for implementing these concepts. Take a look to gain a deeper understanding of how communication between systems in different models can be achieved effectively. 3 3 4 4 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]]. 5 5 ... ... @@ -6,86 +6,83 @@ 6 6 == 1. Prerequisites == 7 7 8 8 * Expert knowledge of the eMagiz platform 9 -* [[XPath Basic>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-create-transformation-xpath-basic.WebHome||target="blank"]] 10 -* [[XPath Intermediate>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Create your transformations.intermediate-create-your-transformations-xpath-intermediate.WebHome||target="blank"]] 11 -* [[XPath Advanced>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.Create your transformations.advanced-create-your-transformations-xpath-advanced.WebHome||target="blank"]] 9 +* Fundamental [[eMagiz Multi-model>>doc:Main.eMagiz Academy.Fundamentals.fundamental-emagiz-multi-model-explained.WebHome||target="blank"]] 10 +* Fundamental [[eMagiz Event Streaming>>doc:Main.eMagiz Academy.Fundamentals.fundamental-event-streaming-introduction||target="blank"]] 11 +* Fundamental [[eMagiz API Gateway>>doc:Main.eMagiz Academy.Fundamentals.fundamental-api-gateway-introduction||target="blank"]] 12 +* Fundamental [[eMagiz Messaging>>doc:Main.eMagiz Academy.Fundamentals.fundamental-messaging-introduction||target="blank"]] 12 12 13 - 14 14 == 2. Key concepts == 15 15 16 -This microlearning focuses on more complex XPath operations. 16 +* Model - the integration model of a client that runs on a specific cloud slot of eMagiz 17 +* Multi-model - several integration models of a single client 17 17 18 -With XPath Advanced, we mean learning that XPath options are complex but could benefit you in your daily work. 19 +When selecting a method to communicate between models always consider the following concepts: 20 +* Security 21 +* Loose coupling 22 +* Maintainability 23 +* Clarity 19 19 20 - SomeofthemorecomplexXPath optionsare:25 +== 3. Main Multi-Model Integration Patterns == 21 21 22 -* dateTime calculation 23 -* Filter list 24 -* XPath on JSON 25 -* SpEL notation for XPath 27 +Most users would think that communication via queues to connect two separate eMagiz models is a bright idea. However, this is something that we do not encourage. We discourage this for several practical and technical reasons alike. 26 26 29 +When looking at the practical side of things getting it configured correctly is time-consuming and an error-prone action (as is evident by the question). Furthermore, it can lead to unexpected situations where you make a typo to listen to a queue on which no messages are provided. This queue will, however, be registered on the JMS level (when you activate the flow in question with the custom configuration), which can lead to confusing queue statistics and even more troublesome false-positive alerting based on missing queue metrics or missing consumers. 27 27 31 +On top of that, when you allow one model to write and read from queues registered in another model, maintaining both models will become very complex. This holds for the ones working on the project at the moment but also for those working on it at a later stage and does that need to provide (incidental) support on the environments. 28 28 29 - ==3.XPathAdvanced==33 +Another practical reason for not wanting this is that we do not actively support this use case from eMagiz. This means that when we update our technical infrastructure, we will not consider this scenario. This could lead to additional work in the future and reduced stability of your solution. 30 30 31 - Withinthe crashcourse, wealreadyexplained XPathconceptually.Inthat samemicrolearning, we also looked at some moreuncomplicatedcasesofusing XPathwithinyour transformation.Ifyouneed tobrush up on thatknowledge,pleasecheckoutthis[[microlearning>>doc:Main.eMagizAcademy.Microlearnings.CrashCourse.CrashCourse Platform.crashcourse-platform-create-transformation-xpath-basic.WebHome||target="blank"]]. In the intermediatemicrolearningon this subject, we built uponthatknowledge. Pleasecheckoutthis [[microlearning>>doc:Main.eMagizAcademy.Microlearnings.IntermediateLevel.Createyourtransformations.intermediate-create-your-transformations-xpath-intermediate.WebHome||target="blank"]]ifyouneedarefresheron that.Inthismicrolearning, wewill build upon that knowledgeand look atsomeconcrete, practicalexamplesthatcould be usefulinyourproject.35 +From the technical point of view, the consequence of this construction is that both models need to know each other certificates and credentials, which are not considered secure. On top of that, because you, theoretically, can exchange data from any queue to any queue, you could create a situation in which updates in one model trigger changes in the other model (i.e., when using the same data model) that are unexpected (and frankly unwanted). 32 32 33 -Some of the more complex XPath options are: 37 +At the moment, the two most frequently used ways to provide communication between systems in a multi-model environment are event streaming and web services. This microlearning will discuss the processes of sharing data across systems in a multi-model environment using these concepts, including best practices. 38 +In the figure below, both processes are illustrated. The process at the top illustrates event streaming, and the process at the bottom illustrates web services. Model A and model B are two different models, where a system in model B should have access to the same data as the system in model A. For example, the systems in both models should be the same. 34 34 35 -* dateTime calculation 36 -* Filter list 37 -* XPath on JSON 38 -* SpEL notation for XPath 40 +[[image:Main.Images.Fundamental.WebHome@fundamental-multi-model-best-practice--event-streaming-and-webservices.png]] 39 39 40 -=== 3.1 dateTimecalculation ===42 +=== 3.1 Event Streaming === 41 41 42 -Sometimes we see that a dateTime calculation is needed within a transformation to determine a specific action. As these calculations are not natively supported within the eMagiz platform, you need to use XPath's functionality to calculate the new valid date (or dateTime). 44 +To understand the following section, it is necessary to have some background information about event streaming, which can be found [[here>>doc:Main.eMagiz Academy.Fundamentals.fundamental-event-streaming-introduction||target="blank"]]. 45 +The first option is to decide the alignment of the data models between both models. Whenever data from the first model is transferred to the second model, and the topic is considered input for other systems and integrations in that other model, the data needs to be transformed to the common data model of that second model. This way, the topic can be exposed to any system and pattern in the second model. The picture below denotes this situation. These are the specific considerations when implementing this approach: 43 43 44 -The XPath standard offers several functions to calculate with dateTime values. The two most used options are dayTimeDuration and yearMonthDuration. With the help of the dayTimeDuration, you can add, subtract, multiple, or divide seconds, minutes, hours, and days regarding the original value. The yearMonthDuration works similarly but then for months and years. An example of such an XPath is: <xsl:value-of xmlns:xs="http://www.w3.org/2001/XMLSchema" select="CDM:StartDate + xs:dayTimeDuration('P1D') * xs:yearMonthDuration('P1M')"/>. In this example, XPath adds one day and subtracts one month from the input date. Note that making this work requires the additional namespace to be defined. Therefore you need a custom snippet within your transformation or a custom transformation to make this work. Furthermore, note that the P1D and P1M could also be filled with the help of parameters to make them dynamic in nature. 47 +* Leverage the credentials of the first eMagiz model in the second model 48 +* Create transparent systems with clear names and ensure to align the message type names 45 45 46 - Some examples thatwe sawduring the years:50 +It is necessary to transform topics to allow communication between systems in different models using event streaming. This is because it is impossible to retrieve data from a topic that exists in one model through a different model. So, systems in model B cannot immediately access the topic present in model A. The topic needs to be transformed to ensure that systems in model B can use the data on the topic in model A. By changing the topic, all systems in model B can access the transformed topic. 47 47 48 -* https://my.emagiz.com/p/question/172825635700358186 49 -* https://my.emagiz.com/p/question/172825635700352588 52 +To ensure that the topic from model A can be transformed, model B needs credentials from model A. So, to allow for this pattern, credentials must be shared between models. 50 50 51 - ===3.2Filter list===54 +An advantage of this pattern is that there is no dependency across models. If the system in model A breaks down, the system in model B can still work. A disadvantage of this pattern is that there may be struggles with the setup since no direct accessibility can be achieved. Moreover, as mentioned above, credentials have to be shared, which may threaten security. 52 52 53 - Sometimesyou have a large message which contains a certain list within it.However, logic dictates that you can only send the message if at least one entry in the list for which attribute A isfilled and attribute B equals type C. To make that happen in XPath, we first need to navigate to the list within the message. As we previously learned, there are two options to do so. One is to use // to navigate to the entity somewhere in the tree directly. Theother isto start at the root and walk the tree from there. In this example, we use the latter. That results in the following XPath example: /root/list[attributeB='type C']/attributeA !=''. With this XPath, you filter the list on the specified check and subsequently check whether one of those entries that remains has an attributeA which is filled in.56 +=== 3.2 Webservices === 54 54 55 -=== 3.3 XPath on JSON === 58 +Web services can also be used to communicate between systems in different models. This means that model A has a web service in place, and model B has a web service in place, between which data can be exchanged. 59 +An advantage of this pattern is that it is easy to keep an overview. Setting it up does not involve many unclarities. A disadvantage is that there is much dependency across models. If the web service in model A crashes, the system in model B cannot receive data anymore. 56 56 57 - Withthe release of build number.50,we expanded our offering on JSONmessages to resemble much of the functionality we previously offered for XML messages.As a result, you canuseXPath expressions on JSON messages within the following components(related to XPath):61 +=== 3.3 Naming Conventions === 58 58 59 -* XPath header enricher 60 -* XPath transformer 61 -* XPath router 63 +For clarity purposes, it is advised to give the systems that are the same across models the same name and the name of the other model in which the system is present. So, as illustrated in the figure, the system names in model A and B are partly the same (‘SYS’) and indicate which model also holds the system (model B in model A, model A in model B). This way, it remains clear which models have the same systems, and systems can be found more easily. 62 62 63 - Toactivatethefunctionality,simply linkthe JSON source factory support object to one of these components to achieve the desired result. For more information, checkout: https://emagiz.github.io/docs/release-notes/build50.65 +== 4. Key takeaways == 64 64 65 -=== 3.4 SpEL notation for XPath === 67 +* Event streaming and webervices are mainly used to communicate between systems across models. 68 +* To allow communication between systems in different models using event streaming, it is needed to transform topics. 69 +* Communication between systems in different models can also directly be achieved using web services. 70 +* For clarity purposes, it is advised to give the systems that are the same across models the same name, as well as the name of the other model in which the system is present. 71 +* Both patterns have their advantages and disadvantages. 66 66 67 -Sometimes you want to perform an XPath operation but store the header via a standard message header enricher component. As a result, you need a valid SpEL expression to help you in this cause. To do so, you need to know the correct notation for an XPath expression when using the SpEL language. An example of the correct notation is: #xpath(payload,'/root/entity/attribute') 73 +* Consider the following when communication between two models 74 +** Security 75 +** Loose coupling 76 +** Maintainability 77 +** Clarity 68 68 69 -== 4.Assignment==79 +== 5. Suggested Additional Readings == 70 70 71 -Check out which of the XPaths we have discussed today can be found within your project. 72 -This assignment can be completed within the (Academy) project you created/used in the previous assignment. 73 - 74 -== 5. Key takeaways == 75 - 76 -Some of the more complex XPath options are: 77 - 78 -* dateTime calculation 79 -* Filter list 80 -* XPath on JSON 81 -* SpEL notation for XPath 82 - 83 -== 6. Suggested Additional Readings == 84 - 85 -If you are interested in this topic and want more information on it, please read the help text provided by eMagiz and read more information on the following link: 86 - 87 -* https://www.w3schools.com/xml/xpath_intro.asp 88 - 89 -== 7. Silent demonstration video == 90 - 91 -As this is more of theoretical microlearning, there is no video accompanying the microlearning.)))((({{toc/}}))){{/container}}{{/container}} 81 +* [[Fundamentals (Navigation)>>doc:Main.eMagiz Academy.Fundamentals.WebHome||target="blank"]] 82 +** [[eMagiz Security Guide (Explanation)>>doc:Main.eMagiz Academy.Fundamentals.fundamental-emagiz-security-guide||target="blank"]] 83 +** [[Multi-Model Explained (Explanation)>>doc:Main.eMagiz Academy.Fundamentals.fundamental-emagiz-multi-model-explained.WebHome||target="blank"]] 84 +* [[Advanced (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.WebHome||target="blank"]] 85 +** [[Solution Architecture (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.Solution Architecture.WebHome||target="blank"]] 86 +*** [[Checklist for Splitting Models (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.Solution Architecture.Checklist for Splitting Models.WebHome||target="blank"]] 87 +* [[Communication between models (Search Result)>>url:https://docs.emagiz.com/bin/view/Main/Search?sort=score&sortOrder=desc&highlight=true&facet=true&r=1&f_space_facet=0%2FMain.&f_type=DOCUMENT&f_locale=en&f_locale=&f_locale=en&text=communication+between+models||target="blank"]] 88 +)))((({{toc/}}))){{/container}}{{/container}}