I believe that ModelGlue/gesture/eventrequest/EventContext.cfc needs a
small addition on line ~208:
<cfif isObject(getCurrentEventHandler()) and
getCurrentEventHandler().name neq exceptionEventHandler and
variables._modelGlue.hasEventHandler(exceptionEventHandler)>
<cfset
addEventHandler(variables._modelGlue.getEventHandler(exceptionEventHandler))
/>
<!--- bdg: insert onQueueComplete here as aborting the
current handler and short-circuiting to exception handler seems to ignore
onqueueComplete? --->
<cfset
addEventHandler(variables._modelGlue.getEventHandler("modelglue.onQueueComplete"))
/>
<cfset executeEventQueue() />
<cfelse>
<cfrethrow />
</cfif>
I'm not sure if this is the correct fix or not but it does seem to resolve
it for me in my initial testing. I think onQueueComplete should be queued
after the exception handler rather than before but I'm not sure? This
results in the following output when I put an intentional error into
CalendarController.getCurrent():
10/06 11:30:56 Information [jrpp-3] - [Message Listener][1140ms] - Invoking
getCurrent in PUKKA_MAIN_MAP.controller.CalendarController
10/06 11:30:56 Information [jrpp-3] - [Exception][1145ms] -
coldfusion.runtime.UndefinedVariableException: Variable ATTENDEE is
undefined.
10/06 11:30:56 Information [jrpp-3] - [Event Queue][1277ms] - Queueing
event handler: exception
10/06 11:30:56 Information [jrpp-3] - [Event Queue][1331ms] - Queueing
event handler: ModelGlue.onQueueComplete
10/06 11:30:56 Information [jrpp-3] - [Event Handler][1334ms] - Execute
""exception""
10/06 11:30:56 Information [jrpp-3] - [Message Broadcast][1338ms] -
Broadcasting ""needToSendExceptionEmail""
10/06 11:30:56 Information [jrpp-3] - [Message Listener][1341ms] - Invoking
doSendExceptionEmail in PUKKA_MAIN_MAP.controller.MailController
10/06 11:30:56 Information [jrpp-3] - [Result][1417ms] - Implicit result
queing event ""view.render""
10/06 11:30:56 Information [jrpp-3] - [Event Queue][1466ms] - Queueing
event handler: view.render
10/06 11:30:56 Information [jrpp-3] - [View Queue][1476ms] - View queued:
dsp.exception.cfm
10/06 11:30:56 Information [jrpp-3] - [Event Handler][1479ms] - Execute
""ModelGlue.onQueueComplete""
10/06 11:30:56 Information [jrpp-3] - [Message Broadcast][1482ms] -
Broadcasting ""onQueueComplete""
10/06 11:30:56 Information [jrpp-3] - [Message Broadcast][1485ms] -
Broadcasting ""OnQueueComplete.shareTheme""
10/06 11:30:56 Information [jrpp-3] - [Message Listener][1488ms] - Invoking
shareTheme in PUKKA_MAIN_MAP.controller.ThemeController
OnQueueComplete should trigger ThemeController.shareTheme() which is
required for the site to render. With the above change, it's now being
called during exceptions.
I have yet to figure out why it doesn't work on 404s and in other
occasional scenarios.
Brian
On Friday, October 5, 2012 9:18:37 PM UTC-7, Brian G wrote:
>
> I'm upgrading my Unity application to 3.2 RC1... I seem to be finding that
> onQueueComplete does not fire reliably. I use it to share a utility
> library and a design theme prior to rendering the queued views. There are
> two instances where it doesn't seem to fire:
>
> * event not found (~404, fails 100% of the time to fire onqueuecomplete)
> * Initial load (of the domain just domain.com/, this one fails about 50%
> of the time)
>
> My controllers.xml looks like:
>
> <controller name="ThemeController" type="controller.ThemeController">
> <message-listener message="onQueueComplete" function="shareTheme" />
> </controller>
>
> ThemeController (which works perfectly fine the rest of the time) looks
> like:
>
> <cffunction name="shareTheme" access="public" returntype="void"
> output="false">
> <cfargument name="event" type="ModelGlue.Core.Event" required="true" />
>
> <cflog file="application" text="OnQueueComplete() sharing theme:
> #getSessionService().getTheme()#..." />
> <cfset arguments.event.setValue("theme",
> getThemeService().getTheme(getSessionService().getTheme())) />
> </cffunction>
>
> I don't get the CFLOG output on initial load nor when I try and request an
> event that doesn't exist. In both cases I wind up getting an error
> indicating that the theme object is not defined because shareTheme is never
> executed. It works fine the rest of the time.
>
> I've dug into the code a bit but I can't determine why it wouldn't fire...
> it *seems* to have something to do with when MG internally redirects (e.g.,
> from event not found to exception handler, and maybe from 'no event' to
> 'default event' during initial load), it fails to fire onQueueComplete. In
> Invocation.cfc, the only instance of calling executeEventQueue() with the
> true parameter to trigger the onQueueComplete broadcast, the code that
> throws errors for missing events is just above it. I don't think it can
> ever get to a place where executeEventQueue is called with true as a
> parameter in that instance.
>
> Any ideas?
>
>
> Brian
>
>
>
--
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