platform-core: Asynchronous processing of GORM events, possible?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

platform-core: Asynchronous processing of GORM events, possible?

micke_
Hi

I'd like to be able to perform some actions asynchronously when certain domain objects are inserted/created.

To do this I tried to create an event listener in a service like
@grails.events.Listener(topic='afterInsert', namespace='gorm')
    def gormAfterInsert(Object data) {
        println "Listener: $data"
    }

From what I can tell this event listener is processing these events synchronously.

I tried this in Config.grooy but didn't make a difference:
events = {
    //prevents any events in gorm namespace
    '*' namespace:'gorm', fork:true
}

Is this possible?

Cheers,
 Micke

Reply | Threaded
Open this post in threaded view
|

Re: platform-core: Asynchronous processing of GORM events, possible?

smaldini
Hey,

Not possible ATM but easy to add. I was thinking about leaving before* events sync and after* async by default. What do you think ?

cheers


On Wed, Nov 28, 2012 at 8:00 PM, Mikael Andersson <[hidden email]> wrote:
Hi

I'd like to be able to perform some actions asynchronously when certain domain objects are inserted/created.

To do this I tried to create an event listener in a service like
@grails.events.Listener(topic='afterInsert', namespace='gorm')
    def gormAfterInsert(Object data) {
        println "Listener: $data"
    }

From what I can tell this event listener is processing these events synchronously.

I tried this in Config.grooy but didn't make a difference:
events = {
    //prevents any events in gorm namespace
    '*' namespace:'gorm', fork:true
}

Is this possible?

Cheers,
 Micke




--
Stéphane
--


Reply | Threaded
Open this post in threaded view
|

Re: platform-core: Asynchronous processing of GORM events, possible?

Graeme Rocher
Administrator
No I would recommend being consistent and having them sync by default with a parameter like 'async:true' to configure behavior

Cheers


On Wed, Nov 28, 2012 at 9:07 PM, Stephane Maldini <[hidden email]> wrote:
Hey,

Not possible ATM but easy to add. I was thinking about leaving before* events sync and after* async by default. What do you think ?

cheers


On Wed, Nov 28, 2012 at 8:00 PM, Mikael Andersson <[hidden email]> wrote:
Hi

I'd like to be able to perform some actions asynchronously when certain domain objects are inserted/created.

To do this I tried to create an event listener in a service like
@grails.events.Listener(topic='afterInsert', namespace='gorm')
    def gormAfterInsert(Object data) {
        println "Listener: $data"
    }

From what I can tell this event listener is processing these events synchronously.

I tried this in Config.grooy but didn't make a difference:
events = {
    //prevents any events in gorm namespace
    '*' namespace:'gorm', fork:true
}

Is this possible?

Cheers,
 Micke




--
Stéphane
--





--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com
Reply | Threaded
Open this post in threaded view
|

Re: platform-core: Asynchronous processing of GORM events, possible?

micke_
Agree with Graeme, best to have all events processed in the same manner by default.

Glad to hear that adding this feature is fairly straight forward :)

Thanks for the quick reply,
 Micke


On 28 November 2012 20:15, Graeme Rocher <[hidden email]> wrote:
No I would recommend being consistent and having them sync by default with a parameter like 'async:true' to configure behavior

Cheers


On Wed, Nov 28, 2012 at 9:07 PM, Stephane Maldini <[hidden email]> wrote:
Hey,

Not possible ATM but easy to add. I was thinking about leaving before* events sync and after* async by default. What do you think ?

cheers


On Wed, Nov 28, 2012 at 8:00 PM, Mikael Andersson <[hidden email]> wrote:
Hi

I'd like to be able to perform some actions asynchronously when certain domain objects are inserted/created.

To do this I tried to create an event listener in a service like
@grails.events.Listener(topic='afterInsert', namespace='gorm')
    def gormAfterInsert(Object data) {
        println "Listener: $data"
    }

From what I can tell this event listener is processing these events synchronously.

I tried this in Config.grooy but didn't make a difference:
events = {
    //prevents any events in gorm namespace
    '*' namespace:'gorm', fork:true
}

Is this possible?

Cheers,
 Micke




--
Stéphane
--





--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com