Microservices in Clojure

Microservices in Clojure I was falling again in the trap. Java with Spring Boot has a very unique appeal... With configuration you can easily solve problems that requires actual code. Service Registration OpenApi Service Discovery Persistence  All these critical things for a micro-service are just some annotations away if you use Spring. But I have to admit that, because I always start thinking that I don't want to risk too much, I always fall back in creating an hybrid Java -Spring/Clojure service, and then I never created a full micro-service in Clojure. This time is different. I will study  Microservices with Clojure . (That I will review as soon as I can, normally I find that these books are not so useful, I hope this time will be different. But I will write about it later. I will follow the book and after I will have completed I will use the same approach for  Hierarchy Property Service using the things I will build during the book study. Because I see that there are a lot of

Spring Boot and Spring Cloud choice in a Clojure micro-service

 Spring Boot and Spring Cloud Ok, I'm back to Clojure. Then why I'm thinking about Spring framework? I'm creating HPS as a POC to restart working in clojure and (why not) as a real service to use in production in my current company. What we need when we deploy a new microservice in our environments is: OpenApi documentation of our service Connection to our Discovery service Interoperability with other services in an easy way, we actually have some native Spring Cloud services, and other services that register in our Discovery Server (Zookeeper) as 'fake' Spring Cloud Services. This gives us the possibility to use Feign to create Clients that are used for communications between our services. Let's see point by point my possible solutions: OpenApi documentation I have 2 possibility: I write my WebService fully using Ring (I don't have any exotic requirement, I think I can do it). But this means that I will have to also write the OpenApi documentation for my AP

HPS (Hierarchy Property Service): Initial Setup

First steps for HPS (Hierarchy Property Service) Ok, after the first problems I was able to start coding. Because I want TDD I was really missing lein-test-refresh, but after some research I found  Kaocha Kaocha Basically is a full fledged tool for Testing.  There are some steps to do to just have an initial setup: Add a dependency on your deps.edn :aliases {:test {:extra-paths ["src/test/clojure"] :extra-deps {lambdaisland/kaocha {:mvn/version "1.0.641"}} Do your setup of kaocha, basically create a script at ~/bin/kaocha and chmod +x it, inside write: clojure -A:test -m kaocha.runner "$@" Create a tests.edn in your foolder, (this step is needed if you don't have your tests in a test folder on the root of your project): #kaocha/v1 {:tests [{:id :unit                  :test-paths ["src/test/clojure"]}]} #kaocha/v1 is a default configuration for kaocha, while the other one set the tests path for my project.  now run in a terminal in your projec

First project: Spring Cloud with Swagger 3 API documentation in Clojure

How can I restart working on Clojure... Let's create a new Generic Opensource service that can be useful to anyone. I will do a series of Posts that will show the journey to create it. Service: Hierarchy Property System I want to create a Hierarchy Property System, this service will have the ability to define a Hierarchy of Objects. For example I can define this hierarchy: Root Level (the generic one) Group Of User User A property set at Root Level will be the default for all the other sub objects, but if I override a property on SubUser level, that specific SubUser will have the value for Property Overriden. Example for AB testing, you have a Commercial Web Site and you have implemented in your service a new cool Feature, called "I will get your Money for poor people", this feature will be activated if the property " robinHood " is set to true, the configuration will be: RootLevel ->  robinHood: false User(id: 12345) ->   robinHood: true So all other serv

Restarting Clojure, my choices, my problems, my solutions!

How can you start working with Clojure in 2020? Since 2017, the only difference on my environment will be Deps adoption instead of Leinengen, and I will use Intellij with Cursive (mostly because I use this environment for work) Started Intellij, installed Cursive with a Opensource license, started a new Project with deps. Issue:  Cannot execute: Clojure command not configured: Cannot execute: Clojure command not configured Solution:  Install Clojure with Brew in Mac:  brew install clojure/tools/clojure Setup Clojure Deps in Intellij | Preferences | Build, Execution, Deployment | Build Tools | Clojure Deps using the path:  /usr/local/Cellar/clojure/ Ok now I want to start a Repl, unfortunately I don't have a fast selection from Tools in Intellij, so I had to create a new configuration: Clojure Repl, save it. Try to run and.... Issue:  Error: Could not find or load main class clojure.main Caused by: java.lang.ClassNotFoundException: clojure.main   Solution: Chan

Ups I did it again

Here I am again.... After 3 exciting years, 2 sons, 4 different Jobs, I'm back to Clojure I have grown, as a person, as a father, as a programmer, as a human in general, nowadays I was able to introduce in my daily job Kotlin, and is already a big step forward from Java.... but.... I miss Clojure. I can't explain why, but is always like in my daily routine I miss the simplicity, I miss the sense of accomplishment that I have when very few, dense, line of codes works and are actually so meaningful that when I go back I'm able to understand it again without any particular problem.  I miss the freedom of a dynamic language, I hate the moments that my IDE stuck while trying to index all my codebase. In my growth I have learned a thing. There is a huge number of programmers around the globe, there are a lot of programmers far better than me, and no matter what I do, there will always be someone far better than me. But the thing that I learned is: Without studying every day somet

How to style your input file in Reagent with Bootstrap

Ok this caused me a lot of headache, hope it will help anyone. In bootstrap the only way to style a input with type file, is to close it in a label. Like this: <label class="btn btn-default btn-file"> Browse <input type="file" style="display: none;"> </label>     Unfortunately, as things are now, the only way to do something like this in Reagent is to set the InnerHhtml and do something like this: (defn ^:export on-click   [event]   (js/alert "Upload Button Clicked") (defn ^:export on-change   [event]   (js/alert "File Changed) (def input-html "<input id='upload-file' name='updload-file' type='file' style='display: none;' onclick='{ns}.table.on_click(event)' onchange='{ns}.table.on_change(event);'></input>") [:label.btn.btn-primary.col-span-1      {:dangerouslySetInnerHTML       {:__html (str (label-input "Select File") input-