Hey everybody. I have a question about consumer t...
# general
r
Hey everybody. I have a question about consumer tests for messaging (events) where multiple producers (in different code base) could publish the same event based on a shared json schema. Lets say we have a
SomethingHappened
event that is being received by
ConsumerApp
, the event can be published by both
PublisherA
,
PublisherB
and
PublisherC
. The
ConsumerApp
does not really care about which producer has produced the event, since all it needs to to is process the event based on two fields that the event is always expected to have. So my question. Is is possible to have one customer contract that is verified by multiple providers? What is the best way to do this?
m
Yes, you’re right in that sense. Pact does force you to name the provider though, which isn’t ideal. It’s been discussed in the past, but probably lost to slack history.
In practice, do these events genuinely get produced by all three, or is this a theoretical question about being able to replace the provider down the track?
If any of the three can publish the event to the queue, probably you need to publish the pact 3 times - each with a different provider name (this will of course require 3 providers to validate before releasing)
r
Basically the three applications are different variants of a process that can be followed. The process is so different that separate applications are created for them (but they do have shared json schemas). Different deployments of the application may have certain apps deployed or not, depending on whehter that functionality is enabled. It actually kind of makes sense to publish the pact 3 times, but it would be really nice if Pact has support for this type of integration where multiple message providers have a common API