Hey, looking for advice on using pact contract tes...
# general
t
Hey, looking for advice on using pact contract testing for event driven services. The standard Pact consumer-driven model requires the consumer to explicitly name each provider in the contract. In event-driven systems, the consumer typically only cares about the topic and the message shape, not which service produced it. This creates friction every time a new producer comes along, because it requires a change on the consumer side just to add the named pairing. Has anyone tackled this by modeling the "provider" as the topic itself rather than the producing service? The ideal end state would be something like: a provider declares it produces to a topic, a consumer declares it consumes from that topic, and verification runs automatically across all providers mapped to that topic — no consumer changes required when a new producer onboards.
m
Yeah, it’s a fair question. We don’t have a way to model the topic at this point, so you’re still stuck. But ultimately you could just use the topic name as the “provider” application. And then the real provider/producer can verify them. Should the underlying producer of the topic change, it still should work. The new producer uses the topic name when verifying, and the old one (presumably) stops verifying.
I know it’s not first class, but I think that might work. Unless of course multiple producers push to a topic, in which case you might need to use the event name or something 😉
r
This creates friction every time a new producer comes along
Do you mean that a new producer can produce the same event? In our Event-driven setup, services that produce events also own those events, which means they are the only producer. If there are multiple application producing the same event. then a topic-based approach also is not going to work. Because then you can verify provider tests based on the topic name. But you cannot record deployments because there are actually multiple applications using the same topic. I guess setting up good webhooks will be difficult too
thankyou 1