Skip to content
Arek Masiakiewicz edited this page Apr 10, 2017 · 10 revisions

This page describes how to configure Ratel in your application. In order to make it work, you need to perform three simple steps:

Add dependency to your pom.xml file:

<dependency>
    <groupId>com.payu.ratel</groupId>
    <artifactId>ratel-core</artifactId>
    <version>${ratel.version}</version> <!-- please check maven central for the most recent version -->
</dependency>

Add a property to with an address to the registry server

You may choose to use a simple Ratel registry server or a Apache Zookeeper server. In each case you need to add just a single property with an address to your service:

serviceDiscovery.zkHost=<zookeeper-address> # if you are using a zookeeper

OR:

serviceDiscovery.ratelServerAddress=http://ratel-server.mydomain.com:8090/server/discovery # if you are using ratel server

Add spring configuration to your application:

If you are using your own java configuration, just add an annotation @EnableServiceDiscovery on it:

@EnableServiceDiscovery
public class MyConfiguration {...

Alternatively, you may just add a com.payu.ratel.config.ServiceDiscoveryConfig confituration by e.g. adding a component scan your xml configuration:

<context:component-scan base-package="com.payu.ratel.config"/>

Configure server side absolute address

When you are using JBoss as an application container, the two below properties are probably already bind, so you don't need to go through this step.

On service provider side you need to configure two properties:

jboss.bind.address=<network address of the application>
jboss.bind.port=<port of http listener of your application>

OR, in case you don't use JBoss:

serviceDiscovery.selfAddress=<network address of the application, including port>

Optional configuration parameters

Disabling Ratel in your spring context

You can disable ratel by setting the following property:

serviceDiscovery.enabled=false

Controlling communication timeouts

Connection timeout is a maximum time ratel client will wait for a connection to a remote service, and read timeout is a maximum time ratel client will wait for a response from a service it has successfully sent request to. By default Ratel sets both connection and read timeouts to 30 seconds, you can adjust them with the following properties:

ratel.connectTimeout=1000 # timeout given in milliseconds
ratel.readTimeout=1000