Thank you for the response. This idea worked wonderfully.
To share the things I did,
- I created a shared package that will be consumed by both plugin.
- Create implementation of
ActionRequestandActionResponsethat is right for you. Make sure to overridereadFromandwriteTo. This is key to enable recreating theRequestandResponsewhen communicating between plugin. - In the shared plugin, created a class that implements from
org.elasticsearch.action.Actionwhich accepts specific request type and return genericActionResponse. - In Plugin that is receiving the call, create class that implements
HandledTransportActionwith genericActionRequestandMyResponsewhich is the implementation ofActionResponse - In
MyHandledTransportActionwill usereadFrominActionRequestto create correctRequestType. OnceMyRequestis recreated then all the information for the request is there and now do what is needed for the Request and returnMyResponse. - From MyPlugin send request with specific request format but it will get back ActionResponse. Once the ActionResponse is returned from the client, use the
readFrommethod to get the specific type of the response back.
Thank you for the help and feel free to close this thread.