Lucee and ActiveMQ

184 views
Skip to first unread message

Jacek

unread,
Oct 2, 2016, 10:01:10 PM10/2/16
to Lucee
I need to integrate a Web application deployed on Lucee 4.5 with ActiveMQ message broker. It should be able to both produce and consume messages, using ActiveMQ's queues.
I'm guessing one of the options would be to use Event Gateways, however in Lucee Web Admin I can only add "Directory Watcher", "Mail Watcher" and "Task Gateway", no "JMS Gateway" or similar.

What would be the most robust approach to this subject? Could you point me to any blog entries, tutorials or other examples?  I'd appreciate your comments.

Robert Zehnder

unread,
Oct 3, 2016, 12:42:04 PM10/3/16
to Lucee
I have something I threw together a few months ago just to see if I could do it (I could). While it wasn't specifically structured around ActiveMQ, it was using Amazon SQS, but I imagine it would be easy enough to implement.

Basically I create a long running thread in the background on the server that polls for messages every 15 seconds.


The queue process actually communicates with the AWS service through another CFC:


HTH

Jacek

unread,
Oct 6, 2016, 1:20:22 AM10/6/16
to Lucee
Robert,

Thank you for your response and code examples. This is an interesting approach. Was your decision about using cfthread instead of gateways caused by any particular issues with the latter, or just out of curiosity about cfthread?
I've read that long running threads are not recommended on busy Web/application servers, although I think this particular post was about PHP. We were using cfthread back in CF8 days, but it didn't behave well so we dropped the idea.
Could you share how does this long running process behave on your server? How do you monitor/control it? Doesn't it hang up/freeze/quit?

Robert Zehnder

unread,
Oct 6, 2016, 1:39:55 PM10/6/16
to Lucee
When I was originally trying to implement this code, I was trying to implement it as an event gateway on ACF. While that worked fine on ACF, as you initially pointed out, event gateways in Lucee are quite a cut and dried as they are on ACF. Also, a buddy had asked me why I decided to go with an event gateway when it could have been refactored to a cfthread. The event gateway code was introduced way before cfthread was an option, so respecting his opinion, I decided to go that route.

As far as impact of running the thread on busy application servers, I haven't run this implementation on any server with any amount of load. Mostly this was a PoC application just to see if I could implement it; I am afraid I don't have any hard data on how it would behave in a production environment.

jbvan...@hotmail.com

unread,
Oct 12, 2016, 5:03:41 PM10/12/16
to Lucee
Hi Jacek,

I'm also using queues accessed with JMS through Event Gateways. The code is available here: https://github.com/jbvanzuylen/cf-jms-gateway

Jean-Bernard

online...@gmail.com

unread,
Jan 17, 2017, 3:32:49 AM1/17/17
to Lucee
Hi Jean-Bernard,

Thought I'd give your extension a try, but using the upload downloaded extension function in Lucee 5.x I get an error: Only .lex extensions are allowed. I'm not sure if this is an error on Lucee's behalf or if they have changed their upload policies, because it clearly states that you should upload a ZIP-file, not a LEX-fle. Any ideas? I'll try the manual install as well and tell how that went. Really need Active MQ for a current ACF-webapp to be ported to Lucee.

Sebastiaan

Op woensdag 12 oktober 2016 23:03:41 UTC+2 schreef jbvan...@hotmail.com:
Reply all
Reply to author
Forward
0 new messages