There are actually two ways you can approach this -- you can either use an event-handler, as Dan mentioned, or you can add message-listeners for the messages that are broadcast by the built-in event handlers.
There are six built-in event-handlers that are commonly used: modelglue.onApplicationStart modelglue.onSessionStart modelglue.onSessionEnd modelglue.onRequestStart modelglue.onRequestEnd modelglue.onQueueComplete Each of these event-handlers broadcasts a message of the same name without the "modelglue." prefix, so for example, the modelglue.onRequestStart event-handler broadcasts an onRequestStart message. So if you wish, you can just add a message-listener for the appropriate message broadcast -- see the page that Todd referenced for examples of this. If you prefer, however, you can define the relevant event-handler as Dan described, and broadcast whatever messages you would like. The first five events listed should be intuitive enough as to when they are invoked -- the sixth, onQueueComplete, is fired after all the views for a request have been queued, and before they are rendered. Do note that Model-Glue does not have any support for CF's onApplicationEnd event, so you will need to add this to your app's Application.cfc file if you wish to use it. -- Ezra Parker On Fri, Jan 14, 2011 at 6:50 AM, Dan Wilson <[email protected]> wrote: > ModelGlue has built in events for those as well. > > Just define an event handler for ModelGlue.onRequestStart ( or any of the > others ) and you'll be fine. > > > DW > > Sent from a mobile. Please excuse brevity and typos. > > -----Original Message----- > From: marc <[email protected]> > Sender: [email protected] > Date: Fri, 14 Jan 2011 06:44:36 > To: model-glue<[email protected]> > Reply-To: [email protected] > Subject: [Model-Glue] Re: Where do Coldfusion's implicit events fit in? > > Oops, overlooked that one. My bad. > > Guess I'll have to use application.cfc for the other events - > onRequestStart/onRequestEnd/onApplicationEnd? > > Marc > > On Jan 14, 2:44 pm, todd sharp <[email protected]> wrote: >> Have you had a look at the MG documentation? >> >> I'd start here: >> >> http://docs.model-glue.com/wiki/HowTos/ApplicationCFCIntegration#Appl... >> >> >> >> On Fri, Jan 14, 2011 at 8:22 AM, marc <[email protected]> wrote: >> > Hi, >> >> > I have been working a bit with Model-Glue now (Gesture) and realized >> > there are no implicit events (OnRequestStart, OnRequestEnd, >> > onSessionStart etc) defined in the MG frameWork. I want some events to >> > happen on applicationStart, some on sessionStart. I could of course >> > start coding in Application.cfc but rather keep that code in >> > controllers/services etc. I remember that in Coldbox these events >> > could be defined in the controller. Should I assume they just fire and >> > register them in ModelGlue.xml - so I get something like this: >> >> > <controller name="applicationController" >> > type="application.controller.controller"> >> > <message-listener >> > message="ModelGlue.onApplicationStart" >> > function="onApplicationStart" " /> >> > <message-listener message="ModelGlue.onSessionStart" >> > function="onSessionStart/> >> > <message-listener message="ModelGlue.onRequestStart" >> > function="onRequestStart/> >> > <message-listener message="ModelGlue.onRequestEnd" >> > function="onRequestEnd" /> >> > <message-listener message="ModelGlue.onsessionEnd" >> > function="onsessionEnd" /> >> > <message-listener >> > message="ModelGlue.onApplicationEnd" >> > function="onApplicationEnd" " /> >> > </controller> >> >> > and define the corresponding events in the controller? >> >> > Marc >> >> > -- >> > Model-Glue Sites: >> > Home Page:http://www.model-glue.com >> > Documentation:http://docs.model-glue.com >> > Bug Tracker:http://bugs.model-glue.com >> > Blog:http://www.model-glue.com/blog >> >> > You received this message because you are subscribed to the Google >> > Groups "model-glue" group. >> > To post to this group, send email to [email protected] >> > To unsubscribe from this group, send email to >> > [email protected]<model-glue%[email protected]> >> > For more options, visit this group at >> >http://groups.google.com/group/model-glue?hl=en >> >> -- >> Todd Sharp >> Sharp Interactive, LLChttp://slidesix.com-- Multimedia Enabled Presentation >> Sharing >> IM: [email protected] >> Blog: http://cfsilence.com >> Twitter: cfsilence | slidesix > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en > -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en
