# Attaching a script task in a process

## Attaching the ScriptCode Handler in the process <a href="#zadanieskryptowe-podpinaniescriptcodehandlerwprocesie" id="zadanieskryptowe-podpinaniescriptcodehandlerwprocesie"></a>

For the process to be able to call the handler, the process definition must set ***ServiceTask*** to:

* section ***Implementation***: **Topic = eximeeScriptCodeTask**

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2FWBdvvakM5nGH6g0T5fyh%2Fimage.png?alt=media&#x26;token=35407a01-1635-4d89-9e5d-291015e6bc53" alt=""><figcaption><p align="center"><em><strong>Figure 1.</strong> The 'Implementation' section in ServiceTask</em></p></figcaption></figure>

* section ***Extension properties***: add a variable named **script** of **with the name of the script** as the value, which we want to invoke:

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2Fvn2HTMjLstCGsE6Rf1Ai%2Fimage.png?alt=media&#x26;token=c5c03331-8ee5-4552-b949-4e5383705e32" alt=""><figcaption><p align="center"><em><strong>Figure 2.</strong> The 'Extension properties' section in ServiceTask</em></p></figcaption></figure>

In the section ***Inputs*** we can define arguments for the handler, for an example script:

<figure><img src="https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2FtMI7AWDMq4PSWSzyp0VB%2Fimage.png?alt=media&#x26;token=9c89d8d6-adcf-42cf-8b33-34bd1e3e44ea" alt=""><figcaption><p align="center"><em><strong>Figure 3.</strong> The 'Inputs' section in ServiceTask</em></p></figcaption></figure>

In the above example, we added the variable to the handler's **testVariable** with the value **10**.

It is worth remembering that in the handler's script we have access to all global process variables using the getVariable() and getAllVariables() methods.

## Cache handling in process-handler-executor <a href="#zadanieskryptowe-obslugacachewprocess-handler-executor" id="zadanieskryptowe-obslugacachewprocess-handler-executor"></a>

process-handler-executor is an application that is part of the Eximee platform. It is responsible for executing script tasks. This application has a cache that helps reduce the number of requests for the content of script task artifacts, resulting in better performance.

The cache can be configured via the PROCESS\_HANDLER\_SCRIPT\_CODE\_CACHE\_TTL parameter. Its value should be set depending on how frequently artifacts are updated in a given environment. In development environments, where artifacts are frequently updated, a low value is recommended, for example '1s'; for production environments, a much higher value can be used, for example '10m'.

The cache can also be cleared on demand by making a request:

```
curl --location --request POST '
http://DOCKER_HOST/process-handler-executor/cache/invalidate'

```
