How to write a plugin to override message processing before storing or routing in openfire

we wanted to write a openfire plugin which will override the openfire message listener. SO, basically in openfire after the message received from client it will store and route to recepients. So, I wanted to store the status of message by adding in new column and if certain condition met, want to send notification to all participants of that muc. So, how this implementation can be done in openfire ?. Any help would be appreciated.

See PacketInterceptor

https://download.igniterealtime.org/openfire/docs/latest/documentation/plugin-dev-guide.html