• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Scheduled Task Event Handler Issue - CF 2018

New Here ,
Jul 10, 2019 Jul 10, 2019

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

102391Jul 10, 2019 12:25:00 PM Error [DefaultQuartzScheduler_Worker-8] - Response cannot be null
102392Jul 10, 2019 12:25:00 PM Information [DefaultQuartzScheduler_Worker-8] - Task GROUP_NAME.Brendan Test triggered.
102393Jul 10, 2019 12:25:00 PM Information [DefaultQuartzScheduler_Worker-8] - Starting HTTP request {URL='http://local.test.com/login/login.cfm', method='get'}
102394Jul 10, 2019 12:25:00 PM Information [DefaultQuartzScheduler_Worker-8] - HTTP request completed {Status Code=200 ,Time taken=16 ms}
102395Jul 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>

Views

328

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2019 Jul 11, 2019

Copy link to clipboard

Copied

There is an error in the documentation on the cfschedule listener at

https://helpx.adobe.com/coldfusion/developing-applications/developing-cfml-applications/using-the-co...

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>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 11, 2019 Jul 11, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 11, 2019 Jul 11, 2019

Copy link to clipboard

Copied

LATEST

Oh, strange. What do the following logs say?

mail

exception

scheduler

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation