All Projects → reactivejson → rxson

reactivejson / rxson

Licence: Apache-2.0 license
No description or website provided.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to rxson

rsocket-rpc-js
Standard RSocket RPC Implementation
Stars: ✭ 29 (+70.59%)
Mutual labels:  reactive-streams
r2dbc-proxy
R2DBC Proxying Framework
Stars: ✭ 108 (+535.29%)
Mutual labels:  reactive-streams
springboot-rsocketjwt-example
Example of using JWT with RSocket and Spring Boot
Stars: ✭ 26 (+52.94%)
Mutual labels:  reactive-streams
reactive-pulsar
Reactive Streams adapter for Apache Pulsar Java Client
Stars: ✭ 45 (+164.71%)
Mutual labels:  reactive-streams
kotlin-kafka-and-kafka-streams-examples
Kafka with KafkaReactor and Kafka Streams Examples in Kotlin
Stars: ✭ 33 (+94.12%)
Mutual labels:  reactive-streams
akka-cookbook
提供清晰、实用的Akka应用指导
Stars: ✭ 30 (+76.47%)
Mutual labels:  reactive-streams
R2dbc Spi
Service Provider Interface for R2DBC Implementations
Stars: ✭ 252 (+1382.35%)
Mutual labels:  reactive-streams
KotlinReactiveMS
An educational project to learn reactive programming with Spring 5 and Kotlin
Stars: ✭ 33 (+94.12%)
Mutual labels:  reactive-streams
async
⏱ Promises and reactive-streams in Swift built for high-performance and scalability.
Stars: ✭ 35 (+105.88%)
Mutual labels:  reactive-streams
alpakka-samples
Example projects building Reactive Integrations using Alpakka
Stars: ✭ 61 (+258.82%)
Mutual labels:  reactive-streams
reactive-streams-in-java
Code for "Reactive Streams in Java" book
Stars: ✭ 19 (+11.76%)
Mutual labels:  reactive-streams
netifi-quickstart-java
Project to assist you in getting started using Netifi.
Stars: ✭ 23 (+35.29%)
Mutual labels:  reactive-streams
jetty-reactive-httpclient
Jetty ReactiveStreams HttpClient
Stars: ✭ 63 (+270.59%)
Mutual labels:  reactive-streams
Troilus
Troilus is a Java client library for Cassandra.
Stars: ✭ 17 (+0%)
Mutual labels:  reactive-streams
Atmosph4rX
Atmosphere Framework version 4 for Reactive Streams
Stars: ✭ 34 (+100%)
Mutual labels:  reactive-streams
flutter-form-with-validation-BLOC
This form and validation functions are created by using the BLOC pattern with RxDart instead of using StatefulWidget
Stars: ✭ 63 (+270.59%)
Mutual labels:  reactive-streams
akka-stream-mon
Throughput and latency monitoring for Akka Streams
Stars: ✭ 23 (+35.29%)
Mutual labels:  reactive-streams
reactive-jms
Reactive JMS wrapper
Stars: ✭ 16 (-5.88%)
Mutual labels:  reactive-streams
sample-spring-webflux
testing webclient reactive communication with spring boot reactive application built on top of spring webflux
Stars: ✭ 21 (+23.53%)
Mutual labels:  reactive-streams
mongo-images
Ever wonder how you can create a full stack reactive application that also saves images? Well look no further! We've got Spring Webflux, Reactive Mongo Streams with GridFS, and Angular5!
Stars: ✭ 12 (-29.41%)
Mutual labels:  reactive-streams

RxSON

Reactive HTTP Client for Java and Android.

Maven Central Javadoc Sonatype Nexus (Snapshots)

Reactive JSON: Java Reactive approach to JSON.

A light library for composing asynchronous and event-based REST client by using observable json streams. It extends the Java Http Client to support Reactive json stream.

Why RxSON

  • Fast: makes it easy for the application to use JSON streamed chunks as soon as they arrive, and rendering you code faster.

  • Reactive Programming supports RxJava and Reactor: An Asynchronous Reactive JSON REST Client to stream any REST resource

  • Non-Blocking JSON parsing

  • Fetching huge JSON payload larger than the available memory:

    • RxSON can load json trees larger than the available memory.
    • Fetch response in chunks.
    • No need to deserialize entire json into memory.
  • JsonPath to selectively extract desired json data

Getting started

RxSON is available at the Central Maven Repository with drivers for RxJava and Reactor

Rxjava
  • Maven
    <!--Rxjava-->
      <dependency>
          <groupId>com.github.rxson</groupId>
          <artifactId>rxson-rxjava</artifactId>
          <version>1.1.0</version>
      </dependency>
  • Gradle
    implementation 'com.github.rxson:rxson-rxjava:1.1.0'
    
Simple to use

Given the JSON stream

[
  {
    "Airport": {
      "Code": "LA",
      "Name": "LA: LA International"
    }
  },
  {
    "Airport": {
      "Code": "ATL",
      "Name": "Atlanta: Atlanta International"
    }
  },
//Incomplete and that's ok, more chunks expected to come

RxSON example

   String serviceURL = "https://think.cs.vt.edu/corgis/datasets/json/airlines/airlines.json";
   HttpRequest req = HttpRequest.newBuilder(URI.create(serviceURL)).GET().build();
   RxSON rxson = new RxSON.Builder().build();

   String jsonPath = "$[*].Airport.Name";
   Flowable<String> airportStream = (Flowable<String>)rxson.create(String.class, req, jsonPath);
   airportStream
       .doOnNext(it -> System.out.println("Received new item: " + it))
       //Just for test
       .toList()
       .blockingGet();

Object example:

package io.rxson.rxjava.model.airline;

import com.fasterxml.jackson.annotation.JsonProperty;

public class Airport {
    @JsonProperty("Code")
    public String code;
    @JsonProperty("Name")
    public String name;
    public String getCode() { return code; }
    public void setCode(String code) { this.code = code; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
}
  String serviceURL = "https://think.cs.vt.edu/corgis/datasets/json/airlines/airlines.json";
  HttpRequest req = HttpRequest.newBuilder(URI.create(serviceURL)).GET().build();
  RxSON rxson = new RxSON.Builder().build();
  String jsonPath = "$[*].Airport";
  Flowable<Airport> airportStream = (Flowable<Airport>)rxson.create(Airport.class, req, jsonPath);
  airportStream
      .observeOn(Schedulers.io())
      .subscribeOn(Schedulers.io())
      .doOnNext(it -> System.out.println("Received a flow item: " + it.getName()))
      //Just for test
      .toList()
      .blockingGet(); 

If you need a Model example:

//Create your own models
public class JsonNodeModel {
    @Reactive(path = "$[*].Airport")
    private Flowable<JsonNode> result;
    public Flowable<JsonNode> getResult() { return result; }
    public void setResult(final Flowable<JsonNode> result) { this.result = result; }
}
  String serviceURL = "https://think.cs.vt.edu/corgis/datasets/json/airlines/airlines.json";
  final HttpClient client = HttpClient.newBuilder().version(HttpClient.Version.HTTP_2).build();
  final HttpRequest req = HttpRequest.newBuilder(URI.create(serviceURL)).GET().build();
  final RxSON rxson = new RxSON.Builder().client(client).build();
  final var airlinesStream = rxson.create(JsonNodeModel.class, req);
  airlinesStream.getResult()
      .doOnNext(it -> System.out.println("Received a flow item: " + it.get("Name")))
      .toList().blockingGet(); 
Reactor project
  • Maven
    <!--Reactor-->
      <dependency>
          <groupId>com.github.rxson</groupId>
          <artifactId>rxson-reactor</artifactId>
          <version>1.1.0</version>
      </dependency>
  • Gradle
    implementation 'com.github.rxson:rxson-reactor:1.1.0'
    

RxSON example

      String serviceURL = "https://think.cs.vt.edu/corgis/datasets/json/airlines/airlines.json";
      HttpRequest req = HttpRequest.newBuilder(URI.create(serviceURL)).GET().build();
      RxSON rxson = new RxSON.Builder().build();

      String jsonPath = "$[*].Airport.Name";
      Flux<String> airportStream = (Flux<String>) rxson.create(String.class, req, jsonPath);
      airportStream
          .doOnNext(it -> System.out.println("Received new item: " + it))
          //Just for test
          .blockLast();

More detailed examples are available in tests.

Goal

RxSON designed to speed up you code by providing reactive objects before the response complete. This library provides an Asynchronous Reactive REST Client to stream any REST resource. RxSON makes it easy for the application to use JSON streamed chunks from the response as soon as they arrive, and rendering you code faster.

RxSON treats the HTTP response as a series of small, useful chunks and map them to Java Objects

Useful helpers

JsonPath helper

Http Client

Prerequisites: Java 11 +

License

Apache 2.0, see LICENSE.

Support

If you need help, please reach out to me: [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].