Apache Juneau, an open source framework that that allows developers to marshal POJOs (Plain Old Java Objects) and develop REST microservices and APIs in Java has become a top-level project with the Apache Software Foundation.
“We tried to make it as simple as possible for a developer to create REST interfaces — really complex and sophisticated interfaces using very little code,” said James Bognar, the project’s vice president and senior software engineer at Salesforce, who said it’s been a pet project of his since 2007.
Apache Juneau consists of:
- A universal toolkit for marshaling POJOs to a wide variety of content types using a common cohesive framework;
- A universal REST server API for creating self-documenting REST interfaces using POJOs, simply deployed as one or more top-level servlets in any Servlet 3.1.0+ container;
- A universal REST client API for interacting with Juneau or third-party REST interfaces using POJOs and proxy interfaces; and
- A REST microservice API that combines all the features above with a simple configurable Jetty server for creating lightweight standalone REST interfaces that start up in milliseconds.
Marshalling is used to transform an object’s memory representation to a data format suitable for moving between or across different parts of (or across programs), and to simplify communications to remote objects with an object.
Juneau is tiny — around 1MB — and requires no auto-wiring, no code generation, no dependency injection.
“Instead of making HTTP calls, you’re just making Java method calls.” — James Bognar
It started as a JSON serialization library, back when JSON was just becoming a “thing,” according to Bognar. There were no JSON serialization libraries back then. This was an internal IBM project, and it grew into a bunch of different languages, such as XML and HTML.
“It was a single API that allows you to serialize POJOs to all these different languages as opposed to having to pre-rec different libraries for each individual language,” he said.
Later support was added for REST APIs.
“We developed a REST API on top of it that so that just using servlets and annotations, you’re able to quickly create REST APIs using nothing but serialized POJOs. As a developer, you don’t have to know anything about how things are going to be serialized, you just need to create Java methods to take in POJOs and return POJOs and all the serialization is taken care of for you. … This really simplifies creating REST inside microservices.”
IBM started using these REST APIs inside Docker containers as the basis of its collaborative lifecycle management-as-a-service offering, and that’s how the microservice component was invented, he said.
It’s simply an embedded Jetty server with REST servlets to provide maximum flexibility.
“We’re trying to use all core Java technology without introducing any prerequisites,” he said.
It’s now being used at IBM, The Open Group, and Salesforce, among others. The Apache Streams project began incorporating Apache Juneau libraries in late 2016.
John D. Ament, vice president of the Apache Incubator and a mentor to the project, characterizes it as a successor for JSON processing.
“Apache Juneau was identified as a clean solution. It provides an easy-to-use API, great performance and a large number of features that made it a strong recommendation for others to leverage.”
One of the interesting features added recently is a REST client API that allows you to define Java proxy interfaces against third-party REST interfaces.
“Instead of having to do low-level REST calls through a generic HTTP client, you can instead wrap those calls behind interface proxies. Instead of making HTTP calls, you’re just making Java method calls. It’s a very similar concept to SOAP, but it’s RPC over REST, which we call rRPC,” Bognar explained.
Going forward, the project wants to add more languages, including YAML, and Protobuf, which is a Google API, as well as support for gRPC similar to the way the project has defined interface proxies against REST APIs.
The New Stack is a wholly owned subsidiary of Insight Partners. TNS owner Insight Partners is an investor in the following companies: MADE, Docker.