padcom / grails-routing

Apache License 2.0
30 stars 31 forks source link

Is there an annotation like 'events-si' 's @grails.events.Listener? #41

Closed yellowsnow closed 10 years ago

yellowsnow commented 10 years ago

Hi,

First of all, thanks for this great plugin. It's brings both great worlds of Camel and Grails together.

I am in the process of migrating from 'event-si' plugin to 'routing' because the former is not supported yet in grails 2.4.x.

So here's my question : Is there an annotation like @grails.events.Listener that allows such decoupled publish / subscribe implementation using service methods as listeners/topics ? :

This is event-si implementation :

//Somewhere in controllers
//controllers/SomeController.groovy
//Publish asynch
event(topic:'businessDataChanged',data:message,params:[fork,true])

//controllers/OtherController.groovy
//Publish synchronous
event(topic:'businessDataChanged',data:message,params:[fork,false])

//Far away in the service layer....

//services/FooService.groovy
//Subscribe
@grails.events.Listener
def businessDataChanged(msg) {
//change the world
}

//services/BarService.groovy
//Subscribe
@grails.events.Listener
def businessDataChanged(msg) {
//change the world
}

Thanks again

padcom commented 10 years ago

It's not supported.