slidenumbers: true
Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure. -- Melvyn Conway, 1967
- Crossing Boundaries ➡️ Increased Complexity
- Interfaces to Other Contexts
- Availability of Other Services
- Input/Output Data Structure Expectations
- Side Effects
- Performance Characteristics
- Concurrency Characteristics
I capture my expectations of your service as a suite of automated tests that I provide to you.
You run them in your continuous integration pipeline.
https://github.com/realestate-com-au/pact
https://github.com/DiUS/pact-jvm
@Pact(state = "FortuneState", provider = "FortuneService", consumer = "FortuneUi")
public PactFragment createFragment(ConsumerPactBuilder.PactDslWithProvider.PactDslWithState builder) {
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json;charset=UTF-8");
PactDslJsonBody responseBody = new PactDslJsonBody()
.numberType("id")
.stringType("text");
return builder.uponReceiving("a request for a random fortune")
.path("/random")
.method("GET")
.willRespondWith()
.headers(headers)
.status(200)
.body(responseBody).toFragment();
}
{
"provider" : {
"name" : "FortuneService"
},
"consumer" : {
"name" : "FortuneUi"
},
"interactions" : [ {
"providerState" : "FortuneState",
"description" : "a request for a random fortune",
"request" : {
"method" : "GET",
"path" : "/random"
},
"response" : {
"status" : 200,
"headers" : {
"Content-Type" : "application/json;charset=UTF-8"
},
"body" : {
"id" : 8440038105,
"text" : "JaizxIwBpBfLDObNbYRu"
},
"responseMatchingRules" : {
"$.body.id" : {
"match" : "type"
},
"$.body.text" : {
"match" : "type"
}
}
}
} ],
"metadata" : {
"pact-specification" : {
"version" : "2.0.0"
},
"pact-jvm" : {
"version" : "2.1.13"
}
}
}
<plugin>
<groupId>au.com.dius</groupId>
<artifactId>pact-jvm-provider-maven_2.11</artifactId>
<version>2.1.13</version>
<configuration>
<serviceProviders>
<serviceProvider>
<name>FortuneService</name>
<consumers>
<consumer>
<name>FortuneUi</name>
<pactFile>../fortune-teller-ui/target/pacts/FortuneUi-FortuneService.json</pactFile>
</consumer>
</consumers>
</serviceProvider>
</serviceProviders>
</configuration>
</plugin>
https://github.com/bethesque/pact_broker
^ Mean Time Between Failures
^ Mean Time To Recovery
Monitor the snot out of production and staging! -- Elisabeth Hendrickson