Skip to content

Instantly share code, notes, and snippets.

@tmclnk
Created May 26, 2015 12:51
Show Gist options
  • Save tmclnk/324727f1d1cb85d738e9 to your computer and use it in GitHub Desktop.
Save tmclnk/324727f1d1cb85d738e9 to your computer and use it in GitHub Desktop.
GPARS Dynamic Dispatch DSL
import groovyx.gpars.actor.*
import org.codehaus.groovy.runtime.NullObject
import groovy.time.TimeCategory
DynamicDispatchActor actor = Actors.messageHandler {
when { String name ->
println "Nice to meet you $name"
}
when { Integer age ->
println "You look younger than $age"
}
}
actor << "Mario"
actor << 37
actor.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment