We should have noticed that sooner. The method in question is a MG message
listener and so is invoked like any other message listener method: with a
single eventContext argument.

I add to Ezra's suggestion by saying you should also change the
type="struct" to type="any" (or remove the type attribute) from the first
cfargument, and remove the second cfargument.


I noticed something else that might be a potential issue in other MG
applications. According to the Adobe LiveDocs, the application scope cannot
be referenced directly during the onSessionEnd event. We should therefore
modify the invokeSessionEvent to add the appScope argument into the values
structure along with the sessionScope, in case a controller method listening
to the onSessionEnd message wants to reference the application scope (for
whatever reason).


Cheers,

-- Dennis

On Fri, Dec 11, 2009 at 7:28 PM, Ezra Parker <[email protected]> wrote:

> It looks like the cause of the failure is the "sessionScope" argument
> in your onSessionEnd controller function.
>
> I pasted your code into a newly-created MG app, and got the same
> results (the second log message did not appear). Changing the name of
> the first argument to "event" resolved the problem.
>
> If you need to access the sessionScope, it is available as a value in
> the event instead of being passed in as an argument.
>
> HTH,
>
> --
> Ezra Parker
>
>
> On Fri, Dec 11, 2009 at 3:22 PM, Bob Silverberg
> <[email protected]> wrote:
> > Yes.  Everything else about sessions is working as expected.
> >
> > On Fri, Dec 11, 2009 at 5:53 PM, Chuck Savage <[email protected]>
> wrote:
> >>
> >> Do you have session management enabled?
> >>
> >> On Fri, Dec 11, 2009 at 12:17 PM, Bob Silverberg
> >> <[email protected]> wrote:
> >>>
> >>> Here are the relevant methods from App.cfc:
> >>>
> >>> <cffunction name="onSessionEnd" output="false">
> >>>
> >>> <cfargument name="sessionScope" type="struct" required="true">
> >>>
> >>> <cfargument name="appScope" type="struct" required="false">
> >>>
> >>> <cflog file="sessionTest" text="session ending!" />
> >>>
> >>> <cfset invokeSessionEvent("modelglue.onSessionEnd",
> >>> arguments.sessionScope, arguments.appScope) />
> >>>
> >>> </cffunction>
> >>>
> >>> <cffunction name="invokeSessionEvent" output="false" access="private">
> >>>
> >>> <cfargument name="eventName" />
> >>>
> >>> <cfargument name="sessionScope" />
> >>>
> >>> <cfargument name="appScope" />
> >>>
> >>> <cfset var mgInstances = createObject("component",
> >>>
> "ModelGlue.Util.ModelGlueFrameworkLocator").findInScope(arguments.appScope)
> >>> />
> >>>
> >>> <cfset var values = structNew() />
> >>>
> >>> <cfset var i = "" />
> >>>
> >>> <cfset values.sessionScope = arguments.sessionScope />
> >>>
> >>> <cfloop from="1" to="#arrayLen(mgInstances)#" index="i">
> >>>
> >>> <cfset mgInstances[i].executeEvent(arguments.eventName, values) />
> >>>
> >>> </cfloop>
> >>>
> >>> </cffunction>
> >>>
> >>> which were copied from modelglueapplicationtemplate/Application.cfc.
> >>>  Note that I actually added the arguments scope in front of the
> reference to
> >>> appScope in both methods as it was missing.
> >>> Here's what's in my MG.xml:
> >>>
> >>> <controller id="newController" type="controller.newController">
> >>>
> >>> <message-listener message="onSessionEnd" />
> >>>
> >>> </controller>
> >>>
> >>> And here's the contents of controller.newController.cfc:
> >>>
> >>> <cfcomponent output="false" hint="I am a Model-Glue controller."
> >>> extends="ModelGlue.gesture.controller.Controller">
> >>>
> >>> <cffunction name="onSessionEnd" output="false">
> >>>
> >>> <cfargument name="sessionScope" type="struct" required="true">
> >>>
> >>> <cfargument name="appScope" type="struct" required="false">
> >>>
> >>> <cflog file="sessionTest" text="onSessionEnd fired in controller!" />
> >>>
> >>> </cffunction>
> >>>
> >>> </cfcomponent>
> >>>
> >>> When a session ends, I see one message in the log file, the one
> generated
> >>> from onSessionEnd() in my Application.cfc, but I do not see the second
> >>> message, which is meant to be generated by onSessionEnd() in my
> controller.
> >>> Thanks,
> >>> Bob
> >>>
> >>> On Fri, Dec 11, 2009 at 12:25 PM, Dennis Clark <[email protected]>
> >>> wrote:
> >>>>
> >>>> Bob, have you copied the methods in
> >>>> modelglueapplicationtemplate/Application.cfc to your own
> Application.cfc?
> >>>>
> >>>>
> >>>> On Fri, Dec 11, 2009 at 12:00 PM, Bob Silverberg
> >>>> <[email protected]> wrote:
> >>>>>
> >>>>> Looking at the code, it appears as if I can add an onSessionEnd
> >>>>> function to a controller, along with an associated message listener
> in my
> >>>>> xml file, and it should fire when a session ends.  But it's not
> firing.
> >>>>> Any ideas?
> >>>>> Cheers,
> >>>>> Bob
> >>>>>
> >>>>> --
> >>>>> Bob Silverberg
> >>>>> www.silverwareconsulting.com
> >>>>>
> >>>>> --
> >>>>> 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
> >>>>
> >>>> --
> >>>> 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
> >>>
> >>>
> >>> --
> >>> Bob Silverberg
> >>> www.silverwareconsulting.com
> >>>
> >>> --
> >>> 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
> >>
> >>
> >> --
> >> Chuck Savage
> >> SeaRisen LLC
> >> Website: http://www.SeaRisen.com
> >>
> >> --
> >> 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
> >
> >
> > --
> > Bob Silverberg
> > www.silverwareconsulting.com
> >
> > --
> > 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
>
> --
> 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
>

-- 
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

Reply via email to