Worker functions take a single parameter which is the message to be received. To obtain a port, you
need to call the spawn(target)
function of a worker environment, as in:
let env = WorkerEnvironment.builder(): withFixedThreadPool() let port = env: spawn(|message| -> println(">>> " + message))
A port provides a send(message)
method:
port: send("hello"): send("world")
Messages are being put in a queue, and eventually dispatched to the function that we spawned.