Scheduled Task Event Handler Issue - CF 2018
I am trying to implement a custom event handler to monitor our scheduled tasks. Ideally i will log the data into a db and make it searchable, but in the mean time I am just trying to fire an email to make sure it gets called. Unfortuntately the emails are not comming through, however I know the SMTP is set up correctly. Here is a copy of the logs and handler cfc I tested. Any ideas on why the emails arent sending or why I am getting the error that the Response Cannot Be Null?
I set the handle up in the Sceduled Task set up under more settings to point to my custom handler. When I fire the jobs, I do not see th email but instead see this in the logs,
In the scheduler log I see
| Jul 10, 2019 | 12:25:00 PM | Error | DefaultQuartzScheduler_Worker-8 | |
| Response cannot be null | ||||
| Jul 10, 2019 | 12:25:00 PM | Information | DefaultQuartzScheduler_Worker-8 | |
| Task GROUP_NAME.Brendan Test triggered. | ||||
| Jul 10, 2019 | 12:25:00 PM | Error | DefaultQuartzScheduler_Worker-8 | |
| Response cannot be null | ||||
And in the coldfusion-out.log I see
| 102391 | Jul 10, 2019 12:25:00 PM Error [DefaultQuartzScheduler_Worker-8] - Response cannot be null |
| 102392 | Jul 10, 2019 12:25:00 PM Information [DefaultQuartzScheduler_Worker-8] - Task GROUP_NAME.Brendan Test triggered. |
| 102393 | Jul 10, 2019 12:25:00 PM Information [DefaultQuartzScheduler_Worker-8] - Starting HTTP request {URL='http://local.test.com/login/login.cfm', method='get'} |
| 102394 | Jul 10, 2019 12:25:00 PM Information [DefaultQuartzScheduler_Worker-8] - HTTP request completed {Status Code=200 ,Time taken=16 ms} |
| 102395 | Jul 10, 2019 12:25:00 PM Error [DefaultQuartzScheduler_Worker-8] - Response cannot be null |
I have created a taskHandler.cfc
<cfcomponent implements="CFIDE.scheduler.ITaskEventHandler">
<cffunction name="onTaskStart" returntype="boolean">
<cfargument name="context" type="struct"/>
<cfmail from="myEmail@myEmail.com" subject="onTaskStart" to="myEmail@myEmail.com" type="html"><cfdump var="#arguments#"></cfmail>
<cfreturn true>
</cffunction>
<cffunction name="onMisfire" returntype="void">
<cfargument name="context" type="struct" required="false"/>
<cfmail from="myEmail@myEmail.com" subject="onMisFire" to="myEmail@myEmail.com" type="html"><cfdump var="#arguments#"></cfmail>
</cffunction>
<cffunction name="onTaskEnd" access="public" returntype="void">
<cfargument name="context" type="struct" required="false"/>
<cfmail from="myEmail@myEmail.com" subject="onTaskEnd" to="myEmail@myEmail.com" type="html"><cfdump var="#arguments#"></cfmail>
</cffunction>
<cffunction name="onError" returntype="void">
<cfargument name="context" type="struct" required="false"/>
<cfmail from="myEmail@myEmail.com" subject="onError" to="myEmail@myEmail.com" type="html"><cfdump var="#arguments#"></cfmail>
</cffunction>
<cffunction name="execute" returntype="void">
<cffile action="append" file="#Expandpath('.')#/log.txt" output="<b>In Execute</b>">
</cffunction>
</cfcomponent>
