Let’s learn about Netflix Mantis Platform and some of the cool features it offers.
In this article, we’ll take a look at the Mantis platform developed by Netflix.
We’ll explore the main Mantis concepts by creating, running, and investigating a stream processing job.
Mantis is a platform for building stream-processing applications (jobs). It provides an easy way to manage the deployment and life-cycle of jobs. Moreover, it facilitates resource allocation, discovery, and communication between these jobs.
Therefore, developers can focus on actual business logic, all the while having the support of a robust and scalable platform to run their high volume, low latency, non-blocking applications.
A Mantis job consists of three distinct parts:
Let’s now explore each of them.
Let’s start by adding the mantis-runtime and jackson-databind dependencies:
<dependency>
<groupId>io.mantisrx</groupId>
<artifactId>mantis-runtime</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
Now, for setting up our job’s data source, let’s implement the Mantis Source interface:
public class RandomLogSource implements Source<String> {
@Override
public Observable<Observable<String>> call(Context context, Index index) {
return Observable.just(
Observable
.interval(250, TimeUnit.MILLISECONDS)
.map(this::createRandomLogEvent));
}
private String createRandomLogEvent(Long tick) {
// generate a random log entry string
...
}
}
As we can see, it simply generates random log entries multiple times per second.
#netflix #web-development #programming #developer