Introduction

Ressor is a framework which ease the development of resource-based Java services. It translates your static or dynamic resources (files, http endpoints, git repositories, etc) into a complete Java service instance, implicitly reloading it when the source data is changing.

It supports various formats as well as different kinds of data sources. With Ressor, you can instantiate your service once and use it everywhere for the whole application lifetime. When the underlying resource is changed, the service automatically reloads it under the hood.

See the Basic Concepts page for the more details.

Quick Example

Let's suppose you have a service which provides book titles by the ISBN:

public class BookRepository {
private final Map<String, String> data = new HashMap<>();
public BookRepository(List<Book> books) {
books.forEach(b ->
data.put(b.getIsbn(), b.getTitle()));
}
public String getTitle(String isbn) {
return data.get(isbn);
}
}

Also, there is a /etc/books.json file with all the data. Now we can simply tell Ressor to create a service instance, based on that file and use JSON format:

var ressor = Ressor.create();
var bookService = ressor.service(BookRepository.class)
.fileSource("/etc/books.json")
.translator(jsonList(Book.class))
.build();

Now we can just use it:

var title = bookService.getTitle("0679760806"); // The Master and Margarita

What will happen if the books.json file will be changed? In case of file on local File System you can just subscribe for the changes:

ressor.listen(bookService);

That's all, you can continue using bookService instance, which will be always up-to-date with the books.json file contents.

Import

Releases are available via Maven Central.

Java 11+

implementation 'xyz.ressor:ressor-core:1.3.0'
implementation 'xyz.ressor:ressor-git-source:1.3.0'
implementation 'xyz.ressor:ressor-http-source:1.3.0'
implementation 'xyz.ressor:ressor-s3-source:1.3.0'

Java 8

implementation 'xyz.ressor:ressor-core-jdk8:1.3.0'
implementation 'xyz.ressor:ressor-git-source-jdk8:1.3.0'
implementation 'xyz.ressor:ressor-http-source-jdk8:1.3.0'
implementation 'xyz.ressor:ressor-s3-source-jdk8:1.3.0'

Versioning

We use SemVer for versioning. For the versions available, see the releases on this repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.