I have a glossary service (jolie service) that provides the definitions based on the input terms. I start this service in the usual way :
jolie ./Glossary.ol
The issue is that the service exits as soon as the first request is served. To get the definition of another term, I need to start the service again.
How do I keep the service running? Once I do that, what are the options to stop the service (other than Ctrl+C)?
you can use the concurrent
execution
modality, guarded choices (the syntax [ input ]{ post-response code }
, and the exit
instruction.
Here's a simple example (imports, ports, and services omitted for brevity).
// client.ol
main {
for( i=0, i<10, nullProcess ){
inc@server( i )( i )
println@Console( i )()
}
shutdown@server()()
}
// server.ol
execution{ concurrent }
main {
[ inc( i )( i ){
println@Console( "received " + i + ", sending " + ++i )()
} ]
[ shutdown()() ]{ exit }
}