Changes for page Volume Mapping (On-premise)
Last modified by Erik Bakker on 2024/08/26 12:37
From version 58.1
edited by Erik Bakker
on 2023/11/16 07:06
on 2023/11/16 07:06
Change comment:
There is no comment for this version
To version 30.1
edited by Erik Bakker
on 2022/06/10 13:22
on 2022/06/10 13:22
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 - VolumeMapping(On-premise)1 +Processing a File per Line - 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 ensure that the docker container in your runtime(s) running has access to this path. There are several ways of dealing with this challenge. 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,131 +14,93 @@ 14 14 15 15 == 2. Key concepts == 16 16 17 -This microlearning centers around learning how to correctly set upyourvolumemappingsoyou canexchangefile-baseddata on-premise.15 +This microlearning centers around learning how to process an incoming file per line. 18 18 19 -By volumemapping,wemean Creatinga configurationthroughwhich thedocker containercan read and write data ona specificpathon an on-premisemachine. Notethat the data canalso be storedinside the dockercontainerwhen the otherparty writing or reading the datacan accessthis pathor when thedatais only relevantwithin thentextofeMagiz.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 whichthedataisstoredandensurethatthedocker containerinyourruntime(s) running has accesstothispath. Thereareseveral waysof dealing with thischallenge.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 optionsavailable for your volumemapping. Butbeforewe do,weexplainhow to setupthisconfigurationwithineMagiz.Then,you must navigatetoDeploy-> Architecture onthemodel level. This overview lets youaccesstheVolume 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,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 Dockerrelevantto that runtimeto read and write**persistent** data. Toconfigurethis Type, youneedto link the runtime volume to a machine volume (or network volume) you can create within the same pop-up. This means you can re-use a "Machine volume" or a "Network volume"over multiple runtimes (i.e., containers). Wefirst need to definea machine (ornetwork) volume to do so.Once we have done that, we can learn how to link the volume to the machine or network 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." Inhefollowingpop-up,we can specifythenameofamachinevolumeandtellwhetherthevolumealreadyexistsonyourdockerinstallation.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 -{{info}}When stating that the machine volume already exists, you can re-use the same machine volume across multiple runtimes (i.e., containers). This is especially useful when archiving data. You can create a central volume in which the data is stored, and through the linkage of the volume to the machine volume, you can subsequently structure your archiving folder. The paths will then look as follows, "/archive/runtimename"{{/info}} 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 - ====3.1.2DefineNetworkVolume====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 - So, wefirst open the tabcalled"Networkvolume."Then,bypressingthe"New"button,wecandefineanew"Networkvolume." In the followingpop-up,we canspecifytheameofamachine volume andconfiguretherelevant informationforanetworkvolume.Inmost cases,a CIFSisused, andthe onlypertinentoptions thatneedtobe filledinarethehost,path,username,andpassword.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 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--network-volumes-configuration.png]]60 +For the remainder of this microlearning, we will assume that the option pass through line mapper is chosen. 67 67 68 - Onceyou havedone, we"Save" and switch backto the"Runtimevolumes"tab.62 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--flat-file-item-reader-passthrough.png]] 69 69 70 -{{info}}When configuring a network volume, the following information is relevant to know: 71 -* When you create a network volume to a folder that contains sub-folders, all sub-folders are shared automatically and can be accessed from the flow level 72 -* When dealing with multiple hosts, you must create a specific entry per host, as this follows the guiding security principles of the underlying infrastructure.{{/info}} 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. 73 73 74 - ==== 3.1.3 Link Volume====66 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--flat-file-item-reader-passthrough-advanced.png]] 75 75 76 - Inthe "Runtime volumes" tab, we push the "New" button to create a new "Runtime volume."In the following pop-up, wemust select the Type we want to use. Forthis example, we use the Type called "Volume."68 +=== 3.2 Poller === 77 77 78 - {{info}}Therelevantinputfieldswillchangebasedonyourselection.{{/info}}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: 79 79 80 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-volume.png]] 72 +- Fixed Delay Trigger 73 +- Fixed Rate Trigger 74 +- Cron Trigger 81 81 82 - Thefirstthing weneedtoselects the "Volume." Once we have chosen our "Volume,"we mustset theTarget specific forthis runtime.Thistargetdefinesthesecondpartofthepath to which theruntime willgainaccess.For example, whenyou fill in "/target", we cancombinethiswithhe"Volume"nameto arriveatthecorrectdirectoryfrom which eMagizneeds to readdata (orwritedatao).So, in ourcase, inwhich welinkthe volumetothe machinevolumewe created earlier,this would be"/file-directory/target."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. 83 83 84 - The last settingweneed to configure isto define therights we will grant ourruntime onthevolumewecreate. The default setting isread/write rights for the runtime, which isusually sufficient. Theesult of following these steps willbethe following.78 +[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-processing-a-file-per-line--poller-config.png]] 85 85 86 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-volume-filled-in.png]]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. 87 87 88 -{{warning}}Note the following when considering using the Volume option: 89 -* In the case of using the Volume option in combination with a Machine volume, the external system with which you exchange data on-premise via a file-based method needs to be able to write or read the data from the volume (i.e., directory) you have configured. Should this be a problem, the Bind mount alternative discussed below should be considered. 90 -* The Volume option and Machine volume combination can also be used for eMagiz-only information that needs to be persistable, such as archiving. 91 -* In the case of using the Volume option in combination with a Network volume, the path to read and write from becomes what you define in the target field. 92 -{{/warning}} 82 +== 4. Assignment == 93 93 94 -=== 3.2 Bind mount === 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. 95 95 96 - Analternative option to read and write **persistent** data is the "Bind mount" option.Wegenerallyadvise usingthe "Volume" option becausethey perform better,and bind mounts depend on the host machine's directory structure and OS. However, only some external systemscan adapt to this that easily. For example, the "Bind mount" option can interest your use case.87 +== 5. Key takeaways == 97 97 98 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-bind-mount.png]] 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 99 99 100 - Toconfigurea "Bind mount," you need to define asource and atargetdirectorylinkedto each other. The sourcedirectory represents the directory onyour localsystem (that might already be used currently to exchange files).The target directory defines a directory on your docker installation that the runtime can access.94 +== 6. Suggested Additional Readings == 101 101 102 - [[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-bind-mount-filled-in.png]]96 +There are no suggested additional readings on this topic 103 103 104 - {{info}}Notethatwhenyou usethisoption, yourdirectory reference in your flowshould referto the "target" directory configuredhere.{{/info}}98 +== 7. Silent demonstration video == 105 105 106 - ===3.3Temporaryfile system===100 +This video demonstrates how you could have handled the assignment and gives you some context on what you have just learned. 107 107 108 - The temporaryfileystem option is for you if youdoot wantto work with **persistent** data but require**non-persistent** data.This way, you can increasethe container's performancebyavoiding writing into thecontainer'swritablelayer.102 +{{video attachment="novice-file-based-connectivity-processing-a-file-per-line.mp4" reference="Main.Videos.Microlearning.WebHome"/}} 109 109 110 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-temp-file-storage.png]] 111 - 112 -To configure this option, you need a target location. On top of that, you can define the maximum size of the temporary file system. 113 - 114 -[[image:Main.Images.Microlearning.WebHome@novice-file-based-connectivity-volume-mapping-on-premise--runtime-volumes-configuration-type-temp-file-storage-filled-in.png]] 115 - 116 -{{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}} 117 - 118 -=== 3.4 Named pipe === 119 - 120 -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. 121 - 122 -=== 3.5 Deployment consequences === 123 - 124 -{{warning}} 125 -* Note that the runtimes cannot be deployed correctly when the source directory **does not exist**. Consequently, no runtime on that machine will start up. One of the following two configurations displayed below are needed to find the source directory: 126 -** /mnt/host/{local-directory} 127 -** /run/desktop/mnt/host/{local-directory} 128 -* When the source directory can be found but the user has no access, the deployment will **fail** for the specific runtime in question with the volume mapping configured. All other runtimes (i.e., containers) will start up (pending other configuration issues).{{/warning}} 129 - 130 -== 4. Key takeaways == 131 - 132 -* File-based communication on-premise changes in the new runtime architecture 133 -* There are two ways to store **persistent** data 134 - ** Volume 135 - ** Bind mount 136 -* 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 137 -* Before deploying, ensure that the various sources in your configuration exist and that access is granted to avoid problems while deploying. 138 -* The Temporary file storage option is the way to go when dealing with **non-persistent** data. 139 - 140 -== 5. Suggested Additional Readings == 141 - 142 -If you are interested in this topic and want more information, please read the help text provided by eMagiz. 143 - 144 144 )))((({{toc/}}))){{/container}}{{/container}}