Pulsar Tester
Overview
The Unified Assurance Pulsar Tester microservice is part of the microservice suite. The Pulsar Tester was created to help operators/developers debug and test pulsar-related workflow pipelines.
Prerequisites
-
A microservice cluster must be setup. Refer to Microservice Cluster Setup.
-
Apache Pulsar must be installed. Refer to Apache Pulsar microservice.
-
An application of user choice that can send REST requests (cURL, for example)
Setup
su - assure1
export NAMESPACE=a1-messaging
export WEBFQDN=<Primary Presentation Web FQDN>
a1helm install pulsar-tester assure1/pulsar-tester -n $NAMESPACE --set global.imageRegistry=$WEBFQDN
Default Configuration
| Name | Value | Possible Values | Notes |
|---|---|---|---|
| LOG_LEVEL | INFO | FATAL, ERROR, WARN, INFO, DEBUG | Logging level used by application. |
| SERVER_PORT | 30001 | int 30000-32767 | Port used by the http server |
| SECURITY_LEVEL | 2 | int 0-2 | Security level switch |
Configurations can be changed by passing the values to the a1helm install prefixed with the configData parent key.
Examples of changing configuration when using the command line
Changing the HTTP port to 30002
a1helm install ... --set-string configData.SERVER_PORT=30002
Setting the log level to DEBUG
a1helm install ... --set-string configData.LOG_LEVEL=DEBUG
Security Levels
The application contains security levels for access. The below table will explain each of the options
| Level | Detail | Access Example |
|---|---|---|
| 0 | No privacy and no authentication | example.com:30001 |
| 1 | Secure HTTP and no authentication | https://example.com:9443/pulsar-tester/ |
| 2 | Secure HTTP and JWT authentication | https://example.com:9443/pulsar-tester/ |
JWT Authentication
When using security level set to 2, you will have to generate a JWT token using the bin/JWT utility and use it for every endpoint
Generating the token
bin/JWT -s assure1 -a pulsar-tester
Accessing help endpoint with generated token using cURL
curl -k -H "Authorization: Bearer <JWT_TOKEN>" https://example.com:9443/pulsar-tester/help
Available REST endpoints that interact with the pulsar bus
The below examples will be using cURL and security level set to 0 and will be using the assure1/event/sink topic.
Sending data to the topic
Using inline json
curl -X POST -d '{"message":"Hello World!"}' localhost:30001/assure1/event/sink
Using a file named test.json
curl -X POST -d@test.json localhost:30001/assure1/event/sink
Consume data from the topic
curl -X PUT localhost:30001/assure1/event/sink
Viewing data
To view data being sent to that particular topic, you will need to view pulsar-tester's application logs.
a1k logs -n $NAMESPACE sts/pulsar-tester -f | grep "assure1/event/sink"
Stop consuming data from the topic
curl -X DELETE localhost:30001/assure1/event/sink
Status Endpoint
The status endpoint will print all active subscriptions, how many messages each has received and when each subscription was made
curl -X GET localhost:30001/status
Help Endpoint
The help endpoint will print similar information for using the utility
curl -X GET localhost:30001/help