Friday, November 27, 2015

Setting basic response http headers for REST resources on a simple Vertx Rest based app #vertxio #vertx

I am new to Vert.x but as a Java developer (die hard) I find it much more enjoyable and promising comparing to NodeJS or whatever - Reactor based frameworks/libraries. So I was going through implementing a very simple Restful API, using Vert.x.

My problem for today is that I wanted to include some certain HttpHeaders in most (all) of my , responses. For example set the Content-type to "application/json". In the future maybe add some others.

I was kind of wondering around as a Vert.x newbie, then I kind of realized that what is was eventually suggested in this blog post (See the use of BodyHandler) would actually work for me.

So I had my main VertxMain java app where I register my MyWebVerticleApp.

Then I have created a small handler, I call it BaseResponseHandler, that eventually adds the HttpHeader in my responses.

Then in my MyWebVerticle I just register the handler to be invoked all the time, in the router chaining.

Friday, November 13, 2015

Devoxx Belgium 2015 - Final thoughts #devoxx

Well yet another Devoxx is over for me, it must the 5th of 6th time (or more) can't remember to be honest. It's 3 years since my last one, so it was kind of a come back :).

Devoxx (Belgium) is growing, actually it is the first time that I have seen so many people. The venue must have increased the overall amount of attendees (3500?). That also means that it was the first time that some times, I did not managed to enter some talks due to the vast amounts of people waiting. Amazing and kind of a bummer, when you wait in line and then you cant go in. 

The biggest change, just introduced this year is this. Yeap it is real, all the talks are already available online, in high quality. It is becoming a trend I guess these days, the same happened with JavaOne 3 weeks ago, you can find all the sessions here.

By the way I have composed a smaller public list in youtube, with a certain selection of talks that I managed to watch and some that I missed, so you can try my list as well. 

This year I think I made a mistake, I skipped the first 2 University days. It seems that there were more talks or people that I would like to watch in the first 2 days than in the rest. So it was kind of a small disappointment for me.

It is more than obvious, especially after the 'release almost instantly to youtube thing', that developer conferences are eventually becoming the place where you get to see some important people, get in touch with the community, do networking rather than accessing content which seems to be a secondary priority.

This year I was happy enough to see again good old friends from the global Java community and say hi, hear about their status in person and let them know about my new establishment, away from Greece that is. At the same time though, I kind of missed a lot of familiar faces as well, so yes I did get to see a lot of 'stars' but also a large group was not there. I am not sure if the dates and the fact that Devoxx Belgium is so close to JavaOne or JavaZonze, relates with the above. 

In the past 6-7 months unfortunately (or fortunately depending on how you see things), I got the opportunity to do more research on technologies, try things, rather than get to my day job and code or maintain some legacy stuff.  Which was kind of cool but not exactly my type of thing. So I was already full of new content, fed either by free content from recent conferences or some subscriptions to 'e-learning' sites. So, this year I did not took so many notes on things to try or consider.

When it comes to technology trends, of course Devoxx is mainly a Java Developer's conference so Java is relevant in this context. As you will watch is some talks, we are entering a phase where technology trends are eventually hitting us more and more often, we are kind of overdosed not every 5 or 10 years but almost every year or half a year with the next big thing. I can still remember a couple of years, about alternative jvm languages,javascript & javascript etc. This year it was all about, functional programming, micro-services, containers . These are the trends.

I am very relieved that there are a lot of people out there (either in their talks or talking with them),  are trying to build a wall of rational (as I envision it) , trying to impose things like ' think before you buy or jump the next big thing',' technology A or technology is not going to fix your bad project' ...fighting the silver bullet culture.

That is all, I hope that next year I will be able to make it more conferences, actually I very tempted to try if possible Devoxx London. See you there maybe or in a talk @ Luxembourg where I currently live. 

Keep coding and loving Java  :) 

Thursday, November 12, 2015

Devoxx Belgium 2015 - Conference Day 2 #devoxx

This is my short review of the day.

Java 8 is slowly increasing its adoption rate. I think this is a good thing and this is what the speakers and many people from the industry suggest.  In Java 8 we have a tone of new language features, some of them are being demoed a lot in these recent years (e.g λ expressions), but there are more stuff, maybe less fancy that can make our day to day coding, especially in the JavaEE space more productive. Solid talk about all these new features that we can all use as of today. When it comes to the use of  async, and streams within 'contained' code bases, personally I think that this is a paradigm mismatch and at the time being, they are not adding anything special neither making stuff simpler.

One of the best talks today. Tony Printezis was member of the jvm team back in the Sun Microsystems days, in these last 2 years he has been part of the JVM team within Twitter. Yes Twitter heavily relies on the JVM, a fork of the OpenJDK that is being modified or patched by this small team of 4. Th service code of twitter is mostly written in Scala, and runs on thousands of JVM instances! He provided us with some very impressive metrics regarding their platform usage (of course this is Twitter). He elaborated on some of the most interesting garbage collection and performance errors/bugs spotted during high peaks and how they managed to solved the problems either by patching the JVM or changing the configuration. The Twitter JVM team is following the main-stream releases of OpenJDK and occasionally gives back fixes. Currently they have not plans on releasing (open sourcing) their modified version. 

Α very interesting talk by Mario Fusco where he tried to explain that switching from the O.O to functional mindset and programming is not rocket science. In some sense he is right but I still believe we have a long way to go and it might the case that functional programming is not a silver bullet. He  compared with real code examples, the 2 approaches. There were some cases where I was kind of lost with the examples and notes around the the 'Monad' pattern. Some of the examples were featuring the JavaSlang library, which seems a very nice thing to check and consider if you are about to go this road. 
CDI 2.O is coming 

A talk from the spec lead  Antoine Sabot-Durand and  José Paumard around the things to come in the CDI 2.0 spec. A lot of things are already published + some draft releases. I like CDI, the more you use the more you love it so my only comment is- release it asap and let's all hope is going to be 'implemented' by vendors soon enough.

I've red some stuff all these months around the MVC 1.0 spec (the Spring MVC equivalent in the JavaEE world). I was very curious to find out some more details. I have to be honest, after the talk I kind of felt that there might be cases where I will have to remember my action based framework days. It felt that we are going back in time in this case, re embrace action based frameworks (which were totally fine, Struts believer here). Maybe I'm just a bit in favor of JSF in it's current state? I dont know, I left the room thinking of the days where we needed to code a paginated table...using actions and a lot of javascript. Do we really need to have now yet another action based framework? Time will tell.

On a side note I have been following Ivar Grimstad's work, especially one his project called Snoop, a service discovery 'module' for JavaEE code, which I think is a very cool.

The best talk for me today. Thank god there are people out there, like Milen Dyankov , that talk about the principles of good software engineering in times where every buzz word can be inherited by developers or managers and promoted to the holy grail of everything, the one solution that will make things right in your old or crappy project.

Thank you Milen Dyankov that you pointed the obvious, that microservices is not a holy grail, that no matter if we do microservices, or monoliths or soa or whatever, we need to have clear, simple and modular architecture. People still tends to forget this thing.

So when this talk is out in youtube, in a couple of hours, spend some time and play the first half. Save it somewhere and the next time your colleague or your manager starts buzzwording around, send him/her the link!

Wednesday, November 11, 2015

Devoxx Belgium 2015 - Conference Day 1 #devoxx

There were are 3 days full of Java and other technologies as well. Here is my review of the day.

Opening keynote(s)

The first part of the opening was about Devoxx. The creator Stephan Jansen and some of his colleagues went through the updates regarding the 'Devoxx' ecosystem of conferences that is now booming. London, Paris, Krakow, Casablanca are now hosting Devoxx conferences with more than 1000 attendees most of them. Voxxed, the 'side' project of Devoxx, is increasing it's unique visitor number and is eventually bringing more mini Devoxx days all around Europe. I can still remember my first time visiting 'Javapolis' the original name of the conference,  you could feel it that this conference would eventually spawn more stuff out of it! And there it is, it is spreading, so well done to all the people for their hard work and the Belgian JUG.

A big announcement is that Parleys is starting to phase out and most of its content is moving to Youtube and Vimeo. What is more exciting is that you can actually watch the sessions (yes today) from your home/office. So the talks from today will be published tomorrow, the first 2 days are already available.  Here is the Youtube channel of Devox 2015 - enjoy!

The second part of the keynote, was an introduction by Mark Reinhold (Chief Architect of Java) to the new stuff coming in Java 9 and specifically Project Jigsaw. His talk was very similar to the one he gave a couple of weeks ago in Java One.

The third part was one of the sessions to remember. On stage we had a famous theoretical physicist , Professor Lawrence M. Krauss, giving a speech about our journey to discover the origins of the universe. Really funny and inspiring talk, about our insignificance in the universe, and the universe (or many of the - multiverse) as the speaker point out. Great idea to fuse into a hard core developer conference such a talk! Really worth watching it when it is released tomorrow.

Async programming in Java 8, using the Completable Future

Jose Paumard as I have written a lot of times, is one of my favorite core java speakers. I follow his presentations from various conferences and on Plurarsight. This one was about the newly introduced CompletableFuture and how we can eventually apply async programming principles and async method chaining. I still find the overall API over-complicated and it seems that related libs and work, for example RxJava really make more sense. I hope the API designers get this kind of feedback and iterate on the features, mostly simplify stuff.

JSF with Primefaces, from ugly duckling to beautiful swan

I've done JSF work in the past 2 years (not full time but enough) to eventually believe that JSF 2.0 is still relevant and Primefaces is the best component library out there. We had the chance to actually meet in person  Cagatay Civici (aka Optimus_Prime) and thank him for the amazing work he and his team does. I really liked the addition of the signature component (where you can actually hand write your signature on a widget). Yes banks are gonna love this one I guess.Another interesting thing is that by using Bean Validation annotations on your beans, you can do both client and of course server side validation, with no extra elements on the xhtml forms or so! This is really a killer feature and simplifies a lot the xhmtl overloading, especially with heavy validation components.

Distributed load testing with kubernetes

Kubernetes is one of my fav research and work topics lately. Very solid talk covering some of the basic concepts around kubernetes and then going through the process on spawning with the help of kubernetes and 'cluster' of Locust workers in order to form a load testing 'swarm' for your end application. I have not used Locust before, so personal note to give it a try and evaluate it.

The Java Council

The council aims to continue the legacy of the Java Posse. An entertaining and technical session at the same time. It is always a pleasure to see on stage one of the most interesting guys in the Java (not only) world, the  Martijn Verburg , (aka the Diabolical developer

Wildfly Community BOF 

As a JavaEE and JBoss/Wildfly die hard I could not miss this BOF, in this last late slot. Hosted by D.Andreadis, we had a short intro to what is coming with almost final Wildfly 10. The first Alpha of EAP 7 is just released by the way. During the session there were also some discussions about the importance and relevance of solutions like (Wildfly-swarm) and how they correlated with current needs on big customers and deployments. It seems that a lot of people agree that fat jars do not always feel very flexible. One a side note, I have actually proposed that they should consider finding a new name for the project since it is conflicting with Docker Swarm. Yet again this year (I will keep doing this for ever ), I have expressed my request so that Wildfly has built in support for LogBack, in it's logging subsystem. Great session after, great to have Antonio Goncalves, along.


Well this is it. Eventually I would like to collect some more stickers for my new laptop, but it seems this year there are not too many stickers or maybe not too many vendors that I like with stickers. It was a full and busy day. Stay tuned on the youtube channel to get all the new talks. Go Devoxx!

Tuesday, November 10, 2015

Highly coupled :)

Σε λίγες ώρες επιστρέφω σε μια αγαπημένη μου πόλη. Την Αμβέρσα του Βελγίου, για το αγαπημένο μου developer conference, το Devoxx. Μια όαση για πολλά χρόνια (τουλάχιστον όσο τα οικονομικά το επέτρεπαν) για μένα, ένα διάλλειμα από την τεχνολογική μετριότητα, στιγμές με καλούς φίλους,  ένα overdose με πολλές τεχνολογίες, developer rock star, σημειώσεις, βιβλία , και άλλα πολλά που μόνο αν αγαπάς αυτή την δουλειά θα τα καταλάβεις. Είμαι ιδιαίτερα χαρούμενος!

Βέβαια εκτός από τα παραπάνω τα οποία ειναι σημαντικά και ωραία είμαι ακόμα πιο χαρούμενος γιατί στην Αμβέρσα και το Devoxx  είχα την 'τυχη΄ να την γνωρίσω. Κατα την διάρκεια ομιλιών και καθώς προσπαθούσα να μπώ σε κάποια αίθουσα. Ακόμα το θυμάμαι. The rest is history, 3 χρόνια μαζί. Μαζί σε  ζωή, σε δουλειά, μαζί σε coding (τα δικά της query παραδέχομαι ειναι πιο optimized από τα δικά μου), μαζί στην αγάπη για την τεχνολογία, μαζί στην αγάπη για καθαρά design και όχι τσαπατσουλικο κώδικα, μαζί στις μεγάλες αποφάσεις της ζωής. Τα μισά που post εδώ πια χρησιμοποιούν το πρώτο ενικό και θα συνεχίσουν έτσι. Θεωρώ τον εαυτό μου τόσο τυχερό.

Σύντομα το coupling, θα tag-ριστεί με release και ευλπιστώ σε branches κάποια στιγμή!

love u jane


Friday, November 06, 2015

So you want to do microservices? please watch 'Microservices for Mortals' by @BertErtman.

So many valid points from Bert Ertman in this presentation around Microservices. Are you considering following this path in your project, in your team or your company? Please grab a coffee, a note pad (if you like hand written notes) and watch this. It is really a pain, waste of energy and very discouraging to see many companies and teams, failing miserably either because they do not educate themselves on what really means 'doing microservices' or by just thinking that using a specific tool suddenly you moved into this new era. As I have elaborated in the recent past and is also a comment in the presentation - by using Docker, Kubernetes, Neftlix libs etc you are not doing microservices.  It is a far more complex process, that needs organizational and team changes. It requires certain level of understanding from the management and architectural point of view. You need to invest money and time and of course there will be some risk involved as well!

Enjoy this really great presentation!

Wednesday, November 04, 2015

Sexy terminal output - with figlet, lolcat and cowsway on MacOSX #figlet #lolcat #cowsay

I was watching today a short video by the Docker guys on how to setup the new multi host network capabilities, just introduced with Docker 1.9. In the beginning, the engineer doing the demo was 'echoing'  in his terminal screen some very cool, labels and text. Eventually was piping echo to a tool called figlet (I knew it before- ASCII generator) and then to another tool called lolcat. The output is more than cool !!! I thought, I need to have this as well.  Have a look!

Another famous, variation in code comments is cowsay

So I started brew and brew casking the relevant tools! You need to have brew and brew cask installed, if not see here or here.

Install figlet 


brew install figlet

Install lolcat /cowsay

Lolcat and cowsay can be installed using  ruby gem. The thing is that trying to do something like

gem install lolcat 

was producing errors for access rights in various paths - especially if you are using MacOSX YoseMite (10.10) or ElCapitan (10.11) . I searched a bit, tried a couple of stuff like deleting the relevant folders, updating gem but no luck. If you dont have any errors skip the following rbenv tips and just install the tools.

In order to get my gem (ruby) stuff working, I followed the instructions here. 

brew install rbenv ruby-build

# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

# Install Ruby
rbenv install 2.2.3
rbenv global 2.2.3
ruby -v

After the above I could install lolcat and cowsay or fortune.

gem install lolcat 

gem install cowsay 

gem install fortune

And you are done, happy cool comments in your code / scripts or just terminal! Nice for demos as well, credits to Dave Tucker from Docker  for the inspiration!

Monday, November 02, 2015

Book Review - Kubernetes Up & Running by Kelsey Hightower #kubernetes #book

Some Kubernetes .... cheering!

As I have written in previous posts, when you start investigating and working with all these new and shiny container / orchestration technologies, there is a high chance that you will end up 'lost' in translation. A lot of information, a lot technologies, a lot of dev-ops, a lot of promises a lot of complexity and a lot of simple examples which work but when you try to apply the same principles to your current project, you feel a 'paradigm mismatch'. At least this is how it seems from the my developer's point of view. The emerge of kubernetes, both as an in house (platform) or powering up the Google Container Engine, is one of the most useful and interesting research (work) I have done lately. I truly believe that is a framework/technology that is here to 'stay' and set the standards for competing or new alternatives.  I think that the adoption of kubernetes is going to increase as more major player kind of adapt or embrace it (see RedHat /OpenShift v3)


The author

During all this work and 'journeys' with containers, I 'discovered' Kelsey Hightower (github)(@kelseyhightower),  chief advocate - P.O for CoreOS and highly involved with kubernetes. I really like his pragmatic approach on 'showing'  and teaching all these new things and his passion for kubernetes and CoreOS. One of the first things 'I consumed' from his online material , is a 3 part video introducing kubernetes from installation to configuration (really worth watching).

The book

Kubernetes Up and Running, from O'Reilly, is a relative small book. It is actually one of the first 'reference' books around kubernetes. It does not require any previous knowledge with the framework since it has a quite complete introductory chapter that covers the basic principles of the framework and why an orchestrating layer on top of plain containers in the modern containerized world of deployments is important. It would be nice though if you already have some basic understanding and experience working with container technologies, like Docker, Rkt or LXC.


As already elaborated the the first chapter of the book covers basic ground regarding the architecture of kubernetes and basic principles behind it. The beauty of Kubernetes lies towards it's simplicity, and grasping the basic concepts is eventually a very critical point, towards using it. The first chapter is all about that.

The second chapter is a very detailed walk through on deploying kubernetes from scratch, on top of an existing cloud provider ( google cloud). The author starts from bare bones cloud vms and step by step installs all the required components needed, in order the Kubernetes infrastructure to form and start acting as a single system (layer). For people that want to actually control every aspect of the Kubernetes installation and maintenance - mostly in a local or private cloud scenario this chapter is very relevant.

The third chapter is about containers. The book goes through some basic regarding the different type of containerized applications and how they related with the concepts of kubernetes. Since kubernetes is currently using Docker as it's main container technology, this chapter includes some examples and tips regarding Docker containers. 

Chapter 4, (and the last one), deep dives on the important notion of Kubernetes Pod. Which is actually one of the most important concepts of Kubernetes. The reader will be introduce to the technicalities on spawning pods containing various parts of it's application, health checking these pods, clustering (replicating them). Every single application that will be deployed in a Kubernetes enabled application will be consisted by one of more pods. Understanding the basic idea behind a pod and what kind of services kubernetes offers around them is very critical. By the end of the chapter you will get a pretty well understanding in order to start thinking in terms of Pods, Services and replication controllers.


In general the book (at least the early version I have now), is very solid. As I have already elaborated, if you are already familiar in a certain extend with containers, following and understanding the basic ideas and principles of Kubernetes is easy. Of course behind every abstraction there is some kind of technical complexity and eventually the engineers of Google/ CoreOS and the community have managed to hide it very well. Some of this complexity and technicalities is revealed in chapter 2, on the 'installation' from scratch guide. 

If there was something, that I would like to see in of reference book, it might be an extra chapter, with some sort of recipes. Recipes related to design and deploy simple 2 or 3 tier applications in Kubernetes. Maybe as a Java-JavaEE guy I am having some sort of regular deployment scenarios for medium to big size 'old school' enterprise apps. Google already maintains good quality level documentation for both the standalone kubernetes and the container engine. 

Handy and nice to have book, I hope the author continues to help the community towards adopting kubernetes, and I will be expecting revised version(s), since Kubernetes is already evolving, adding more services and capabilities (beyond the initial 1.0 release).

update: there are 8 more chapters coming in.