ColdBox, RequestContextDecorator, WireBox and Event Gateways: Gotcha!

I just found a bug in my application and wanted to advise the community for any others who may cross this path. This is using ColdBox 3.5 bleeding but I suspect it goes back to v3.

In a CMS application I use Event Gateways to kick off a chain of events asynchronously when a record is saved. When the message is received by the subscriber CFC I ask WireBox to grab my models for me so I can get on with my with.

var myModel = application.WireBox.getInstance(model_name);

WireBox starts a whole series of events ending up in the RequestService trying to create the RequestContext object. In my application, it was throwing errors that it could not find my RequestContextDecorator object.

\lib\frameworks\coldbox35\system\web\services\RequestService.cfc:242 (Error Here)
\lib\frameworks\coldbox35\system\web\services\RequestService.cfc:204
\lib\frameworks\coldbox35\system\web\services\InterceptorService.cfc:131
\lib\frameworks\coldbox35\system\ioc\Injector.cfc:473
\lib\frameworks\coldbox35\system\ioc\scopes\Singleton.cfc:48
\lib\frameworks\coldbox35\system\ioc\Injector.cfc:262
\atvcms\model\asynchronous\Subscriber.cfc:38

The fix was simple. I added my application mapping to the RequestContextDecorator in my ColdBox.cfc.

Hope this helps someone.

Thanks,

Aaron Greenlee

Aaron,

I run across this using event gateways as well. It seems that mappings get lost for some reason, so creating an object is the issue. I am always pesky on creating the mappings as CF for some reason was not seeing them.

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano