Creating a background process in Lucee


Lately at work I have been using ColdFusion event gateways to accomplish a few very specific tasks. I thought it might be cool to see if I could leverage CFThread on Lucee do accomplish some of the same things.

The first step was writing a working demo with ColdFusion. A buddy was kind enough to point out that using an event gateway with a cfthread running inside of it was doing extra work for nothing. Event gateways were introduced before cfthread so I went ahead and just refactored it back as a regular ColdBox service. Everything was running smoothly in ColdFusion.

Next was trying to port the same code to Lucee since that is what I tend to run for personal projects. The one road block I did run up against is cfthread terminating at 50 seconds, the default request timeout for Lucee. It turns out there is a simple fix for it, but it made me scratch my head for a while since I didn’t run into it on ACF. The code with fix is below.

It was not a hard fix (setting the request timeout extremely large), but it did take a bit of google-fu to figure it out. Interestingly enough, setting the request timeout to zero did not work.

Advertisements

About Robert Zehnder

Web application developer specializing in ColdFusion/Railo and Open Source development.

Posted on July 18, 2016, in General, Lucee and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: