Synchronous response from REST API
----------------------------------
Key: AMQ-1453
URL: https://issues.apache.org/activemq/browse/AMQ-1453
Project: ActiveMQ
Issue Type: New Feature
Reporter: Dejan Bosanac
Fix For: 5.0.0
Attachments: activemq-web-lingo.patch
In some situations it could be very useful to use REST API in the "synchronous
mode".
I've implemented this in the following manner:
If the "sync" header is set to the POST request the module will use Lingo
project to perform request/response action with a given timeout.
The timeout value could be set through the "replyTimeout" servlet config
parameter. A default value is 1000 (1s).
In case that response comes back in a specified time, the message will be
returned as a response body. Timout exception will be ignored (maybe this could
be configurable too?) so it will return OK status with empty response body
(just as it is now) in case of timeout.
In case that "sync" header is not set the API behaves the same as now.
I've considered a few options for this implementation, but Lingo in the end
seemed the best solution. It is not too heavy and it could be potentially used
for other stuff in the future. One thing I would like to see improved in Lingo
in the future is support for sending a message with persistency, priority and
time to live parameters (new "request" method signature). Also, it depends on
old version of amq which must be excluded in dependency declarations since it
breaks the build. I could implement these improvments if you are interested.
I think this is quite a useful feature. I'm using it in a current project, but
I would like if it could be included in a activemq-web module in the future.
So, if anyone have any ides how some of these stuff could be implemented better
or have some fresh ideas, please let me know.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.