Pulsar Tester

The Pulsar Tester microservice helps debug and test Apache Pulsar-related workflows.

Pulsar Tester Prerequisites

Before deploying the microservice, confirm that the following prerequisites are met:

  1. A microservice cluster is set up. See Microservice Cluster Setup.

  2. The Apache Pulsar microservice is deployed. See Pulsar.

  3. An application of your choice that can send REST requests, such as cURL or Postman, is set up.

Deploying Pulsar Tester

To deploy the microservice, run the following commands:

su - assure1
export NAMESPACE=a1-messaging
export WEBFQDN=<WebFQDN> 
a1helm install <microservice-release-name> assure1/pulsar-tester -n $NAMESPACE --set global.imageRegistry=$WEBFQDN

In the commands:

You can also use the Unified Assurance UI to deploy microservices. See Deploying a Microservice by Using the UI for more information.

Changing Pulsar Tester Configuration Parameters

When running the install command, you can optionally change default configuration parameter values by including them in the command with additional --set arguments. You can add as many additional --set arguments as you need.

For example, set a parameter described in Default Pulsar Tester Configuration by adding --set configData.<parameter_name>=<parameter_value>.

Default Pulsar Tester Configuration

The following table describes the default configuration parameters found in the Helm chart under configData for the microservice.

Name Default 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

Security Levels

The Pulsar Tester microservice contains the security levels described in the following table.

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

To use security level 2, generate a JWT token using the bin/JWT utility and use the token for every endpoint.

To generate the token, run the following command:

bin/JWT -s assure1 -a pulsar-tester

To access the help endpoint with the generated token using cURL, run the following command:

curl -k -H "Authorization: Bearer <JWT_TOKEN>" https://example.com:9443/pulsar-tester/help

Pulsar Bus REST Endpoints

The below examples use cURL to connect to the assure1/event/sink with security level 0.

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 can review the Pulsar Tester microservice's application logs by running the following command:

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 prints 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 prints similar information for using the utility.

curl -X GET localhost:30001/help