Reactive Programming in Java using RatPack

Posted by Hariharan Vadivelu on

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


22 comments:

  1. In the event that you are tense in your taekwondo class your body creates more adrenaline. This is your battle flight hormone. It is helpful on the off chance that you are in physical risk. Be that as it may, in class it just consumes your muscle vitality. Also, you are left depleted and tired. You kicks get moderate and substantial.

    Strain additionally makes your muscles solid. Furthermore, firm muscles can't work appropriately. You move more like a robot than a man. Your methods can't stream legitimately. Your kicks get moderate and powerless. What's more, you're more inclined to wounds.itfofindia.com.

    ReplyDelete
  2. Greetings, All the posts are very informative for the people who visit this site. Good work! Carry on.
    We are the Best eCommerce website Design & Development company in Delhi,Noida (Quality Zone Infotech). Please feel free to visit our site. Thank you for sharing.

    ReplyDelete
  3. I got lot of informations from your blog.Please keep us informed like this.And thanks for sharing!!!
    Seo Company in Chennai
    Digital Marketing Company in Chennai

    ReplyDelete

  4. Thanks for sharing such a nice and interesting blog with us...

    SAP ABAP Training in chennai

    ReplyDelete
  5. This data extremely worth saying, I think you are ace of the substance and thank you so much sharing that profitable data and get new aptitudes after allude that post.
    Website Development Company Bangalore| web designer in bangalore

    ReplyDelete

  6. Nice to see your blog post.. I really enjoyed by reading your blog post.
    Informatica Training Institute in chennai

    ReplyDelete
  7. He informed himself that footed free online movies arrows weren’t so much use in a siege, anyway. What’s the factor of an arrow that doesn’t shatter or crack on impact? That handiest manner the enemy will fire it back at you.

    ReplyDelete
  8. CIITN is the Best Php training institute in Noida and delhi Ncr. You will get Live Project Training on PHP by our PHP expert who have 5+ year industrial experience.Focus on practical and live project training. In our PHP training, we you will learn core PHP, advance PHP, HTML, CSS, JavaScript, jQuery, Bootstrap, Cake PHP and Wordpress.CIITN provides 100% job assistance in PHP training. CIITN is well known PHP coaching center because our 100% PHP students are placed now.


    Ciitnoida provides Core and java training institute in noida. We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-oriented, class-based build of Java has made it one of most popular programming languages and the demand of professionals with certification in Advance Java training is at an all-time high not just in India but foreign countries too.

    By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13 years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best Java training in Noida.


    php training in noida
    java training institute in noida
    javascript training in noida
    linux training in noida
    linux institute in noida
    red hat linux training in noida

    ReplyDelete
  9. By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13 years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best Java training in Noida.
    https://topacademictutors.com/

    ReplyDelete
  10. I have really happy to these reading your post. This product control and maintenance of our health.The daily routine can assist you weight lose quickly and safely.My life is completely reworked once I followed this diet.I feeling nice concerning myself.

    Herbalife in Chennai
    Herbalife Nutrition Products
    Nutrition centers in Chennai
    Weight Loss in Chennai
    Weight Gain in Chennai

    ReplyDelete
  11. By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13 years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best Java training in Noida. https://aiwah.pk/
    http://watchtvdrama.com/
    http://watchtvdrama.com/bigg-boss-12/
    http://dramavideo.co/
    http://dramavideo.co/colors-tv/bigg-boss-12/
    http://www.unikaas.com
    https://unikaas.com/replica-clothing-supplier/
    http://bikeparts.pk
    http://desiseries.com

    ReplyDelete
  12. This is really interesting post, Appreciate the effort in educating us. We do provide
    Web Design Company in Bangalore | Digital Marketing Company in Bangalore

    ReplyDelete
  13. I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.
    best selenium training institute in hyderabad
    best selenium online training institute in hyderabad
    best institute for selenium training in hyderabad
    best selenium training institute in hyderabad

    ReplyDelete