My CF pipe dream
With the advent of CFTHREAD and CFJOIN within BD and the POC for CFMX7, this got me dreaming. Wouldn’t be cool to have a CFSERVICE tag. Now bear with me on this, because I know a lot of you are probably thinking I’ve been sniffing too much toner.
Here’s the scenerio:
I want to write a template that goes out to the internet and grabs 10 XML feeds from 10 different websites.
I can accomplish this now in a couple of ways:
1) I can write a mess of CFHTTP calls into the template itself using CFTHREAD and CFJOIN. The problem with this is that it’s executed on every request to the page and this could take a little while to get done. Plus if the page isn’t hit for 10 minutes, my data won’t get updated for 10 minutes. This leads to idea 2.
2) A better way would be to take the CFHTTP calls and create a different template and make it a scheduled task. I could them take the results of the schedule task and throw them into an application scope variable. My original template would just reference the application scope variable and pull the data from that. This is probably be the current way most people would handle this. The problem still is that you will see the CF process jumping up and down a lot since each CFHTTP call is a seperate thread.
My pipe dream:
Take the same code used and wrap a CFSERVICE tag around it. The template would only have to be executed once to create a Windows Service to handle the task. Now the service can perform the task indepently from CFMX with a way to pass the information to CFMX. Kinda like:
DURATION=”#CreateTimeSpan(0, 0, 0, 10)#”
<!— CFCODE GOES HERE —>
I know I’m living a pipe dream, but then again it’s Friday, it’s an idea, I need a drink, a cigarette and I still have 3 hours of work left :P.