Hi guys, I'm trying to clear all FlowFIles in all queues when NiFi is restarted, but I don't know the correct way to do this. I checked all NiFi's guide documentation, it seems there're 2 possible solutions: 1. write a custom notification service: a notification service could be notified when NiFi is restarted and then inside the service, delete all the files inside content_repository, flowfile_repository and provenance_repository. I know there're now 2 existing services: email and http. But I'm not quite sure how to correctly write one and deploy it into my NiFi environment, is there a tutorial on writing one notification service?
2. I know from the developer guide that by using the annotation @Shutdown in a custom processor, the method could be called when NiFi is successfully shut down. The problem with this approach is the method could not be guaranteed to be called when NiFi dies unexpectedly. Does anyone know what is the correct way to implement it? Thanks. Regards, Ben