This application provides simple REST api for sending string message into Apache Pulsar topics. There is also simple html page to send message from browser.
REST API documentation is available openapi.yml file.
For simple start up you can use Docker image https://github.com/osomahe/pulsar-source-app/pkgs/container/pulsar-source-app.
Release notes can be found at releases.md.
Environment variables:
- PULSAR_SERVICE_URL - default "pulsar://localhost:6650" url to connect to Apache Pulsar instance
- PULSAR_TLS_TRUST_CERT - not set by default, used for transport encryption using tLS certificate e.g.
/pulsar/certs/ca.cert.pem
- PULSAR_TLS_CERT_FILE - not set by default, path for client certificate for TLS authorization
/pulsar/certs/pulsar-source-app.cert.pem
- PULSAR_TLS_KEY_FILE - not set by default, path for client key to certificate for TLS authorization
/pulsar/certs/pulsar-source-app.key-pk8.pem
- PULSAR_HEALTH_TOPIC - default "non-persistent://public/default/health-check" topic used for health checking of readiness probe
Other environment variables:
- PULSAR_DEFAULT_PRODUCER - default "pulsar-source-app" name used for producing messages
- PULSAR_DEFAULT_TYPE - default "persistent" in case of simple topic name, message will be published into default namespace persistent://public/default/topic-name
- PULSAR_DEFAULT_TENANT - default "public" in case of simple topic name, message will be published into default namespace persistent://public/default/topic-name
- PULSAR_DEFAULT_NAMESPACE - default "default" in case of simple topic name, message will be published into default namespace persistent://public/default/topic-name
Examples:
docker run -d --name pulsar-source-app -p 8080:8080 -e PULSAR_SERVICE_URL="pulsar://pulsarhostname:6650" ghcr.io/osomahe/pulsar-source-app
- Liveness probe -
/q/health/live
- Readiness probe -
/q/health/ready
This project was developed with support of companies HP Tronic and Osomahe.
Start Apache Pulsar instance.
docker run -d --rm --name pulsar \
-p 6650:6650 \
apachepulsar/pulsar:2.8.0 \
bin/pulsar standalone
Start Apache Pulsar instance with transport tls on.
docker run -d --rm --name pulsar -p 6651:6651 \
-v $(pwd)/development/pulsar/certs:/pulsar/certs:ro \
-v $(pwd)/development/pulsar/conf-transport-tls:/pulsar/conf:ro \
apachepulsar/pulsar:2.8.0 bin/pulsar standalone -nfw
Start Apache Pulsar instance with tls authorization.
docker run -d --rm --name pulsar -p 6651:6651 \
-v $(pwd)/development/pulsar/certs:/pulsar/certs:ro \
-v $(pwd)/development/pulsar/conf-auth-tls:/pulsar/conf:ro \
apachepulsar/pulsar:2.8.0 bin/pulsar standalone -nfw
docker exec -i pulsar bin/pulsar-admin namespaces grant-permission public/default --actions produce,consume --role pulsar-source-app