Contents

Introduction to OtterJet

Sebastian Rabiej

20 May 2024.2 minutes read

Introduction to OtterJet webp image

In software architecture, observability is one of the most important characteristics. This is especially true for distributed systems. Communication between services often happens asynchronously by sending messages, which introduces complexity for the application's testability. It introduces complexity for your testability of the application. Even if two services are working correctly separately, they may not work correctly together.

There are many tools that you will use to deliver messages between services, like Kafka, Rabbitmq, or NATS. It may be easy to test locally for a few services, but it's hard for many services. That's why you need tools that will help to monitor your message broker.

In this article, I will introduce a new tool for monitoring your NATS JetSteam server.

What is NATS JetStream?

NATS JetStream is a high-performance streaming system that can be used to build modern, reliable, and scalable applications.

It is built on top of NATS, a simple, secure, and performant messaging system.

How to monitor NATS JetStream without OtterJet?

  1. Install NATScli
  2. Run the following command to monitor the messages: nats sub --all SUBJECT_NAME to read all messages from the subject.
  3. To deserialize, you could use --translate flag which is not easy to use.

Potential Problems

As NATScli is a useful tool for many use cases, in this case it may cause some problems. Deserialization, filtering, and many more features are not easy to implement here.

Also, CLI solution may not be the most user-friendly approach for many developers, at least not for the author of this article :).

Introducing OtterJet

And exactly the same issues we had in our project led to the creation of OtterJet. Our project used NATS JetStream with protobuf encoding for messages. We stumbled upon a few classic issues during development: Why was my message not processed? Was the service wrongly configured, or was the event never sent in the first place? While NATScli was useful, it wasn't always sufficient for investigating these issues.

OtterJet will help you with observability during the development of your application. Thanks to its web interface, it becomes simpler to diagnose and understand potential problems in your applications.

How to use OtterJet?

  1. Clone repository from: https://github.com/softwaremill/OtterJet 
  2. Run ./mvnw clean install to build the project.
  3. Configure details in the application.properties file.
  4. Run ./mvnw spring-boot:run to start app.
  5. Open the OtterJet in your browser: localhost:1111/msgs
  6. Enjoy Application :)

Configuration

The following properties need to be set in the application.properties file:

  • read.mode: The mode to use for deserialization (either proto or plaintext).
  • read.subject: The subject to read messages from.
  • read.proto.pathToDescriptor: The path to the protobuf descriptor file (only required if read.mode is set to proto).

Key features of OtterJet

As for now, OtterJet has the following features:

  • Reads messages from a NATS JetStream server.
  • Deserializes messages based on the specified mode (protobuf or plaintext for now).
  • Filters messages based on subject, type, and body content.
  • Displays monitoring information in a web interface.

To monitor, you need to enable this feature in the NATS JetStream server.

⚠️ Caution ⚠️

This tool is still in development, for now, I would recommend using it only for development purposes.

What does it look like?

Messages page
image1

Monitoring page
image2

Further development

In the future, we plan to add more features to OtterJet, such as:

  • Easier running application using params.
  • Create a Docker image for OtterJet to run it in a container.
  • Support for more deserialization modes - Avro.
  • Support schema registry.
  • Support for more specific monitoring information.

Reviewed by Dariusz Broda, Dawid Popczyk

Blog Comments powered by Disqus.