For a simple glimpse of use cases, have a look at apache-pulsar-demo-consumer/src/test/java/com/nacho/pulsar/demo/consumer/TestCases.java
There are 2 options:
-
Run infra only:
docker-compose -f docker-compose-infra.yml up
- In this case you'll need to run the
producer
andconsumer
manually from the ide/maven.
- In this case you'll need to run the
-
Run infra + 1 producer + 2 consumers:
docker-compose up
In both cases, you'll get have the following local urls:
- Dashboard: http://localhost:7777/
- Metrics: http://localhost:8080/metrics/
- Grafana: http://localhost:3000/ (admin:admin)
- Prometheus: http://localhost:9090/
In pulsar
, the lag is known as msgBacklog. And instead of reset the offset
, the term is skip messages
.
You'll need to know the msgBacklog of the topic and then skip those for a subscription.
-
Get stats:
bin/pulsar-admin topics stats persistent://sample/pulsar/ns1/key_shared-topic
-
Skip:
bin/pulsar-admin topics skip persistent://sample/pulsar/ns1/key_shared-topic -n 430 -s key_shared-subscription
-
Start producing continuously
while true; do echo "Sending..."; curl -XPOST localhost:7070/produce/key-shared; sleep 1; done
-
Stop consumers: Either stop manually from the IDE or do
docker stop apache-pulsar-demo_consumer-1_1 && docker stop apache-pulsar-demo_consumer-2_1
-
You'll see lag accumulating in grafana localBacklog and in Prometheus.
-
To restart the consumers either run it manually from the IDE or do
docker start apache-pulsar-demo_consumer-1_1 && docker start apache-pulsar-demo_consumer-2_1
Setup:
- https://pulsar.apache.org/docs/en/standalone-docker/
- https://github.com/apache/pulsar/blob/master/docker-compose/standalone-dashboard/docker-compose.yml
Monitoring: