This repository contains the SDK or java library which allows you to query Einabit services in an easy way. Everything out of the box, just provide the host to the Client builder and start querying our services. Currently, we support four operations:
- value:
/* * Get current value of a variable. * * @param variable variable * @return variable value */ public String value(final String variable);
- fetch:
/* * Fetch values of a variable. * * @param variable variable * @param from from timestamp * @param to to timestamp * @return values delimited by commas */ public String fetch(final String variable, final long from, final long to);
- tap:
/* * Subscribe to a variable. * * @param variable variable * @param callback callback which will be executed everytime it receives a value. */ public void tap(final String variable, final EinabitServerListener callback);
- last:
/* * Fetch last n values of a variable. * * @param variable variable * @param amount amount of values to fetch * @return values delimited by commas */ public String last(final String variable, final Integer amount);
-
Create the client:
final EinabitClient einabitClient = EinabitClient.builder() .host("localhost") .build();
-
Query a variable using the client:
final String tempValue = einabitClient.value("temp");
This library is available in Maven central repository:
<dependency>
<groupId>com.einabit.client</groupId>
<artifactId>client-java</artifactId>
<version>1.0.0</version>
</dependency>
In case you´d rather to test the client, or even create your own, you can pull and run our docker image which will provide you with mocked data to play with and make your development easier.
You can find the instructions for setting it up here: https://github.com/Einabit/sandbox.