Changes for page Command Queue
Last modified by Erik Bakker on 2024/02/22 13:38
From version 16.1
edited by Erik Bakker
on 2022/12/29 14:44
on 2022/12/29 14:44
Change comment:
There is no comment for this version
To version 13.1
edited by Erik Bakker
on 2022/07/28 09:20
on 2022/07/28 09:20
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,10 +1,6 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 -{{error}} 3 -Note that the functionality mentioned in this microlearning will become obsolete when migrating to the 3rd generation runtime. 4 -{{/error}} 2 +In a low-code platform like eMagiz, you want to prevent using custom scripting as much as possible. However, sometimes in practice, you encounter situations that cannot be realized with the standard toolbox provided within the platform. As a result, we offer the option to use a Groovy script in these situations to achieve the desired solution. In this microlearning, we will look at where you can use a Groovy script and discuss the key considerations when implementing a Groovy script within your model. 5 5 6 -Within the platform of eMagiz, sometimes you need to send a particular command from the eMagiz portal to retrieve information or execute a specific action. These commands can happen from the Deploy and the Manage phase. The two most noteworthy examples of the triggered command queue are the runtime dashboard functionalities and the message redelivery actions. 7 - 8 8 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]]. 9 9 10 10 == 1. Prerequisites == ... ... @@ -13,35 +13,71 @@ 13 13 14 14 == 2. Key concepts == 15 15 16 -This microlearning focuses on t he commandqueue.Thecommand queuecommunicatesbetween the eMagizportaland an eMagizruntime.12 +This microlearning focuses on groovy scripts. A groovy script is a piece of code written in the groovy language that allows you to extend the platform's functionality beyond the mere use of the components supplied via the flow designer. 17 17 18 -* Commands towards a runtime, for example, to retrieve runtime information in the runtime dashboard, are sent via the command queue 19 -* You can monitor the command queue the same way as any other queue within your model 20 -* The command queue is prominently used when accessing the [[Runtime Dashboard>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-deploy-runtime-dashboard||target="blank"]] and when using [[Message Redelivery>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Message Redelivery.WebHome||target="blank"]] 14 +* Groovy scripts should be viewed as an extension that can be used in fringe cases, not as a standard best practice 15 +* When a groovy script becomes so complex that you are programming, you should consider alternatives to the solution 16 +* Groovy scripts can be used in a filter, transformation, and as part of a standard executor 17 +* Groovy scripts should be well documented as they are though to read for most of our community members 18 +* There is no guarantee from eMagiz that Groovy scripts within models keep working in newer versions of the platform 21 21 22 -== 3. Commandqueue==20 +== 3. Groovy script == 23 23 24 - Withinthe platformofeMagiz,sometimesyou needtosend aparticularcommandfromtheeMagizportaltorieveinformationorexecuteaspecificaction. ThesecommandscanhappenfromtheDeployand theManagephase. Thetwomostnoteworthyexamples of the triggered commandqueuearetheruntime dashboardfunctionalities and themessageredeliveryactions.22 +In a low-code platform like eMagiz, you want to prevent using custom scripting as much as possible. However, sometimes in practice, you encounter situations that cannot be realized with the standard toolbox provided within the platform. As a result, we offer the option to use a Groovy script in these situations to achieve the desired solution. In this microlearning, we will look at where you can use a Groovy script and discuss the key considerations when implementing a Groovy script within your model. 25 25 26 - Forexample, when you navigate the RuntimeDashboard and click on a runtime, the eMagiz portal will send a commandto the runtime via the commandqueue toretrieve the runtime state.So, for example, the same logic applies when you select a flow and stop it.24 +=== 3.1 Implementation in Create === 27 27 28 -For Message redelivery, the command queue retrieves all messages in the dead letter queue and resends messages via the command queue. 26 +To implement a groovy script in Create you first need to consider what your Groovy script should do. Within the flow designer there are five components available that can handle a Groovy script. 27 + 28 +* In case you want the Groovy script to filter out messages you should implement the Groovy script in a "standard filter" component. 29 +* If you want your Groovy script to always transform your message from a certain format into another format you should consider using a "standard transformer" component. 30 +* In case you need an optional output the "standard service activator" is your friend. So for example, when you want to do some transformation and do a check whether a message can continue you can use the "standard service activator" and have an optional output. 31 +* When you want to split your message based on a Groovy script you should use the "standard splitter" 32 +* If you want to route messsages based on a Groovy script you should use the "standard router" 29 29 30 -{{in fo}}When all commands sentfromthe eMagizportal are notworking acrossmodels,something is probablybrokenin thebackendof theeMagiz platform.In theseases,pleasecontactusat[[support@emagiz.com>>mailto:support@emagiz.com]]{{/info}}34 +{{warning}}Note, that in practice we mainly see use cases for the "standard service activator" and the "standard transformation".{{/warning}} 31 31 36 +[[image:Main.Images.Microlearning.WebHome@expert-data-handling-groovy-script-available-components.png]] 37 + 38 +Regardless of the component you choose you always need to select the option called "Groovy script" and reference the Groovy resource available on flow level that you want to use within the component. 39 + 40 +[[image:Main.Images.Microlearning.WebHome@expert-data-handling-groovy-script-groovy-configuration.png]] 41 + 42 +{{info}}As you can see in the help text when selecting the "resource" attribute you need to make sure that the Groovy script is uploaded within the context of your flow.{{/info}} 43 + 44 +After you have the component in such a way that the correct Groovy script is called you are done with the configuration of the component and can test the flow using flow testing. 45 + 46 +=== 3.2 Key considerations === 47 + 48 +* To make some groovy scripts work you need to upload (third-party) Java libraries that are not packaged on default by eMagiz 49 +* To make some groovy scripts work you need to reference Java libraries via a standard header enricher or as a dummy variable 50 +* The store consists of several groovy scripts that might be of use to you 51 +* Groovy scripts should be viewed as an extension that can be used in fringe cases, not as a standard best practice 52 +* When a groovy script becomes so complex that you are programming, you should consider alternatives to the solution 53 +* Groovy scripts can be used in a filter, transformation, and as part of a standard executor 54 +* Groovy scripts should be well documented as they are though to read for most of our community members 55 +* There is no guarantee from eMagiz that Groovy scripts within models keep working in newer versions of the platform 56 + 32 32 == 4. Assignment == 33 33 34 -There is no assignment for this microlearning. 59 +Try to implement a component that references a Groovy script and see whether the flow can be tested. 60 +This assignment can be completed with the help of the (Academy) project that you have created/used in the previous assignment. 35 35 36 36 == 5. Key takeaways == 37 37 38 -* Commands towards a runtime, for example, to retrieve runtime information in the runtime dashboard, are sent via the command queue 39 -* You can monitor the command queue the same way as any other queue within your model 40 -* The command queue is prominently used when accessing the [[Runtime Dashboard>>doc:Main.eMagiz Academy.Microlearnings.Crash Course.Crash Course Platform.crashcourse-platform-deploy-runtime-dashboard.WebHome||target="blank"]] and when using [[Message Redelivery>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Message Redelivery.WebHome||target="blank"]] 64 +* To make some groovy scripts work you need to upload (third-party) Java libraries that are not packaged on default by eMagiz 65 +* To make some groovy scripts work you need to reference Java libraries via a standard header enricher or as a dummy variable 66 +* The store consists of several groovy scripts that might be of use to you 67 +* Groovy scripts should be viewed as an extension that can be used in fringe cases, not as a standard best practice 68 +* When a groovy script becomes so complex that you are programming, you should consider alternatives to the solution 69 +* Groovy scripts can be used in a filter, transformation, and as part of a standard executor 70 +* Groovy scripts should be well documented as they are though to read for most of our community members 71 +* There is no guarantee from eMagiz that Groovy scripts within models keep working in newer versions of the platform 41 41 42 42 == 6. Suggested Additional Readings == 43 43 44 -There are no suggested additional readings. 75 +If you are interested in this topic and want more information, please read the help text provided by eMagiz and read the following link: 76 +* https://www.tutorialspoint.com/groovy/index.htm 45 45 46 46 == 7. Silent demonstration video == 47 47