{"id":15330002,"url":"https://github.com/lhotari/reactive-pulsar-showcase","last_synced_at":"2025-08-16T18:10:13.644Z","repository":{"id":146038416,"uuid":"397912169","full_name":"lhotari/reactive-pulsar-showcase","owner":"lhotari","description":"SpringBoot show case application for pulsar-client-reactive library (Reactive Client for Apache Pulsar)","archived":false,"fork":false,"pushed_at":"2024-12-04T16:26:19.000Z","size":289,"stargazers_count":13,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T02:53:51.479Z","etag":null,"topics":["apache-pulsar","project-reactor","reactive-streams","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lhotari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-19T11:00:15.000Z","updated_at":"2024-12-04T16:27:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"c0f81491-fe37-4a8e-9791-ed295e771562","html_url":"https://github.com/lhotari/reactive-pulsar-showcase","commit_stats":{"total_commits":73,"total_committers":2,"mean_commits":36.5,"dds":"0.15068493150684936","last_synced_commit":"c86d9dd9ed0e869f99855303f2d9c7b1bfdfe826"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lhotari/reactive-pulsar-showcase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhotari%2Freactive-pulsar-showcase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhotari%2Freactive-pulsar-showcase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhotari%2Freactive-pulsar-showcase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhotari%2Freactive-pulsar-showcase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lhotari","download_url":"https://codeload.github.com/lhotari/reactive-pulsar-showcase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lhotari%2Freactive-pulsar-showcase/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270749532,"owners_count":24638754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-pulsar","project-reactor","reactive-streams","spring-boot"],"created_at":"2024-10-01T09:50:53.987Z","updated_at":"2025-08-16T18:10:13.609Z","avatar_url":"https://github.com/lhotari.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reactive Pulsar Client show case application\n\nThis application was originally written as a demonstration of [Reactive Pulsar](https://github.com/datastax/reactive-pulsar) which predates [Pulsar Reactive Client](https://github.com/apache/pulsar-client-reactive_) and [Spring for Apache Pulsar](https://github.com/spring-projects/spring-pulsar). It has been updated in 12/2023 to use the latest versions of Pulsar Reactive Client and Spring for Apache Pulsar. This code base uses Pulsar Reactive Client directly, without the special annotation support Spring for Apache Pulsar. \n\n## Prerequisites\n\n### Pulsar standalone\n\nStarting Pulsar standalone\n```bash\ndocker run --name pulsar-standalone -d -p 8080:8080 -p 6650:6650 apachepulsar/pulsar:4.0.1 /pulsar/bin/pulsar standalone -nss -nfw\n```\n\nTailing logs\n```bash\ndocker logs -f pulsar-standalone\n```\n\nStopping\n```bash\ndocker stop pulsar-standalone\n```\n\nDeleting container\n```bash\ndocker rm pulsar-standalone\n```\n\n## Usage\n\n### Running the application\n\n```bash\n./gradlew :bootRun\n```\n\n### Running the webhook application\n\n```bash\n./gradlew :webhook-target-app:bootRun\n```\n\n## Telemetry ingest demonstration\n\n### Sending 1M telemetry entries with curl, all in one request\n\n```bash\n{ for i in {1..1000000}; do echo '{\"n\": \"device'$i'/sensor1\", \"v\": '$i'.123}'; done; } \\\n    | curl -X POST -T - -H \"Content-Type: application/x-ndjson\" localhost:8081/telemetry\n```\n\n### Sending 1M telemetry entries with curl, 1 message per request, with up to 50 parallel requests\n\nNote: this requires gnu xargs (on MacOS: `brew install findutils`, use `gxargs` instead of `xargs`)\nand gnu parallel (`brew install parallel`/`apt install moreutils`).\n\n```bash\n{ 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; } \\\n  | xargs -0 -P 2 -n 100 parallel -j 25 --\n```\n\n### Sending 10000 telemetry entries with curl, 1 message per request (slow!)\n\n```bash\nfor i in {1..10000}; do\n  echo '{\"n\": \"device'$i'/sensor1\", \"v\": '$i'.123}' \\\n    | curl -X POST -T - -H \"Content-Type: application/x-ndjson\" localhost:8081/telemetry\ndone\n```\n\n### Sending 1M telemetry entries with k6\n\nRequires [installing k6](https://k6.io/docs/getting-started/installation/).\n```bash\ncd k6\nk6 run -u 100 -i 1000000 telemetry_ingest.js\n```\n\n\n## Telemetry processing demonstration\n\n### Start pulsar-client to consume from telemetry_median\n\n```\npulsar-client consume -n 0 -s sub telemetry_median\n```\n\n### Sending 1M telemetry entries (1000 devices, 1000 metrics) with curl, all in one request\n\n```bash\n{ for i in {1..1000}; do for j in {1..1000}; do echo '{\"n\": \"device'$i'/sensor1\", \"v\": '$j'.123}'; done; done; } \\\n    | curl -X POST -T - -H \"Content-Type: application/x-ndjson\" localhost:8081/telemetry\n```\n\n\n## SSE / Server Sent Events demonstration\n\nSSE/Server Servet Events uses `text/event-stream` which is [defined in the HTML standard](https://html.spec.whatwg.org/#parsing-an-event-stream).\n\ncurl with `-N` parameter can be used to demonstrate SSE. \nThe backend support passing last event id in `Last-Event-ID` header or `lastEventId` query parameter. In addition, there is \na poll parameter which takes a boolean value expressed with true/1/yes/false/0/no. \nThe `/firehost` path uses the `telemetry_ingest` topic as the source and `/firehost/median` uses `telemetry_median`. \n\n```bash\n# use telemetry_ingest topic\ncurl -N localhost:8081/firehose/ingest\n# use telemetry_median topic\ncurl -N localhost:8081/firehose/median\n```\n\nTo demonstrate this, use one of the previous commands to send 1M telemetry entries with curl while the SSE curl command is running.\n\nThe SSE firehost example supports the `lastEventId` query parameter to continue from a specific message id. An application can use this for resuming message processing after a specific message id. \n\nThe `poll` query parameter can be used to control whether the SSE connection should be kept open or closed after the last message has been sent. The default value for `poll` is `1` which means that the connection will be kept open. Setting `poll` to `0` will close the connection after the currently last message has been sent from the server to the client.\n \n```bash\ncurl -N 'localhost:8081/firehose/median?lastEventId=CLoYEOEHIAAwAQ==\u0026poll=0'\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhotari%2Freactive-pulsar-showcase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flhotari%2Freactive-pulsar-showcase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flhotari%2Freactive-pulsar-showcase/lists"}