I would like to kick off ColdFusion event gateway instances by invoking services in my application. However, the services are within the ColdBox framework. Any idea on how I could call a service within the ColdBox framework that can be configured to the ColdFusion’s event gateway.
You can easily do this by creating a CFC that extends from our ColdBox Proxy object: coldbox.system.remote.ColdboxProxy
http://wiki.coldbox.org/wiki/ColdboxProxy.cfm
Luis Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com
P/F: 1-888-557-8057
Direct: (909) 248-3408
ColdBox Platform: http://www.coldbox.org
ContentBox Platform: http://www.gocontentbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Social: twitter.com/ortussolutions | twitter.com/coldbox | twitter.com/lmajano | twitter.com/gocontentbox
Hi Jae,
You can use coldbox-proxy with your event-listener… Good example https://github.com/ryanguill/emit
So obvious. I feel dumb. Let me try that and let you know how that works out. Thank you!
Jae
I’m getting the following error when invoking the gateway.
Error invoking CFC for gateway OCR Queue Process: Event handler exception. {GATEWAYTYPE={CFMLGateway},ORIGINATORID={CFMLGateway},DATA={{FILEARR={{INFO={[{TYPE={application/pdf},NAME={20150218121059304.pdf}}]}}}}},GATEWAYID={OCR Queue Process}}. An exception occurred while invoking an event handler method from Application.cfc. The method name is: onSessionStart.
Below is the code in my Proxy file.
`
component extends=“coldbox.system.remote.ColdboxProxy” output=“false” {
remote void function onIncomingMessage(required struct CFEvent) {
arguments.event = “filemanager.roRenameUpload”;
arguments.info = arguments.CFEvent.Data.fileArr;
results = super.process(argumentCollection=arguments);
}
}
`
Also, I’ve attached my Application.cfc. Not sure why I’m getting an error.
Application.cfc (5.5 KB)
Can you look in your logs and see what the actual error was. All that text tells us is that there WAS an error in onSessionStart.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com
Below is the actual error.
`
“Error”,“Thread-17”,“03/05/15”,“21:09:52”,“Error invoking CFC for gateway OCR Queue Process: Event handler exception. {GATEWAYTYPE={CFMLGateway},ORIGINATORID={CFMLGateway},DATA={{FILEARR={{INFO={[{TYPE={application/pdf},NAME={201502181210593043.pdf}}]}}}}},GATEWAYID={OCR Queue Process}}. An exception occurred while invoking an event handler method from Application.cfc. The method name is: onSessionStart.”
coldfusion.runtime.EventHandlerException: Event handler exception.
at coldfusion.runtime.AppEventInvoker.onSessionStart(AppEventInvoker.java:439)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:369)
at coldfusion.filter.EventRequestMonitorFilter.invoke(EventRequestMonitorFilter.java:47)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.eventgateway.EventProxy.invokeComponent(EventProxy.java:66)
at coldfusion.eventgateway.EventProxy.invokeComponent(EventProxy.java:47)
at coldfusion.eventgateway.EventRequestHandler.invokeCFC(EventRequestHandler.java:185)
at coldfusion.eventgateway.EventRequestHandler.processRequest(EventRequestHandler.java:111)
at coldfusion.eventgateway.EventRequestDispatcher$Task.run(EventRequestDispatcher.java:130)
at coldfusion.util.SimpleWorkerThread.run(SimpleThreadPool.java:214)
Caused by: coldfusion.runtime.CfJspPage$NoSuchTemplateException: Could not find the ColdFusion component or interface handlers.Main.
at coldfusion.runtime.TemplateProxyFactory.getResolvedFile(TemplateProxyFactory.java:1345)
at coldfusion.runtime.TemplateProxyFactory.getTemplateFileHelper(TemplateProxyFactory.java:1572)
at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:51)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5590)
at coldfusion.runtime.CFPage.CreateObject(CFPage.java:5605)
at cfBuilder2ecfc1844647372$funcBUILDCFC.runFunction(C:\cfmx-components\coldbox\system\ioc\Builder.cfc:89)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2428)
at cfInjector2ecfc1807763616$funcBUILDINSTANCE.runFunction(C:\cfmx-components\coldbox\system\ioc\Injector.cfc:288)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2428)
at cfNoScope2ecfc710612445$funcGETFROMSCOPE.runFunction(C:\cfmx-components\coldbox\system\ioc\scopes\NoScope.cfc:31)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2428)
at cfInjector2ecfc1807763616$funcGETINSTANCE.runFunction(C:\cfmx-components\coldbox\system\ioc\Injector.cfc:261)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2428)
at cfHandlerService2ecfc1865792726$funcNEWHANDLER.runFunction(C:\cfmx-components\coldbox\system\web\services\HandlerService.cfc:120)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2655)
at cfHandlerService2ecfc1865792726$funcGETHANDLER.runFunction(C:\cfmx-components\coldbox\system\web\services\HandlerService.cfc:141)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2428)
at cfController2ecfc1232373555$funcRUNEVENT.runFunction(C:\cfmx-components\coldbox\system\web\Controller.cfc:550)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:518)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:660)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:469)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2369)
at cfColdbox2ecfc1530171299$funcONSESSIONSTART.runFunction(C:\cfmx-components\coldbox\system\Coldbox.cfc:449)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2428)
at cfApplication2ecfc826623336$funcONSESSIONSTART.runFunction(C:\inetpub\fileorg.wamdt.com\web\Application.cfc:105)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)
at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)
at coldfusion.runtime.AppEventInvoker.invoke(AppEventInvoker.java:108)
at coldfusion.runtime.AppEventInvoker.onSessionStart(AppEventInvoker.java:431)
… 12 more
`
I finally figured it out. I had the following under this.mappings.
`
<cfset this.mappings["/fileorg"] = COLDBOX_APP_ROOT_PATH>
`
So I had to set the COLDBOX_APP_MAPPING as follows.
`
`
That solved the issue. Thanks for everything.