Appears that SendGatewayMessage can only return error

Description

SendGatewayMessage is a valid function http://docs.lucee.org/reference/functions/sendgatewaymessage.html

Looking at SendGatewayMessage https://github.com/lucee/Lucee/blob/master/core/src/main/java/lucee/runtime/functions/gateway/SendGatewayMessage.java

it appears to do nothing but call sendMessage

Now I assume sendMessage is set up via taskgateway.cfc (It's also found in DirWatcher & MailWatcher)

looking at the source for taskgateway.cfc https://github.com/lucee/Lucee/blob/master/core/src/main/cfml/context/gateway/TaskGateway.cfc

I see the error message ERROR: sendMessage not supported as the only part of sendMessage. so it doesn't seem to do anything except return the error (in all 3 cfc's)?

Seems to me calling the valid SendGatewayMessage can have no other result other than returning an error.

Am I completely wrong here?

Environment

Server 2012 R2

Activity

Show:

Pothys - MitrahSoft 19 April 2017 at 04:41

I've modified the sendMessage() method's return text on DirectoryWatcher.cfc, MailWatcher.cfc and TaskGateway.cfc like the following:

sendGatewayMessage() has not been implemented for the event gateway [ name goes here ]. If you want to modify it, please edit the following CFC:
.. path of the cfc

Created a pull request ( https://github.com/lucee/Lucee/pull/210 )

Gert Franz 13 April 2017 at 16:05

I agree. I think the best way is to add the mention of the location of the method, so that people who want to implement it are aware of their ability to change the functionality. Thanks a lot for the input. I will assign the ticket accordingly.

Jay B (JayIsPainting) 13 April 2017 at 14:47

"The purpose of the asynchronous CFML gateway is to allow developers to offload long-running processes to the gateway. The gateway immediately passes control back to the application and does it's processing behind the scenes. "
http://coldfusion.sys-con.com/node/101326

That's basically exactly what I was doing. I have a bunch of CFC's that make up a long running process ie: get order data from DB, log into remote website, run something like 140 form posts & gets for each order (up to 300 orders in the loop), parse returned data, store to table, save pdfs... (it takes a human about 25 minutes per order to complete the process, code does it in 1-5 minutes depending on order items. This gateway was triggered by an external event and basically it runs like a background task. Code has been running daily since about 2004-5.

When I started the process of moving this code from ACF8 to Lucee last year, this process stopped working. I simply received the "ERROR: sendMessage not supported" message. Took me a while and some digging which finally led to raising this issue.

Now for my purposes, this gateway was easily replaced with a scheduled task as in practice, it didn't really need to be triggered by the external event but other cases, that may not be true.

Again, it's fine to not implement the default gateways if that's a project decision, but if that's the case, they should be removed from the UI and the error message made much clearer.

Gert Franz 13 April 2017 at 14:00

Hello Jay, I actually agree that if the sendGatewayMessage() returns "not implemented" then it seems like a bad choice. And yes it was/is. But for the directoryWatcher it definitely does not make any sense to implement that message by default.
I don't know the TaskGateway, but that should be the same. I also don't know what the asynch gateway does.
I would definitely appreciate any recommendations from you side. Thanks a lot.

Jay B (JayIsPainting) 13 April 2017 at 13:46

Hmmm. I actually was referring to taskGateway rather than dirWatcher. But OK. Feature not a bug.

"In the cases of the gateways shipped with Lucee, they just didn't make sense to implement."

That's certainly a valid choice by the project but It does break code that runs in ACF (that's how I ended up down this rabbit hole.) I was using the built in CFML Async Gateway in ACF8 and firing off code using onIncomingMessage.

It's been 8 months and I've rewritten the code entirely to not use gateways but if I remember, messages to the gateway returned "ERROR: sendMessage not supported" (Pothys also seems to have confirmed this)

I guess the real question then is why have the 3 built in event gateways at all if they are not implemented? It is certainly confusing (to me at least)

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 22 July 2016 at 15:00
Updated 17 April 2021 at 19:08