We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies.

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies. Less

We use cookies and other tracking technologies... More

Login or register
to apply for this job!

Login or register
to save this job!

Login or register
to save interesting jobs!

Login or register
to get access to all your job applications!

Login or register to start contributing with an article!

Login or register
to see more jobs from this company!

Login or register
to boost this post!

Show some love to the author of this blog by giving their post some rocket fuel 🚀.

Login or register to search for your ideal job!

Login or register to start working on this issue!

Engineers who find a new job through Functional Works average a 15% increase in salary 🚀

Blog hero image

Microservices and CDC(Consumer Driven Contract) tests

Ravi Allishe 24 August, 2020 | 2 min read

Monolithic architecture is where the entire modules are implemented in one single application. Now, this app could be faster as there will be not many network calls, faster in performance but does it suffice the other below points?

will it smoothly grow in size without the complexity? are continuous deployment and continuous integration possible as there will be frequent changes for different modules? business needs are growing rapidly and so does app scaling challenges. So is it scalable? being highly coupled modules, will the application work if one of the modules is down and another module has over traffic? Microservice architecture has all the above advantages. Monolithic is good if it's a small application and never changing but as it's said

"CODE IS NEVER WRITTEN, IT'S ALWAY REWRITTEN. CHANGE IS CONSTANT". Hence, Everyone is moving towards Microservice architecture.

The name itself explains that developing the individual small services is easy to test and deploy with the rapid growth. Over time there will be a large number of microservices where some are dependent on others as a consumer and some providing the services to the consumer.

Making frequent changes to each microservice will make the developer uncertain and unreliable to deploy it as dependent microservices may break if the contract fails. This is where the CDCs(Consumer-Driven Contract) test comes into the picture to give you confidence.

CDCs Setup between Consumer as a client and Provider API:

The consumer has to write the test for the contract between it and the Provider. The consumer has to tell the provider how it is using the Provider's service as a whole or part of it. In the pre-stage of deployment, Consumer will run the tests. Failing to pass the contract, deployment is not taken further. (not mandatory on all stages like dev, qa, staging or live). The Provider also runs the consumer test on its side before deploying it to make sure that its changes won't affect the consumers to whom it is providing the service. Consumer's test should be run on each environment (mandatory to run on dev, qa, staging and live) as a pre-stage(recommended). The reason being let's say if Provider runs contract tests in dev but not in live env then consumer live application will fail. CDCs setup can be done using the Pact framework which is widely used with its huge number of language support. It can also be done with the help of the DevOps team providing a provision to run tests at the pipeline stages.

Once CDCs are in place developers will be at peace of mind and have the confidence to push any changes!

Originally published on www.linkedin.com

Author's avatar
Ravi Allishe
Skills: Agile Practices: TDD, Pair Programming, CI/CD, Clean Code, Refactoring Programming Languages: Scala, Java, JavaScript Databases: MongoDB, Stardog, Marklogic, PostgreSQL Framework: Play Framework Technologies: Akka actors, Akka streams Tools: Docker, Git Learning: Docker with Kubernetes
    Scala
    akka actors
    akka streams
    docker
    NoSQL

Related Issues

WorksHub / client
  • Started
  • 0
  • 18
  • Intermediate
  • Clojure
  • $150
viebel / klipse-clj
viebel / klipse-clj
  • Started
  • 0
  • 1
  • Intermediate
  • Clojure
viebel / klipse
  • Open
  • 0
  • 0
  • Intermediate
  • Clojure
viebel / klipse
  • 1
  • 0
  • Intermediate
  • Clojure
viebel / klipse
  • Started
  • 0
  • 2
  • Intermediate
  • Clojure
  • $80
viebel / klipse
  • Open
  • 0
  • 0
  • Advanced
  • Clojure
  • $80
viebel / klipse
  • Started
  • 0
  • 2
  • Advanced
  • Clojure
  • $180
viebel / klipse
  • Started
  • 0
  • 1
  • Intermediate
  • Clojure
viebel / klipse
  • 1
  • 1
  • Advanced
  • Clojure
  • $300

Get hired!

Sign up now and apply for roles at companies that interest you.

Engineers who find a new job through Functional Works average a 15% increase in salary.

Start with GitHubStart with Stack OverflowStart with Email