Reactive Programming in Java using RatPack


For starters, Ratpack is built on the same non blocking, event driven, model as Node.js
This type of non-blocking and asynchronous programming model has become very popular of late
Although, asynchronous programming has many advantages, such as predictive performance behavior under load, it is equally challenging and tricky to implement this style of programming.

Ratpacks value proposition comes from it's ability to abstract some of the complexities associated with asnyc. programming model at the same time provide integration with best in class Java librariries to implement modern day application.

Development Environment
Unbuntu 17.10
Oracle JDK 9.0.1
Sublime V3.0
Groovy

I would strongly recommend SDKMan while programming on Linux as it simplifies management of multiple versions of software packages. 

Getting started with a helloworld code is two step process and takes under a minute.

start with a gradle file definition

File: build.gradle

buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath "io.ratpack:ratpack-gradle:1.5.1"
  }
}

apply plugin: "io.ratpack.ratpack-groovy"
apply plugin: "idea"

repositories {
  jcenter()
}

dependencies {
  runtime "org.slf4j:slf4j-simple:1.7.25"
}

File: src/ratpack/ratpack.groovy

import static ratpack.groovy.Groovy.ratpack

ratpack {
    handlers {
        get {
            render "Hello World!"
        }
        get(":name") {
            render "Hello $pathTokens.name!"
        }
    }
}

Run Ratle server
gradle run


This should bring up the server on http://localhost:5050/

Refer official guide for more details on Ratpack programming
https://ratpack.io/manual/current/quick-start.html

Pituluik Media Blogger | Freelancer |Operations Manager | Marketing and Sales Manager | Lancer Evo 4 Community. Indonesian Bloggers Who Become Bloggers Because of Hobby. Feel free to connect with me on Social Media Instagram @alberandesko

0 Response to "Reactive Programming in Java using RatPack"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel