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 The logging level for the application.
SERVER_PORT 30001 An integer between 30000 and 32767. The port used by the HTTP server.
SECURITY_LEVEL 2 0, 1, or 2 The security level to use. See Security Levels.

Security Levels

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

Level Detail Access Example
0 No privacy and no authentication. Not recommended. example.com:30001
1 Secure HTTP and no authentication. Not recommended. https://example.com:9443/pulsar-tester/
2 Secure HTTP and JWT authentication. Recommended. https://example.com:9443/pulsar-tester/

Setting Up JWT Authentication for Pulsar Tester

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

Pulsar Bus REST Endpoints

You can use the endpoints shown in the following examples. The examples use cURL to connect to the assure1/event/sink topic with security level 2, where &ltJWT_TOKEN> is the token generated by the JWT utility.

Before running any example requests, set the $HOSTFQDN environment variable:

export HOSTFQDN=<hostFQDN>

where <hostFQDN> is your Unified Assurance host FQDN, including https://.

Sending Data to the Topic

Using inline JSON:

curl -H "Authorization: Bearer <JWT_TOKEN>" -X POST -d '{"message":"Hello World!"}' $HOSTFQDN:9443/pulsar-tester/assure1/event/sink

Using a file named test.json:

curl -H "Authorization: Bearer <JWT_TOKEN>" -X POST -d@test.json $HOSTFQDN:9443/pulsar-tester/assure1/event/sink

Consume Data From the Topic

curl -H "Authorization: Bearer <JWT_TOKEN>" -X PUT $HOSTFQDN:9443/pulsar-tester/assure1/event/sink

Viewing Data

To view data being sent to a 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 -H "Authorization: Bearer <JWT_TOKEN>" -X DELETE $HOSTFQDN:9443/pulsar-tester/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 -H "Authorization: Bearer <JWT_TOKEN>" -X GET $HOSTFQDN:9443/pulsar-tester/status

Help Endpoint

The help endpoint prints information about using the utility.

curl -H "Authorization: Bearer <JWT_TOKEN>" -X GET $HOSTFQDN:9443/pulsar-tester/help