Hi Team..Can somebody please confirm, if pact supp...
# pact-jvm
a
Hi Team..Can somebody please confirm, if pact supports JSON RPC Integration type or not ?
y
Hey, It doesn’t but pact-jvm supports the pact-plugin framework, so it would be possible to create your own json-rpc aware pact-plugin.
a
Thanks for your response !!
y
No worries, how are you using json rpc? Over http, websockets or ipc? If its http, is there any reason why you couldn’t use regular pact? if it just a particular body format and headers? One of our community members @Adam Cox has created a websockets plugin which communicates over json-rpc with his employer, they wrote about it here. It isn’t open source but shows that it is possible. https://docs.pact.io/users/community_corner/adam_cox_interview_may2023 There is a feature req for websockets here https://pact.canny.io/feature-requests/p/plugin-websockets
a
Hi, Sorry for the delay in response, I have been away. The plan is still for us to Open Source the plugin but as it was done as part of a Corporate project the process for doing so is quite slow. Unfortunately I have moved on from the team that are responsible for the code, but I believe they are looking to prepare to release the plugin in the near future. I think the one thing to be wary of/or that is slightly niggly with JSON-RPC and contract testing is the
id
field. The value of it is really not relevant for the contract, however the id on the responsemust much the one on the request. You can't easily use the example field in the matching functions to make sure that it is always correct as you might not have control of the id value being set in the request. It will depend on how your client works. If you can create a new JSON-RPC client for each test though the id is normally 0 or 1 and this is easy to encode in the contracts