When you are developing a microservices arquitecture, you often have to call some of them, for manual testing, scripting and/or operations. Given the dynamic nature of Groovy, could it be used to make easier these calls?
* Could we call our services with a syntax shorter and more natural, instead of using long curls, but not losing the history capability of a shell?
* Could we query the documentation of the operations in the same way?
* Could we even have autocomplete features of our service operations, so that we don’t have to remember their names?
* Could we do all this dynamically, without having to create a specific client for each service, but calling it as if it were?
* Could we have a directory of available services, so that we don’t have to remember them?
* Could this directory and the utility classes be updated automatically for all the team when someone makes a change, using a Git repository?
You are invited to a journey through the mud, exploring features such as Groovy metaclasses, class loading, REST services, shell capabilities and AST transformations, and making some dark tricks to achieve what we want.
Repositories with the presentation code:
https://github.com/andresviedma/groovy-assets-directory-example
https://github.com/andresviedma/dynapiclient-groovy
https://github.com/andresviedma/sourcegrape
[Presented at Greach 2016]