You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are 2 common messaging collaboration patterns that might be used between 2 services and verified by contract tests.
Service A consumes an event message published by Service B. The event message schema is part of Service B's contract and Service A would be said to depend on Service B in this context
Service A sends a command message to a queue consumed by Service B. The request message schema is part of Service B's contract. Service A is making use of the functionality of Service B to do its job. It is very similar to a typical HTTP API request. Service A would be said to depend on Service B in this context
Consumer: An application that makes use of the functionality or data from another application to do its job. For applications that use HTTP, the consumer is always the application that initiates the HTTP request (eg. the web front end), regardless of the direction of data flow. For applications that use queues, the consumer is the application that reads the message from the queue.
Provider: An application (often called a service) that provides functionality or data for other applications to use, often via an API. For applications that use HTTP, the provider is the application that returns the response. For applications that use queues, the provider (also called producer) is the application that writes the messages to the queue.
However, any user looking for guidance on how to add tests for a command message interaction might be confused by the above. From a dependency point-of-view, you would intuitively view the service (Service A) that "calls" the other service as the consumer (similar to an HTTP API call) and the service that owns the message contract (Service B) and does the work requested in the command message as the provider. However, the documentation above states very clearly that the service that reads messages from the topic should be the consumer, which is the opposite!
It would be useful to understand how the designers of Pact would view the provider and consumer roles in a command message collaboration scenario. Should the provider be based purely on who is writing the message, or should it be based on who defines the message contract? Some guidance in the documentation either way would be extremely useful.
The text was updated successfully, but these errors were encountered:
I'll look to absorb and answer your points in time. We are really open to improving both our terminology, examples and documentation around EDA based systems, so love to collab
There are 2 common messaging collaboration patterns that might be used between 2 services and verified by contract tests.
The Pact documentation (https://docs.pact.io/getting_started/how_pact_works) seems to fit the event message collaboration pattern well:
However, any user looking for guidance on how to add tests for a command message interaction might be confused by the above. From a dependency point-of-view, you would intuitively view the service (Service A) that "calls" the other service as the consumer (similar to an HTTP API call) and the service that owns the message contract (Service B) and does the work requested in the command message as the provider. However, the documentation above states very clearly that the service that reads messages from the topic should be the consumer, which is the opposite!
This has been summarised well in a blog post - https://dev.to/frosnerd/message-pact-contract-testing-in-event-driven-applications-1aej (see the "Message Pact and the Command Pattern" section). This also suggests how to work around it to more faithfully reflect the dependency direction.
It would be useful to understand how the designers of Pact would view the provider and consumer roles in a command message collaboration scenario. Should the provider be based purely on who is writing the message, or should it be based on who defines the message contract? Some guidance in the documentation either way would be extremely useful.
The text was updated successfully, but these errors were encountered: