I've added my custom code as follows
public class StatusUpdateHook implements Hook {
private static final Logger LOGGER = LoggerFactory.getLogger(StatusUpdateHook.class);
@Override
public boolean hook(HttpServerExchange exchange, RequestContext context, BsonValue args, BsonDocument confArgs) {
LOGGER.info("Hook is Called");
return true;
}
@Override
public boolean doesSupportRequests(RequestContext rc) {
return true;
}
}
added the following line in my config as well,
- group: hooks
interface: org.restheart.metadata.hooks.Hook
singletons:
- name: snooper
class: org.restheart.metadata.hooks.SnooperHook
- name: statusChecker
class: com.techmaddy.rh.hook.StatuspdateHook
But still i'm not able to get this printed in the log, i'm sure i'm missing the part of adding hooks to collection. How do we add that i.e How do we do this "The collection metadata property hooks allows to declare the hooks to be applied to the requests involving the collection and its documents", which is from the document.