Feature Request: Provide a "ping" operation
sopgreg opened this issue · 2 comments
Our backend application needs to monitor if Holodeck is running. We are already using the REST backend for submission / reception. Using the REST backend for "ping" purposes would be a convenient way to accomplish this.
Should I open a PR for this? Basically, there are only two changes necessary:
rest-backend-service.xml
<operation name="ping">
<messageReceiver class="org.holodeckb2b.backend.rest.PingOperation"/>
</operation>
New file org.holodeckb2b.backend.rest.PingOperation
:
package org.holodeckb2b.backend.rest;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.receivers.AbstractMessageReceiver;
public class PingOperation extends AbstractMessageReceiver {
@Override
public void invokeBusinessLogic(final MessageContext msgCtx) {
}
}
This results in a HTTP 202 result, which can be interpreted by our backend:
POST http://localhost:8089/holodeckb2b/restbackend/ping
HTTP/1.1 202 Accepted
Date: Thu, 06 Jan 2022 08:24:58 GMT
Transfer-Encoding: chunked
Connection: Keep-Alive
<Response body is empty>
Response code: 202 (Accepted); Time: 112ms; Content length: 0 bytes
If you just want to check if the gateway if running you can also execute a GET request for URL path /holodeckb2b. If the gateway is running it will respond with a HTTP 200 and a simple HTML page (which you can simply ignore).
This does work, but it does not guarantee that the REST backend extension is also correctly deployed. This would therefore be a useful extension