Setting the execution modality

We are sure you noticed that in the example reported in Creating a Service and a Client the service stops after serving the first request of the client. Thus, you need to re-launch the service in order to be able to invoke it more times.

In Jolie it is possible to enable a service to process multiple requests by simply defining the execution modality. Setting th eexecution modality to concurrent will allow the service to process all the incoming requests concurrently.

execution { concurrent }

The Twice service of the cited example now becomes:

Server's code

execution { concurrent }
inputPort TwiceService {
Location: "socket://localhost:8000"
Protocol: sodep
RequestResponse: twice
twice( number )( result ) {
result = number * 2

In this way you can invoke it more than once from different clients.