Wiki source code of Communication between models

Last modified by Erik Bakker on 2024/09/05 14:00

Hide last authors
Erik Bakker 2.1 1 {{container}}{{container layoutStyle="columns"}}(((
Carlijn Kokkeler 22.1 2 In this microlearning, we'll explore the best practices for communication between two eMagiz models. Effective communication is crucial, and it's important to prioritize security, loose coupling, maintainability, and clarity. We'll discuss why using queues for inter-model communication is generally discouraged and why alternatives like web services and Event Streaming are preferred. By focusing on these key considerations, you'll be better equipped to design robust and maintainable integration solutions within eMagiz.
eMagiz 1.1 3
Erik Bakker 2.1 4 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]].
eMagiz 1.1 5
6 == 1. Prerequisites ==
7
Erik Bakker 6.1 8 * Expert knowledge of the eMagiz platform
eMagiz 1.1 9
10 == 2. Key concepts ==
11
Erik Bakker 16.1 12 This microlearning focuses on communication between two eMagiz models. When communicating to any external party (from the view of a specific model), you should always consider the following:
eMagiz 1.1 13
Erik Bakker 15.1 14 * Security
15 * Loose coupling
16 * Maintainability
17 * Clarity
eMagiz 1.1 18
Erik Bakker 15.1 19 == 3. Communication between models ==
eMagiz 1.1 20
Erik Bakker 16.1 21 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.
eMagiz 1.1 22
Erik Bakker 16.1 23 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.
eMagiz 1.1 24
Erik Bakker 16.1 25 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.
eMagiz 1.1 26
Erik Bakker 16.1 27 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.
eMagiz 1.1 28
Erik Bakker 16.1 29 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).
eMagiz 1.1 30
Erik Bakker 16.1 31 We advise using functionality that makes it explicit that both models function independently of each other. From eMagiz, we consider two valid alternatives for this:
32 - Using a web service as a communication layer between the two models. This web service can be REST or SOAP and has been implemented before
Erik Bakker 15.1 33 - Using the Event Streaming functionality of eMagiz to write and read from topics.
eMagiz 1.1 34
Erik Bakker 16.1 35 Both alternatives have the benefit that the security can be tight and explicit (i.e., only model A can write/post data to model B). Furthermore, managing the solution becomes much easier as it uses the standard functionality within the platform. Therefore, we have no plans to support this approach in the product.
Erik Bakker 9.1 36
Eva Torken 19.1 37 == 4. Key takeaways ==
eMagiz 1.1 38
Erik Bakker 15.1 39 * Consider the following when communication between two models
Erik Bakker 17.1 40 ** Security
Erik Bakker 15.1 41 ** Loose coupling
42 ** Maintainability
43 ** Clarity
eMagiz 1.1 44
Eva Torken 19.1 45 == 5. Suggested Additional Readings ==
eMagiz 1.1 46
Erik Bakker 23.1 47 * [[Fundamentals (Navigation)>>doc:Main.eMagiz Academy.Fundamentals.WebHome||target="blank"]]
48 ** [[eMagiz Security Guide (Explanation)>>doc:Main.eMagiz Academy.Fundamentals.fundamental-emagiz-security-guide||target="blank"]]
49 ** [[Multi-Model Explained (Explanation)>>doc:Main.eMagiz Academy.Fundamentals.fundamental-emagiz-multi-model-explained.WebHome||target="blank"]]
50 ** [[Multi-Model Best Practice (Explanation)>>doc:Main.eMagiz Academy.Fundamentals.fundamental-emagiz-multi-model-best-practice.WebHome||target="blank"]]
Erik Bakker 24.1 51 * [[Advanced (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.WebHome||target="blank"]]
52 ** [[Solution Architecture (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.Solution Architecture.WebHome||target="blank"]]
53 *** [[Checklist for Splitting Models (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.Solution Architecture.Checklist for Splitting Models.WebHome||target="blank"]]
Carlijn Kokkeler 21.1 54 * [[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"]]
Eva Torken 19.1 55 )))((({{toc/}}))){{/container}}{{/container}}