Changes for page Volume Mapping (On-premise)
Last modified by Erik Bakker on 2024/08/26 12:37
From version 55.1
edited by Erik Bakker
on 2023/04/11 12:37
on 2023/04/11 12:37
Change comment:
There is no comment for this version
To version 30.2
edited by Erik Bakker
on 2022/06/10 13:23
on 2022/06/10 13:23
Change comment:
Update document after refactoring.
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - VolumeMapping (On-premise)1 +novice-file-based-connectivity-characterset - Default language
-
... ... @@ -1,1 +1,0 @@ 1 -en - Content
-
... ... @@ -1,13 +1,11 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 +In some cases, you want to treat each unique part of your input file as its message instead of processing the complete file as its message. In this microlearning, we will learn how you can process a (large) file on a per-line basis. 2 2 3 -{{warning}} 4 -Please note that this microlearning is for the new monitoring stack only. 5 -{{/warning}} 6 - 7 -When you need to read and write files from an on-premise disk, you need to know the path in which the data is stored and make sure that the docker container in your runtime(s) running has access to this path. There are several ways of dealing with this challenge. First, this microlearning will discuss the various alternatives and best approaches in these scenarios. 8 - 9 9 Should you have any questions, please contact [[academy@emagiz.com>>mailto:academy@emagiz.com]]. 10 10 6 +* Last update: May 31th, 2021 7 +* Required reading time: 7 minutes 8 + 11 11 == 1. Prerequisites == 12 12 13 13 * Basic knowledge of the eMagiz platform ... ... @@ -14,127 +14,93 @@ 14 14 15 15 == 2. Key concepts == 16 16 17 -This microlearning centers around learning how to set upyourvolume mappingcorrectlysoyou canexchangefile-baseddata on-premise.15 +This microlearning centers around learning how to process an incoming file per line. 18 18 19 -By volumemapping, we mean:Creatingaconfigurationhroughwhich thedockercontainercan readand write dataon a specific path onanon-premise machine.17 +By processing per line, we mean: Splitting up the input into discernable pieces that each will become a unique message 20 20 21 -There are several options for volume mapping for your on-premise machine. 22 -* Volume 23 -* Bind mount 24 -* Temporary file system 25 -* Named pipe 19 +* Easy way of reading a file line by line and sending it to eMagiz (Low on memory) 20 +* Ability to process each line based on distinctive logic that is relevant on line level 21 +* Can be used for flat file as well as XML input files 26 26 27 -== 3. VolumeMapping(On-premise)==23 +== 3. Processing a File per Line == 28 28 29 - Whenyou need to read and write filesfrom an on-premisedisk, you needtoknowthepathin whichthedataisstoredandmake surethatthedockercontainerin yourruntime(s) running has accesstothispath. Thereareseveral waysof dealing with thischallenge.First,this microlearning willdiscuss thevariousalternatives andbestapproachesinthesescenarios.25 +In some cases, you want to treat each unique part of your input file as its message instead of processing the complete file as its message. In this microlearning, we will learn how you can process a (large) file on a per-line basis. 30 30 31 -There are several options for volume mapping for your on-premise machine. 32 -* Machine volume 33 -* Bind mount 34 -* Network volume 35 -* Temporary file system 36 -* Named pipe 27 +To make this work in eMagiz you need to navigate to the Create phase of eMagiz and open the entry flow in which you want to retrieve the file to a certain location. Within the context of this flow, we need to add functionality that will ensure that each line is read and processed separately and will become its unique message. To do so first enter "Start Editing" mode on flow level. After you have done so please add a file item reader message source to the flow. We will use this component to read and process our input file on a per-line basis. 37 37 38 - Below we will explain thedifferencesbetweenthevarious options availableforyour volumemapping.Butbeforewedo, we firstexplain howtoset up this configurationwithineMagiz.Then,you must navigatetoDeploy-> Architecture onthemodel level. Inthisoverview,youcan accesstheVolume mapping per runtimedeployed on-premise.Todo so, you canright-clickon theuntime to access the context menu.29 +The first step would be to define the directory from which we read our messages. As always reference to the directory with the help of a property. 39 39 40 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity- volume-mapping-on-premise--volume-option-context-menu.png]]31 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--file-item-reader-directory.png]] 41 41 42 - When youclick thisoption,youwillseethefollowingpop-up. In this pop-up, you candefinethemachine-level,runtime-level volumes andnetwork-levelvolumes. Moreonthatlater.Thisis thestartingpointforconfiguringyourvolumemapping. Wewillwalkthrougheachavailable optionand explain howtheywork andshould benfigured.33 +Secondly, just as when reading the file as a whole ensure that you use a filter to retrieve only the correct files from the directory. 43 43 44 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--volume-mapping-pop-up.png]]35 +=== 3.1 Item reader Type === 45 45 46 - {{info}}Note thatyou shouldbe in"Start editing"mode tomake any changes tothe configuration ofyourvolumemapping.{{/info}}37 +Now it is time to select our Item reader Type. As the help text of the eMagiz component suggest there are two choices with this component. The first (and most frequently used) option is the Flat file item reader. With this option, you can read each line within the flat file input file and output is at a separate message. The second option is called the Stax event item reader. With this option, you can read your input XML and output messages on a per-record basis. 47 47 48 - === 3.1 Volume===39 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--item-reader-type-options.png]] 49 49 50 - The first Typeavailable to you isVolume.With thisoption,youcreateone or more folders on Docker relevant to that runtime toread and write **persistent** data. Toconfigure this Type,you need to link the runtime volume toamachine volume (or networkvolume) youcan create within the same pop-up. This means you can re-use a "Machine volume" or"Network volume" over multiple runtimes (i.e., containers).To do sowe first need to define a machine (or network) volume. Once we have done that we canlearnhow to link thevolume to the machine ornetwork volume.41 +Based on your choice the exact configuration will differ. 51 51 52 -==== 3.1.1 DefineMachineVolume====43 +==== 3.1.1 Stax Event Item Reader ==== 53 53 54 - So, we firstopenthe tabcalled"Machinevolume."Then,bypressing the"New"button,we candefineanew"Machinevolume."Inthepop-upthatfollows,wecanspecifythenameofamachinevolumeandtellwhethertheVolumealready existsonyour dockerinstallation ornot.45 +For the Stax event item reader, you need to define the name of the element on which you want to split the XML and define whether you want to throw an error in case no such element exists in the input file (By (de)selecting the option Strict). The default setting of eMagiz is advisable for this option. 55 55 56 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity- volume-mapping-on-premise--machine-volumes-configuration.png]]47 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--stax-event-item-reader-config.png]] 57 57 58 - Onceyouhavedoneso, wepress "Save" andswitch back to the"Runtime volumes" tab.49 +==== 3.1.2 Flat File Item Reader ==== 59 59 60 -==== 3.1.2 Define Network Volume ==== 51 +For the Flat File item reader, there are some more choices and configurations to be made. There are three options you can choose from: 52 +- Pass through line mapper 53 +- Default line mapper 54 +- Pattern matching composite line mapper 61 61 62 - So,wefirstopenthe tabcalled"Networkvolume."Then,bypressingthe"New"button,we candefineanew"Network volume."Inthepop-upthatfollows,wecanspecifythe nameofamachinevolumedconfiguretherelevantinformation for anetworkvolume.InmostcasesaCIFSisusedandthe onlyrelevant optionsthatneedtobefilledinarethehost,port,usernameandpassword.56 +Each of these options has some advantages and disadvantages. Adhering to the best practices of eMagiz (i.e. no transformation in the entry) the best option would be to use the pass-through line mapper. As the name suggests this option does nothing except give a string back to the flow on a per line basis. However, choosing this option means that the actual transformation from that string to XML needs to happen later in the process (most likely in the onramp) with the help of a flat-file to XML transformer (more on that component in a later course). 63 63 64 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--network-volumes-configuration.png]]58 +The other two options transform the input line into an XML output. So you win one step in the process. However, no standard eMagiz error handling is advisable when you start transforming data within the entry. So in case, something goes wrong to analyze the error will become more difficult. Furthermore, another potential disadvantage is that when one line fails the processing of the rest of the file also halts. 65 65 66 - Once youhavedone so, wepress"Save"and switchbacktothe"Runtimevolumes"tab.60 +For the remainder of this microlearning, we will assume that the option pass through line mapper is chosen. 67 67 68 - ==== 3.1.3 Link Volume====62 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--flat-file-item-reader-passthrough.png]] 69 69 70 - Inthe"Runtime volumes"tab,wepushthe"New"button tocreateanew"Runtimevolume."Inthefollowingpop-up,we first needto select theType we want touse.Forthis example,weuse theType called"Volume."64 +As you can see on the Basic level we are done. However, it is always good to check out the settings on the Advanced tab, especially in this case, to see if there are additional configuration options that could benefit us. The setting of most interest, in this case, is the Lines to Skip setting (default setting is 0). With this setting, you can define whether or not you want to process the header line(s) that exists within your input file. The remainder of the settings is (in most cases) good the way eMagiz has set them up. 71 71 72 - {{info}}Basedonyour selection, therelevantinputfieldswill change.{{/info}}66 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--flat-file-item-reader-passthrough-advanced.png]] 73 73 74 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-volume.png]]68 +=== 3.2 Poller === 75 75 76 - Thefirstthingweneedtoselectis the"Volume." Oncewe havechosenour"Volume,"we mustsettheTargetspecificfor thisruntime.Thistargetdefinesthe secondpart of thepath towhichtheruntime willgain access. Forexample, when you fill"/target",wecan combine this with the "Volume" name to arrive at the correct directory from which eMagizneeds toread data (orwrite data to). So in our casein which we linkthevolumetohe machine volume we created earlier, thiswould be "/file-directory/target."70 +Now that we have selected and configured the item reader type it becomes time to fill in the last part of the configuration, the poller. For polling eMagiz offers three options: 77 77 78 -The last setting we need to configure is to define which rights we will grant our runtime on the Volume we are creating. The default setting is read/write rights for the runtime, which is sufficient in most cases. The result of following these steps will be the following. 72 +- Fixed Delay Trigger 73 +- Fixed Rate Trigger 74 +- Cron Trigger 79 79 80 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-volume-filled-in.png]]76 +Of these options, the cron trigger is used most frequently in eMagiz. The reason being is that you can define this option via a property that you can alter without having to alter the flow version in Create. 81 81 82 - {{warning}}Notethat when you use the Volume option, the external system with which youexchangedataon-premisea afile-basedmethodneedsto be able to write or read the data from the Volume (i.e., directory) you haveconfigured in Docker. Should this beaproblem, the Bind mount alternative discussed below should be considered.{{/warning}}78 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--poller-config.png]] 83 83 84 - ===3.2Bindmount===80 +After finishing all these configuration steps we can press Save to save our work and ensure that we can process the input file on a per-line basis. 85 85 86 -An alternative option to read and write **persistent** data is to use the "Bind mount" option. In general, we advise using the "Volume" option because they have better performance, and bind mounts depend on the host machine's directory structure and OS. However, only some external systems can adapt to this that easily. For example, the "Bind mount" option can interest your use case. 87 - 88 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-bind-mount.png]] 89 - 90 -To configure a "Bind mount," you need to define a source and a target directory linked to each other. The source directory represents the directory on your local system (that might already be used currently to exchange files). The target directory defines a directory on your docker installation that the runtime can access. 91 - 92 -{{warning}}Note that when the source directory does not exist, the runtimes cannot be deployed correctly. One of the following two configurations displayed below are needed to find the source directory: 93 -* /mnt/host/{local-directory} 94 -* /run/desktop/mnt/host/{local-directory}{{/warning}} 95 - 96 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-bind-mount-filled-in.png]] 97 - 98 -{{info}}Note that when you use this option, your directory reference in your flow should refer to the "target" directory configured here.{{/info}} 99 - 100 -=== 3.3 Temporary file system === 101 - 102 -The temporary file system option is for you if you do not want to work with **persistent** data but require **non-persistent** data. This way, you can increase the container's performance by avoiding writing into the container's writable layer. 103 - 104 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-temp-file-storage.png]] 105 - 106 -To configure this option, you need a target location. On top of that, you can define the maximum size of the temporary file system. 107 - 108 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-temp-file-storage-filled-in.png]] 109 - 110 -{{warning}}We strongly advise you to define this number so that you can limit the potential impact this solution can have on the stability of your machine.{{/warning}} 111 - 112 -=== 3.4 Named pipe === 113 - 114 -The named pipe option can be selected, but we yet have to see a valid use case within the context of eMagiz for using this option. Therefore we won't discuss this option further in this microlearning. 115 - 116 116 == 4. Assignment == 117 117 118 - NavigatetoDeploy->Architectureandlook attheVolumemappingoptions,readthehelptexts,andplay around with theettings(ifitis notacustomerenvironment).119 -This assignment can be completed with the help of the (Academy) project you created/used in the previous assignment. 84 +Configure an entry in which you define the component and configuration needed to process a file on a per-line basis. 85 +This assignment can be completed with the help of the (Academy) project that you have created/used in the previous assignment. 120 120 121 121 == 5. Key takeaways == 122 122 123 -* File-based communication on-premise changes in the new runtime architecture 124 -* There are two ways to store **persistent** data 125 - ** Volume 126 - ** Bind mount 127 -* The Volume option is considered the best alternative because they have better performance, and bind mounts are dependent on the directory structure and OS of the host machine 128 -* When you want to deal with **non-persistent** data, the Temporary file storage option is the way to go. 89 +* Easy way of reading a file line by line and sending it to eMagiz (Low on memory) 90 +* Ability to process each line based on distinctive logic that is relevant on line level 91 +* Can be used for flat file as well as XML input files 92 +* Try to avoid complex transformations within the entry 129 129 130 130 == 6. Suggested Additional Readings == 131 131 132 - Ifyouareinterested inthis topic and wantmoreinformation, pleasereadthehelptext provided by eMagiz.96 +There are no suggested additional readings on this topic 133 133 134 134 == 7. Silent demonstration video == 135 135 136 -This video demonstrates how you could have handled the assignment and gives context to what you have just learned.100 +This video demonstrates how you could have handled the assignment and gives you some context on what you have just learned. 137 137 138 - TBA102 +{{video attachment="novice-file-based-connectivity-processing-a-file-per-line.mp4" reference="Main.Videos.Microlearning.WebHome"/}} 139 139 140 140 )))((({{toc/}}))){{/container}}{{/container}}