I am currently trying to learn consumer-driven contract testing in the context of Services that use ActiveMQ Messages to communicate. Spring offers a documentation for Spring Cloud Contract Verifier Messaging https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html#_spring_cloud_contract_verifier_messaging but I was not able to follow it with the setting I have ( Spring Services and ActiveMQ ).
My question is:
but I was not able to follow it with the setting I have ( Spring Services and ActiveMQ ).
ActiveMQ is not supported out of the box, you would have to provide your own bean of MessageVerifier
type, where you would teach the framework on how to send and receive messages
Is it a good idea to use consumer-driven contract testing for messaging ?
Absolutely! You can follow the same flow as with HTTP but for messaging
What are the best practices ?
It depends ;) You can follow the standard practices of doing cdc as if it was an http based communication. If you want to abstract the producer and the consumer of such messages in such a way that you care more about the topic / queue as such, you can follow this guideline https://cloud.spring.io/spring-cloud-static/Greenwich.SR2/single/spring-cloud.html#_how_can_i_define_messaging_contracts_per_topic_not_per_producer where we describe how to define messaging contracts per topic and not per producer
If its a good idea, do you have any good tutorials on this for consumer-driven contract testing spring services that communicate via JMS and ActiveMQ ?
As I said earlier we don't have such support out of the box. You can however use Spring Integration or Apache Camel and communicate with ActiveMQ via those.