by Fabrizio Montesi and Claudio Guidi
First language for natively programming microservices.

The Jolie language is a service-oriented language and the first built for programming microservices natively.

Jolie code is always contained in lightweight services that can be seamlessly moved around the network. Programs written in Jolie are protocol-agnostic. The logic of a program is loosely-coupled with respect to how programs communicate.

The term used in Jolie to distinct these two parts of Jolie programs are the deployment of a service, for establishing communications, and the behaviour of a program, containing the logic of the program.

Deployment and behaviour are independent. In this way it is possible to change the medium (TCP/IP, Bluetooth, Local memory, RMI) and data format (HTTP(s), SOAP, SODEP(s), JSON/RPC, XML/RPC) used to communicate with other services (which can be either written in Jolie or not) without touching the logic of the program.

Adapting services written locally to a distributed cloud-based deployment is just a matter of setting the deployment.

Jolie is an open-source project and also provides an easy-to-use API for implementing new protocols.

/* A client-server scenario in which the client invokes the 
service "twice" offered via the operation with the same name. 
The operation is a RequestResponse, i.e., it accepts a request 
and returns a response. The client passes a number to the 
server, the server doubles it and it sends the result back to the 
client. */

/* Server Code */

interface TwiceInterface { 
	RequestResponse: twice( int )( int ) 
}

inputPort TwiceService {
	Location: "socket://localhost:8000"
	Protocol: sodep
	Interfaces: TwiceInterface
}

main
{
	twice( number )( result ) {
		result = number * 2
	}
}

/* = = = = = = = = = = = = = = = = = = */

/* Client Code */
include "console.iol"

interface TwiceInterface { 
	RequestResponse: twice( int )( int ) 
}

outputPort TwiceService {
	Location: "socket://localhost:8000"
	Protocol: sodep
	Interfaces: TwiceInterface
}

main
{
	twice@TwiceService( 5 )( response );
	println@Console( response )() // stout wrapped by the Console service
}
Information updated 04/04/16
View Comments