SpringBoot show case application for reactive-pulsar library (Reactive Streams adapter for Apache Pulsar Java Client)

Overview

Reactive Pulsar Client show case application

Prerequisites

Cloning reactive-pulsar

Running this application requires cloning https://github.com/lhotari/reactive-pulsar to the parent directory of this project.

cd ..
git clone https://github.com/lhotari/reactive-pulsar

Pulsar standalone

Starting Pulsar standalone

docker run --name pulsar-standalone -d -p 8080:8080 -p 6650:6650 apachepulsar/pulsar:latest /pulsar/bin/pulsar standalone

Tailing logs

docker logs -f pulsar-standalone

Stopping

docker stop pulsar-standalone

Deleting container

docker rm pulsar-standalone

Usage

Running the application

./gradlew :bootRun

Running the webhook application

./gradlew :webhook-target-app:bootRun

Telemetry ingest demonstration

Sending 1M telemetry entries with curl, all in one request

{ for i in {1..1000000}; do echo '{"n": "device'$i'/sensor1", "v": '$i'.123}'; done; } \
    | curl -X POST -T - -H "Content-Type: application/x-ndjson" localhost:8081/telemetry

Sending 1M telemetry entries with curl, 1 message per request, with up to 50 parallel requests

Note: this requires gnu xargs (on MacOS: brew install findutils, use gxargs instead of xargs) and gnu parallel (brew install parallel/apt install moreutils).

{ for i in {1..1000000}; do echo -ne 'curl -s -X POST -d '\''{"n": "device'$i'/sensor1", "v": '$i'.123}'\'' -H "Content-Type: application/x-ndjson" localhost:8081/telemetry''\0'; done; } \
  | xargs -0 -P 2 -n 100 parallel -j 25 --

Sending 10000 telemetry entries with curl, 1 message per request (slow!)

for i in {1..10000}; do
  echo '{"n": "device'$i'/sensor1", "v": '$i'.123}' \
    | curl -X POST -T - -H "Content-Type: application/x-ndjson" localhost:8081/telemetry
done

Sending 1M telemetry entries with k6

Requires installing k6.

cd k6
k6 run -u 100 -i 1000000 telemetry_ingest.js

Telemetry processing demonstration

Start pulsar-client to consume from telemetry_median

pulsar-client consume -n 0 -s sub telemetry_median

Sending 1M telemetry entries (1000 devices, 1000 metrics) with curl, all in one request

{ for i in {1..1000}; do for j in {1..1000}; do echo '{"n": "device'$i'/sensor1", "v": '$j'.123}'; done; done; } \
    | curl -X POST -T - -H "Content-Type: application/x-ndjson" localhost:8081/telemetry

SSE / Server Sent Events demonstration

SSE/Server Servet Events uses text/event-stream which is defined in the HTML standard.

curl with -N parameter can be used to demonstrate SSE. The backend support passing last event id in Last-Event-ID header or lastEventId query parameter. In addition, there is a poll parameter which takes a boolean value expressed with true/1/yes/false/0/no. The /firehost path uses the telemetry_ingest topic as the source and /firehost/median uses telemetry_median.

curl -N localhost:8081/firehose

continuing after a specific message id:

curl -N 'localhost:8081/firehose/median?lastEventId=CLoYEOEHIAAwAQ==&poll=0'
You might also like...

EssentialClient is a client side mod originally forked from Carpet Client for 1.15.2 that implements new client side features

EssentialClient is a client side mod originally forked from Carpet Client for 1.15.2 that implements new client side features

EssentialClient EssentialClient is a client side only mod originally forked from Carpet Client for 1.15.2 that implements new client side features. Th

Jan 3, 2023

A simple quarkus app with hibernate as ORM, used to show the features of Hibernate Search

beer-manager-hibernate-search Project This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, ple

Jan 6, 2022

This project was created as a simple example to show how we can implement the hexagonal architecture(software design) proposed by Netflix.

This project was created as a simple example to show how we can implement the hexagonal architecture(software design) proposed by Netflix.

Netflix Hexagonal Architecture Table of contents About the project Description Built with Installation Requirements to run Usage information Run Licen

Dec 20, 2022

An example to show how you could use clean architecture and DDD elements with Camunda.

An example to show how you could use clean architecture and DDD elements with Camunda.

Camunda DDD and Clean Architecture An example to show how you could use clean architecture and DDD and their advantages with Camunda. I also wrote a b

Dec 15, 2022

Bank Statement Analyzer Application that currently runs in terminal with the commands: javac Application.java java Application [file-name].csv GUI coming soon...

Bank Statement Analyzer Application that currently runs in terminal with the commands: javac Application.java java Application [file-name].csv GUI coming soon...

May 21, 2022

Acceso a Datos - 01 Streams, Ficheros y Expresiones Regulares. 2DAM. Curso 2021-2022

Acceso a Datos - 01 Streams, Ficheros y Expresiones Regulares. 2DAM. Curso 2021-2022

Acceso a Datos - 01 Streams, Ficheros y Expresiones Regulares Tema 01 Streams, Ficheros y Expresiones Regulares. 2DAM. Curso 2021/2022. Contenidos TDA

Dec 27, 2022

Dynamic Configuration Capability for SpringBoot Application

Dynamic Configuration Capability for SpringBoot Application

Spring Boot Dynamic Config Hot-reload your SpringBoot configurations, with just a '@DynamicConfig' annotation, the simplest solution, ever. English 简体

Jan 3, 2023

LOQUI - Real-time chat application built using Apache Kafka, Java, Spring Boot, SockJS and React

LOQUI - Real-time chat application built using Apache Kafka, Java, Spring Boot, SockJS and React

LOQUI is a simple real-time chat application that demonstrates how to use Apache Kafka as a message broker along with Java, Spring Boot and React on the front-end

Jun 5, 2022

This is the src of Badlion client 3.0.0, The reason of this repo is badlion client's owner being p e d o

About Badlion Using Gradle instead of the shit mcp uwu Commands Run with random username gradle startGame Run with another username gradle startGame -

Dec 2, 2022
Owner
Lari Hotari
OSS contributor, Senior Software Engineer @ DataStax
Lari Hotari
Simple springboot API for addressBook. Supports all REST controllers and have custom error handling for every specific case, also supports redis caching.

AddressBook-SpringBoot-API Simple Springboot API for addressBook with redis cache. Supports all REST controllers and have custom error handling for ev

Shirish Saxena 1 Jan 21, 2022
End to End project for Kafka Streams using Spring Cloud Kafka streams

Spring Kafka Streams using Spring Cloud Streams End to End example Endpoint http://localhost:8080/domain/lookup/facebook - to pull all facebook relate

TechPrimers 43 Dec 20, 2022
App to demonstrate the passage of adapter items into activity using interfaces

OnClickListenerExample This application shows how to pass adapter items into an activity using interfaces. The sample data set contains two fields rep

Rohan Bari 1 Feb 2, 2022
A joint research effort for building highly optimized Reactive-Streams compliant operators.

reactive-streams-commons A joint research effort for building highly optimized Reactive-Streams compliant operators. Current implementors include RxJa

Reactor 350 Dec 23, 2022
Reactive Streams Specification for the JVM

Reactive Streams The purpose of Reactive Streams is to provide a standard for asynchronous stream processing with non-blocking backpressure. The lates

null 4.5k Dec 30, 2022
Auto-Unit-Test-Case-Generator automatically generates high-level code-coverage JUnit test suites for Java, widely used within the ANT Group.

中文README传送门 What is Auto-Unit-Test-Case-Generator Auto-Unit-Test-Case-Generator generates JUnit test suites for Java class just as its name. During te

TRaaS 108 Dec 22, 2022
Test case to check if the Log4Shell/CVE-2021-44228 hotfix will raise any unexpected exceptions

Log4Shell Hotfix Side Effect Test Case I wanted to know if any ClassNotFoundException or similar unexpected exception is raised when one applies the C

Malte S. Stretz 3 Nov 9, 2022
Euphony Demo for patients and assistants in case of an emergency.

sound-helper Eutophia sample project Overview sound-helper is a sample application using the euphony Acoustic Data Telecommunication Library. This app

Euphony 5 Sep 6, 2021
Pulsar airquality function

pulsar-airquality-function Developer Workspace Using JDK 8. 1.8.0_292. OPEN JDK 64-bit Server Using IntelliJ IDEA CE 2021.2 Developer Deployment Serve

Timothy Spann 3 Jun 27, 2022
This is simple project to show how to create a basic API using Java 11 + Maven + Spring Boot + PostgrSQL + Flyway.

This is simple project to show how to create a basic API using Java 11 + Maven + Spring Boot + PostgrSQL + Flyway.

Sean Maxwell 11 Dec 10, 2022