Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
There is an error in the documentation on the cfschedule listener at
I have just reported it: CF-4204837.
To solve your problem, add an argument to the 'execute' event, as follows:
<cffunction name="execute" returntype="void">
<cfargument name="context" type="struct" required="false" />
<cffile action="append" file="#Expandpath('.')#/log.txt" output="<b>In Execute</b>">
</cffunction>
Copy link to clipboard
Copied
Thank you. I have added in the argument but am still be presented the Response cannot be null error.
I am wondering if this is a new issue since moving to the quartz engine. I am going to try and do some additional error handling to see if I can determine where the repose cannot be null is coming from. Ill update the ticket if / when I find it.
Copy link to clipboard
Copied
Oh, strange. What do the following logs say?
exception
scheduler