Changes for page SMB Connectivity
Last modified by Danniar Firdausy on 2024/09/18 20:40
From version 4.2
edited by Bouke Reitsma
on 2024/05/02 10:58
on 2024/05/02 10:58
Change comment:
There is no comment for this version
To version 35.12
edited by Danniar Firdausy
on 2024/09/18 20:38
on 2024/09/18 20:38
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. BoukeReitsma1 +XWiki.dfirdausy - Content
-
... ... @@ -1,5 +1,6 @@ 1 -{{container}}{{container layoutStyle="columns"}}((( 2 -In some cases, there is no communication possible with a local file directory. Or there is a requirement from the external party to place the files somewhere else. Mainly the somewhere else is either an FTP or an SFTP. However, there is a third communication protocol that can be used for file transfer. In this microlearning we will take a look at Server Message Block (SMB) connectivity within eMagiz. 1 +{{container}} 2 +{{container layoutStyle="columns"}}((( 3 +In many scenarios, accessing or managing files directly through a local directory isn't feasible, or external requirements might necessitate file placement in different locations. Typically, file transfers are handled via FTP or SFTP protocols, but another option available is Server Message Block (SMB) connectivity. In this microlearning, we will explore how SMB connectivity works within eMagiz, examining how it facilitates file transfers between local and remote systems. 3 3 4 4 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]]. 5 5 ... ... @@ -11,126 +11,115 @@ 11 11 == 2. Key concepts == 12 12 13 13 This microlearning is about SMB (connectivity). 15 +* By SMB connectivity, we mean: Making sure that eMagiz can communicate with the SMB protocol to exchange file-based data. 14 14 15 - BySMBconnectivity,we mean: Making sure that eMagiz can communicate with the SMB protocol to exchange file-based data.17 +== 3. SMB Connectivity == 16 16 17 -* FTP (File Transfer Protocol) is a network protocol for transmitting files between computers over Transmission Control Protocol/Internet Protocol (TCP/IP) connections. 18 -* In an FTP transaction, the end user's computer is typically called the localhost. The second computer involved in FTP is a remote host, which is usually a server. 19 -* Servers must be set up to run FTP services, and the client must have FTP software installed to access these services. 20 -* eMagiz provides several components to set up the FTP connection 19 +In some cases, there is no communication possible with a local file directory. Or there is a requirement from the external party to place the files somewhere else. Mainly the somewhere else is either an FTP or an SFTP. However, there is a third communication protocol that can be used for file transfer. In this microlearning we will take a look at Server Message Block (SMB) connectivity within eMagiz. 21 21 22 -== 3. FTP Connectivity == 21 +* SMB (Server Message Block) is a network protocol for transmitting files between computers over Transmission Control Protocol/Internet Protocol (TCP/IP) connections. 22 +* In an SMB transaction, the end user's computer is typically called the localhost. The second computer involved in SMB is a remote host, which is usually a server. 23 +* Servers must be set up to run SMB services, and the client must have SMB software installed to access these services. 24 +* eMagiz provides several components to set up the SMB connection 23 23 24 - In somecases,there isnocommunicationpossiblewithalocal file directory.Orthere is arequirementfrom the externalpartytoplace thefilessomewherelse.MainlythesomewhereelseiseitheranFTP oran SFTP. Thismicrolearningwilllook attheFTP andlearnhowtoset uptheconnectionbetweeneMagizandtheFTP.26 +So, where the file pickup component searches on the local host for the correct directory, the idea of the SMB setup is that the directory with whom to communicate exists on a remote host. The local host and the remote host can talk to each other via the SMB protocol. That is, in a nutshell, the difference between setting up an SMB connection and communicating with local directories. 25 25 26 -* FTP (File Transfer Protocol) is a network protocol for transmitting files between computers over Transmission Control Protocol/Internet Protocol (TCP/IP) connections. 27 -* In an FTP transaction, the end user's computer is typically called the localhost. The second computer involved in FTP is a remote host, which is usually a server. 28 -* Servers must be set up to run FTP services, and the client must have FTP software installed to access these services. 29 -* eMagiz provides several components to set up the FTP connection 28 +{{warning}}Note that the auto create directory setting on all SMB components only works for a "one-level" directory (i.e. /directory) and not for a "multi-level" directory (i.e. /directory/sub). To ensure this "multi-level" directory is created by eMagiz you need to take a look at this [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Advanced Level.File based connectivity.advanced-file-connectivity-dynamically-manipulate-smb-settings.WebHome||target="blank"]]{{/warning}} 30 30 31 - So, where the filepickup componentsearchesonthelocal host for the correct directory,the ideaof theFTPsetupis that the directory withwhom to communicateexists on a remote host. The local hostandthe remotehostcan talk toeach other via the FTP protocol. That is, inanutshell, the difference betweensetting up an FTP connectionandcommunicating with local directories.30 +eMagiz provides only one support object to connect to an SMB: 32 32 33 - eMagizprovidestwosupportobjects toconnect to an FTP:32 +* SMB session factory 34 34 35 -* Default FTP caching session factory 36 -* Default FTP session factory 34 +[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-smb-connectivity-smb-support-object.png]] 37 37 38 - [[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-ftp-connectivity--ftp-support-objects.png]]36 +=== 3.1 Configuration in eMagiz === 39 39 40 -T hemaindifference betweenthetwoisthe cachingpart. Thecachingsessionfactorycomeswiththe optionto re-usethe existingsession for multiplerequests.Inother words,thisway, you donothavetoauthenticateyourselfeverytimeyou want tocommunicatewith theFTP.Thisbehavior isbeneficialifahighfrequencyofcommunicationis neededbetweeneMagizand theFTPtohandlethe incomingandoutgoing datapackages.38 +To configure the connection between eMagiz and the SMB, we need two (or three) components. This depends on whether we want to read, write or do both while communicating with the SMB. If we're going to do both, we need both of the functional components. In all other scenarios, you only need one of the functional components. The functional components that you might need are called: 41 41 42 -If you only initiate communication infrequently, for example, once per day, the default session factory becomes more interesting as this closes the session after each transmission. This behavior is beneficial in cases of low-frequency communication because otherwise, the session would remain active for an extensive period. 40 +* SMB inbound Channel adapter 41 +* SMB outbound Channel adapter 43 43 44 - [[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-ftp-connectivity--ftp-caching-help-text.png]]43 +On top of that, you need the following support object. 45 45 46 - ===3.1Bestpractices forusing FTP ===45 +* SMB session factory 47 47 48 - ====3.1.1Which session factorydo I need?====47 +In this microlearning, we will use the SMB inbound channel adapter combined with the SMB session factory to illustrate the configuration. Please note that any other combination works similarly. To configure the connection with the SMB, we first navigate to the Create phase of eMagiz. Here we open the flow we want to edit. In this example, that will be an entry flow as we want to retrieve (read) data from the SMB. 49 49 50 -When o ccasionally retrievingorwritingfilestoFTP, usehe_DefaultFTP sessionfactory_. Anewconnectionwill be setupwhenyou usethe_DefaultFTPsession factory_for every message/file. On some FTP servers,thismight take up toseconds for each login. This factmightimpact the performanceof your flow.49 +When you have opened the flow, you need to enter "Start Editing" mode. After you have done so, we first add the SMB session factory support object to our flow. 51 51 52 - When you need better performance(say writingmultiplefiles inaminuter retrieving files everyminute), use the _Default FTP **caching**sessionfactory_. The_Default FTP **caching**session_ shares FTP sessions formessages inyour flow.51 +[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-smb-connectivity-smb-session-factory-empty.png]] 53 53 54 - ====3.1.2Do I have toset up a retrymechanism?====53 +Here, we need to define the following: 55 55 56 -When writing files to FTP, it is advisable to set a retry mechanism. Find the advanced tab on your _FTP outbound channel adapter_. Under _Request handler advice chain_ add a _Retry Advice_. 55 +* Host 56 +* Port 57 +* Username 58 +* Password 59 +* Share and directory 57 57 58 -==== 3.1.3 I get a _Failed to list files/items_ or a _Failed to obtain pooled item_. What can I do? ==== 61 +{{info}} 62 +The value for the share and directory field is the main folder for your file share. If the main folder is the exchange folder, then within the SMB inbound channel adapter, a / is needed as remote directory. 63 +{{/info}} 59 59 60 - Incorrect connection settingscause this.Check whetherthecorrectproperties havebeenset andwhether the runtimehas retrievedthelatest properties.65 +[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-smb-connectivity-smb-session-factory-filled-in.png]] 61 61 62 - ====3.1.4Iget a_Failed to listfiles/items_,a_Pipeclosed_or an_inputstreamis closed_.WhatcanIdo?====67 +In the advanced tab there are only two settings to change. The minimum and maximum SMB protocol version. By default, these are set to 2.02 and 3.1.1 respectively to allow a wide range of save protocol version. However, if you want to only allow the best performing version, the minimum 3.0.2 is advised. If you aim for the best secured connection version 3.1.1 has the most functionality in this area. The best practise on this is set the minimum version as high as possible to mimize risks. 63 63 64 - A closedFTPsessioncancause thesenotificationsdue toinactivity.Forthe_Default FTP **caching**session factory_,always setthe_Serveraliveinterval_propertyto30000(ms).69 +Now that we have configured the support object,we can add the SMB inbound channel adapter to the flow. 65 65 66 - ==== 3.1.6I_Failedtowrite_. What canIdo? ====71 +[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-smb-connectivity-smb-inbound-channel-adapter-empty.png]] 67 67 68 - Maybethetargetfolderdoesnot exist, andthe_Auto-create directory_isoff. It is alsopossible that theconnectionsettings areincorrect.Checkwhetherthecorrectpropertieshavebeenset andwhether theruntime hasretrievedthelatestproperties.73 +In this component, we need to define the remote directory where the original files are located. We need to specify the local directory used to store the files before they are processed temporarily. Furthermore, we need to link the support object we have just created and define a poller. For that last one, the best practice is the use of a cron trigger. 69 69 70 - ==== 3.1.7 I oftent 'Disconnectingfromsftp.example.com port 22' andhena'Caught anexception, leavingmainloop due to Socket closed' warnings.====75 +[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-smb-connectivity-smb-inbound-channel-adapter-filled-in.png]] 71 71 72 - Toomany connectionscan cause thisto thesame server atthe sametime.Ifyouhavemanyflows connectingtothe sameFTPserver,ensurethat thecrons do not triggersimultaneously.77 +Apart from these configurations, you could also add a filter, just as we learned in the [[Crash Course Messaging on file-based connectivity>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Messaging.crashcourse-messaging-pick-up-files||target="blank"]]. Finishing things off, we should consider the delete behavior we will use. Based on the filter and the business requirements, whether to delete and when to delete could differ. So please consider all your options in that regard. In case there are multiple readers from the folder and/or there are legal requirements to store source files for a certain time period, you should not use the delete remote files option. However, not deleting files read files can cause overloading the machine if no alternative delete policies is in place. 73 73 74 -=== =3.1.8Igeta'Failedto createSFTPClient'====79 +=== 3.2 SMB Gateway === 75 75 76 - SFTP,FTP,andFTPSare threedifferent remotefiletransferprotocolswiththeir_session factory_componentsin theeMagizflow designer.Makeureyouuse the onethatcorresponds totheserver'sprotocol.81 +The SMB Gateway is an additional component that can be used to interact with your SMB share. It allows the use of a set of pre-configured commands to perform actions such as deleting files. Compared to the outbound channel adapter replies are send back to eMagiz. These reply messages depend on the selected command. Every command option is explained in detail within the helptext. An example configuration to send files is shown below. 77 77 78 - ==== 3.1.9 Onefmy remoteis notpicked up from theSFTP server (withoutanywarning) ====83 +[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-smb-connectivity-smb-outbound-gateway-filled-in.png]] 79 79 80 -The default local filter is _AcceptOnceFileListFilter_. This can be replaced by your file list filter on the _FTP inbound channel adapter's_. 81 -If every day you retrieve a file with the same filename and the _Delete remote files_ property is set, it is advised to use a different local filename. You can add the current timestamp, for example. 85 +{{info}} 86 +Please note that for some commands an SpEL expression is required to respresent a path. This setting can be found in the advanced settings. An example for the mget command could be **myfilesdirectory/** to get only files from this directory. 87 +{{/info}} 82 82 83 - ====3.1.10 Which mode isneeded ====89 +All available options are: 84 84 85 -When running in the current-generation architecture (G3) the FTP always needs to run **passive** mode. 91 +* List files 92 +* List file names 93 +* Retrieve file 94 +* Retrieve multiple files 95 +* Remove file(s) 96 +* Move/rename file 97 +* Send file 98 +* Send mulitple files 86 86 87 - ===3.2 Configuration in eMagiz===100 +This concludes our microlearning, in which we learned how to set up the connectivity with an SMB. 88 88 89 -To configure the connection between eMagiz and the FTP, we need two (or three) components. This depends on whether we want to read, write or do both while communicating with the FTP. If we're going to do both, we need both of the functional components. In all other scenarios, you only need one of the functional components. The functional components that you might need are called: 90 - 91 -* FTP Inbound Channel adapter 92 -* FTP Outbound Channel adapter 93 - 94 -On top of that, you need one of the following support objects. If you are unsure of which to use, please check out the information above in this microlearning. 95 - 96 -* Default FTP caching session factory 97 -* Default FTP session factory 98 - 99 -In this microlearning, we will use the FTP Inbound channel adapter combined with the Default FTP session factory to illustrate the configuration. Please note that any other combination works similarly. To configure the connection with the FTP, we first navigate to the Create phase of eMagiz. Here we open the flow we want to edit. In this example, that will be an entry flow as we want to retrieve (read) data from the FTP. 100 - 101 -When you have opened the flow, you need to enter "Start Editing" mode. After you have done so, we first add the support object to our flow. In this case, we will use the Default FTP session factory. 102 - 103 -[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-ftp-connectivity--default-ftp-session-factory-empty.png]] 104 - 105 -Here, we need to define at least the host and the port. Note that the username and password are optional for an FTP, which makes it less secure. Although in practice, we generally see that the FTP is secured with the help of a username-password combination. As a best practice, we use property references to fill in the various elements. 106 - 107 -[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-ftp-connectivity--default-ftp-session-factory-filled-in.png]] 108 - 109 -The settings on the Advanced tab don't have to be changed in most cases. If your specific setup does require a change to these settings, please consult the help texts on the component level for advice. 110 - 111 -Now that we have configured the support object adding the FTP inbound channel adapter to the flow has become time. 112 - 113 -[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-ftp-connectivity--ftp-inbound-channel-adapter-empty.png]] 114 - 115 -In this component, we need to define the remote directory where the original files are located. We need to specify the local directory used to store the files before they are processed temporarily. Furthermore, we need to link the support object we have just created and define a poller. For that last one, the best practice is the use of a cron trigger. 116 - 117 -[[image:Main.Images.Microlearning.WebHome@intermediate-file-based-connectivity-ftp-connectivity--ftp-inbound-channel-adapter-filled-in.png]] 118 - 119 -Apart from these configurations, you could also add a filter, just as we learned in the Crash Course Messaging on file-based connectivity. Finishing things off, we should consider the delete behavior we will use. Based on the filter and the business requirements, whether to delete and when to delete could differ. So please consider all your options in that regard. This concludes our microlearning, in which we learned how to set up the connectivity with an FTP. 120 - 121 121 == 4. Key takeaways == 122 122 123 -* FTP (FileTransferProtocol) is a network protocol fortransmitting files between computers over TransmissionControlProtocol/InternetProtocol(TCP/IP)connections.124 -* In an FTPtransaction, the end user's computer is typically called the localhost. The second computer involved inFTPis a remote host, which is usually a server.125 -* Servers must be set up to run FTPservices, and the client must haveFTPsoftware installed to access these services.126 -* eMagiz providesseveralcomponentsto setupheFTPconnection104 +* Server Message Block (SMB) is a network protocol used for sharing files between computers over TCP/IP connections. It allows a client to access files on a remote server as if they were on the local machine. 105 +* In an SMB transaction, the end user's computer is typically called the localhost. The second computer involved in SMB is a remote host, which is usually a server. 106 +* Servers must be set up to run SMB services, and the client must have SMB software installed to access these services. 107 +* To use SMB with eMagiz, you'll need the SMB session factory and either an SMB inbound or outbound channel adapter, depending on whether you're reading from or writing to the SMB share. The SMB Gateway component offers pre-configured commands for managing files, including options to list, retrieve, move, or delete files. 127 127 128 128 == 5. Suggested Additional Readings == 129 129 130 130 If you are interested in this topic and want more information, please read the release notes provided by eMagiz. Furthermore, check out these links: 131 131 132 -* [[FTP Inbound>>https://docs.spring.io/spring-integration/docs/2.1.x/reference/html/ftp.html#ftp-inbound||target="blank"]] 133 -* [[FTP Session Factory>>https://docs.spring.io/spring-integration/docs/4.3.x/reference/html/ftp.html#ftp-session-factory||target="blank"]] 134 -* [[FTP Explained>>https://searchnetworking.techtarget.com/definition/File-Transfer-Protocol-FTP||target="blank"]] 113 +* [[eMagiz Store (Menu)>>doc:Main.eMagiz Store.WebHome||target="blank"]] 114 +** [[Accelerators (Navigation)>>doc:Main.eMagiz Store.Accelerators.WebHome||target="blank"]] 115 +*** [[SMB Inbound Connectivity (Explanation)>>doc:Main.eMagiz Store.Accelerators.SFTP Inbound Connectivity.WebHome||target="blank"]] 116 +*** [[SMB Outbound Connectivity (Explanation)>>doc:Main.eMagiz Store.Accelerators.SFTP Outbound Connectivity.WebHome||target="blank"]] 117 +*** [[SMB Gateway Connectivity (Explanation)>>doc:Main.eMagiz Store.Accelerators.SFTP Gateway Connectivity.WebHome||target="blank"]] 118 +* [[Crash Course (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.WebHome||target="blank"]] 119 +** [[Crash Course Messaging (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Messaging.WebHome||target="blank"]] 120 +*** [[Pick up Files (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Messaging.crashcourse-messaging-pick-up-files||target="blank"]] 121 +* [[SMB (Search Results)>>url:https://docs.emagiz.com/bin/view/Main/Search?sort=score&sortOrder=desc&highlight=true&facet=true&r=1&f_space_facet=0%2FMain.&l_space_facet=10&f_type=DOCUMENT&f_locale=en&f_locale=&f_locale=en&text=%22SMB%22||target="blank"]] 122 +* [[SMB Overview (External)>>https://learn.microsoft.com/en-us/windows-server/storage/file-server/file-server-smb-overview||target="blank"]] 123 +* [[SMB Support (External)>>https://docs.spring.io/spring-integration/reference/smb.html||target="blank"]] 135 135 136 -)))((({{toc/}}))){{/container}}{{/container}} 125 +)))((({{toc/}}))){{/container}} 126 +{{/container}}