Last modified by Erik Bakker on 2024/09/03 09:17

From version 23.1
edited by Erik Bakker
on 2024/06/21 14:47
Change comment: There is no comment for this version
To version 29.1
edited by Carlijn Kokkeler
on 2024/08/28 15:26
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ebakker
1 +XWiki.CarlijnKokkeler
Content
... ... @@ -1,5 +1,5 @@
1 1  {{container}}{{container layoutStyle="columns"}}(((
2 -In a previous [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level. File based connectivity.intermediate-file-based-connectivity-smb-connectivity.WebHome||target="blank"]] on this subject, we discussed how to configure the various variants of SMB connectivity. We already mentioned that more dynamic options, such as automatically creating a "multi-level" directory (i.e.,/root/sub), are complex to configure and require a different approach.
2 +In a previous [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.File based connectivity.intermediate-file-based-connectivity-smb-connectivity.WebHome||target="blank"]] on this subject, we discussed how to configure the various variants of SMB connectivity. We already mentioned that more dynamic options, such as automatically creating a "multi-level" directory (i.e.,/root/sub), are complex to configure and require a different approach.
3 3  
4 4  In this microlearning, we will examine how to manipulate all settings on the SMB Session Factory to create dynamic values that are injected into the component when a message is processed by the flow.
5 5  
... ... @@ -35,8 +35,12 @@
35 35  
36 36  [[image:Main.Images.Microlearning.WebHome@advanced-file-connectivity-dynamically-manipulate-smb-settings--standard-service-activator.png]]
37 37  
38 -Here, we must define an expression to set the host based on a supplied value. Important in this expression is that we correctly reference the complete name of the SMB Session Factory support object in the flow and that once the host is set, the actual message is passed along. An example of such an expression is {{code}}@'smb.gtwydynm.exit.support.smb-session'.setHost(headers.server) ?: #root{{/code}}. This expression will set the host based on the value in the header called "server" and, once done, will pass the full message to the output channel.
38 +Here, we must define an expression to set the host based on a supplied value. Important in this expression is that we correctly reference the complete name of the SMB Session Factory support object in the flow and that once the host is set, the actual message is passed along. An example of such an expression is:
39 39  
40 +{{code}}@'smb.gtwydynm.exit.support.smb-session'.setHost(headers.server) ?: #root{{/code}}
41 +
42 +This expression will set the host based on the value in the header called "server" and, once done, will pass the full message to the output channel.
43 +
40 40  [[image:Main.Images.Microlearning.WebHome@advanced-file-connectivity-dynamically-manipulate-smb-settings--standard-service-activator-filled-in.png]]
41 41  
42 42  === 3.2 Dynamic Share and Directory ===
... ... @@ -47,12 +47,32 @@
47 47  
48 48  [[image:Main.Images.Microlearning.WebHome@advanced-file-connectivity-dynamically-manipulate-smb-settings--standard-service-activator.png]]
49 49  
50 -Here, we must define an expression to set the host based on a supplied value. Important in this expression is that we correctly reference the complete name of the SMB Session Factory support object in the flow and that once the host is set, the actual message is passed along. An example of such an expression is {{code}}@'smb.gtwydynm.exit.support.smb-session'.setShareAndDir(headers.share) ?: #root{{/code}}. This expression will set the host based on the value in the header called "server" and, once done, will pass the full message to the output channel.
54 +Here, we must define an expression to set the host based on a supplied value. Important in this expression is that we correctly reference the complete name of the SMB Session Factory support object in the flow and that once the host is set, the actual message is passed along. An example of such an expression is:
51 51  
56 +{{code}}@'smb.gtwydynm.exit.support.smb-session'.setShareAndDir(headers.share) ?: #root{{/code}}
57 +
58 +This expression will set the host based on the value in the header called "server" and, once done, will pass the full message to the output channel.
59 +
52 52  [[image:Main.Images.Microlearning.WebHome@advanced-file-connectivity-dynamically-manipulate-smb-settings--standard-service-activator-filled-in-share-and-dir.png]]
53 53  
54 54  {{warning}}Note that you can combine multiple dynamic settings into one expression to keep the number of components efficient. In that case the code will look something as follows {{code}}@'smb.gtwydynm.exit.support.smb-session'.setShareAndDir(headers.share) ?: @'smb.gtwydynm.exit.support.smb-session'.setHost(headers.server) ?: #root{{/code}}{{/warning}}
55 55  
64 +=== 3.3 Additional Dynamic Options ===
65 +
66 +Although we don't think these options will be used much we define them here for the sake of completeness and give you examples on how to make these additional values dynamically.
67 +
68 +==== 3.3.1 Port ====
69 +
70 +{{code}}@'smb.gtwydynm.exit.support.smb-session'.setPort(headers.port) ?: #root{{/code}}
71 +
72 +==== 3.3.2 Username ====
73 +
74 +{{code}}@'smb.gtwydynm.exit.support.smb-session'.setUsername(headers.username) ?: #root{{/code}}
75 +
76 +==== 3.3.3 Password ====
77 +
78 +{{code}}@'smb.gtwydynm.exit.support.smb-session'.setPassword(headers.password) ?: #root{{/code}}
79 +
56 56  == 4. Key takeaways ==
57 57  
58 58  * This option is the correct approach when you need to create a directory dynamically or have multiple hosts that host file shares.
... ... @@ -59,4 +59,8 @@
59 59  
60 60  == 5. Suggested Additional Readings ==
61 61  
62 -There are no suggested additional readings on this topic.)))((({{toc/}}))){{/container}}{{/container}}
86 +* [[Intermediate (Menu)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.WebHome||target="blank"]]
87 +** [[File based connectivity (Navigation)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.File based connectivity.WebHome||target="blank"]]
88 +*** [[SMB Connectivity (Explanation)>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.File based connectivity.intermediate-file-based-connectivity-smb-connectivity.WebHome||target="blank"]]
89 +
90 +)))((({{toc/}}))){{/container}}{{/container}}