For the past few weeks I’ve been doing a Scala course on Coursera. Today it has just finished for me and I’m happy to report I scored all the points.
As a follow up to previous posts about event sourcing I strongly recommend to have a look at event sourcing sub chapter in The Joy of Clojure (affiliate link).
The book in general is a must read for Clojurists. It’s packed with many powerful ideas. I own paper copy of first edition and decided to buy second edition before it was even released.
In my previous post I explained what event sourcing is and why is it so interesting. Today I’m sharing a minimal multi-threaded implementation of websockets server that uses event sourcing. My language of choice is Clojure. I used core.async channels to enable communication between threads. Alternatively, you may use blocking queues and manually create threads – it may be more performant but I haven’t tested it. Another alternative is to use Disruptor for inter-thread communication – it is probably the most performant method but I also haven’t checked it yet.
Recently I’ve been playing with asynchronous HTTP processing and event sourcing. The aim was to create a fast and elegant solution for multiplayer game engine.
Asynchronous servers make it possible to handle a lot of client connections concurrently. It is achieved by handling more than one connection on one thread as opposed to thread per connection approach. The most famous example of such server is Node.js with its single thread processing. Exactly the same style of dealing with connections is possible in Java and Clojure with additional power of using extra threads for other tasks (i.e. other than HTTP I/O). For implementation, I used http-kit that is not using Netty (that’s refreshing!) as an underlying library.
Event sourcing is a nice model for asynchronous processing. It allows to separate the business logic from I/O and makes it easy to put logic in its own thread. As pointed out by guys from LMAX, it also means that mutable domain data structures are less harmful or even acceptable. This is not the case in other threaded application architectures that involve sharing data between threads.
Two weeks ago I attended a Spring conference in London. It was held in a crypt under a church, which shows how creative Skillsmatter can be – even when it comes to looking for a venue
This post is an overview of what is currently happening in Spring ecosystem. Many conference talks concerned a new version of Spring that is going to be released in December. Fourth edition of framework is meant to be an evolutionary one and version bump in your config is strongly recommended by creators, who promise a smooth migration. Additionally, Spring 4 supports JDK 8, it’s developer preview was released in September (you can now grab free IntelliJ IDE and try out them lambdas! Not yet supported in Eclipse though).
I have neglected my blog during the last few months but that’s just because I was very busy. In the meantime, among other things, I flew 20 times on route Gdansk – London, relocated to Reading (UK), and… started a new toy project :)
Project is called Cathedral and it is an implementation of a board game called Basilica. The core game logic is written in ClojureScript. The web application part uses Angular.js, and wherever possible, CSS for the user interface. I’m thinking about using LESS or generating styles in Clojure as style rules are getting pretty repetetive. It is still work in progress.
One of the least known features offered by Github is hosting of static html pages with support of Jekyll static content generator. Well, at least I’ve found out about it very recently. Pages can be attached to the user domain (username.github.com) or to each of the user’s repositories (username.github.com/repository). A custom domain may also be used.