allegro/opel

Name: opel

Owner: Allegro Tech

Description: OPEL - asynchronous expression language

Created: 2016-08-30 13:49:35.0

Updated: 2018-05-15 11:24:53.0

Pushed: 2018-05-08 08:53:07.0

Homepage: null

Size: 256

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

GitHub license

opel - asynchronous expression language

opel was designed to let you write simple, short asynchronous expressions. It uses Parboiled as a language grammar engine and common Java 8 CompletableFuture.

For example temperature() function asks REST service for temperature in Fahrenheit for given capital city and we want to convert it to Celsius. We can write a simple expression to achievie it.

perature('Warsaw') - 32) * 5 / 9

this expression will be transformed to equivalent code:

erature('Warsaw')
.thenCombine(CompletableFuture.completedFuture(32), (l, r) -> l - r)
.thenCombine(CompletableFuture.completedFuture(5), (l, r) -> l * r)
.thenCombine(CompletableFuture.completedFuture(9), (l, r) -> l / r)
Contents
Our business case

In OpBox which is our solution to build frontend in microservices world we have to prepare site title depending on data returned from data source (REST service). For show product page it may look like:

Service('showProduct') + ' - Allegro.pl - Wi?cej ni? aukcje.'
Why have we created another language?

Allegro is a big platform with huge traffic. We encounter many performance issues so we decided to design everything asynchronously. Whenever it's possible we use CompletableFutures. It's a bit more complicated that way but opel abstraction layer enables our users (non developers) to write simple expressions in easy way.

After checking some expression languages like: SpEL or JEXL we didn't find any libraries supporting required asynchronous behavior.

What opel can't do?

opel aims at very simple expressions. Certainly it won't be enough to make complicated scripts - but we want opel to stay that way.

What can opel do for you?

opel supports:

More can be found in documentation.

Using with Gradle

Basically, all you have to do is to add a compile dependency:

ndencies {
compile 'pl.allegro.tech:opel:1.0.1'


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.