Steps to perform virtualization of Kafka topics
DevTest 10.7.x
DevTest – Kafka
Installing and starting Kafka on a Unix VM
wget https://archive.apache.org/dist/kafka/3.0.0/kafka_2.13-3.0.0.tgz
wget https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
tar -xvzf ~/Downloads/kafka_2.13-3.0.0.tgz
mv kafka_2.13-3.0.0 kafka
~/kafka/bin/zookeeper-server-start.sh ~/kafka/config/zookeeper.properties &
~/kafka/bin/kafka-server-start.sh ~/kafka/config/server.properties &
~/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --topic first_topic --create --partitions 3 --replication-factor 1
~/kafka/bin/kafka-topics.sh --list --bootstrap-server localhost:9092
~/kafka/bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic first_topic
~/kafka/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first_topic
DevTest & Kafka Setup
<LISA_HOME>/lib/shared directory:
6. Create 4 topics -:
Two types of Kafka Recording can be done -:
Proxy Recorder
Click on VSE Recorder and put on the details as below. Make sure to select the Transport protocol as “Apache Kafka” and then click on next.
Select “Proxy Recorder” and give the topics names on the Proxy and live Request/ Response.
Click on next and we are ready to record the back-end service.
Now go to the workstation and run the Interactive Test Run (ITR) for “driver-proxy.tst”
Now check the Proxy recorder and you would see 5 request and 5 responses.
Click next and add data protocol as XML Data Protocol and then click next and Finish.
We now successfully recorded the service which interacted with Kafka topics like Input and Output. Model file created named RecordProxy-04.vsm.
Deploy the RecordProxy-04.vms to the VSE
Check in the portal if the service got deployed.
Now run the ITR on driver-proxy.tst to check if the RecordProxy-04 service gets the traffic or not.
So now all the traffic of the test goes to the virtual service instead of live service.
Topic Recorder
Let the Topic Recorder selected and give the Consume Topic as Input and Send Topic as Output.
Service is ready to be recorded.
Run the ITR on “driver.tst”
Add the Data protocol as XML Data Protocol and click on next and finish.
Model file RecordTopic-04.vsm got created. Deploy it on the VSE.
Check for the service deployment on the Devtest portal. Note the transaction count in RecordTopic-04 is 0 and actual service i.e. kafka-demo-service is 20.
So in order to avoid confusion as now both live and virtual service is consuming from same topic , it is good idea to stop the actual kafka-demo-service.
Now run ITR on driver.tst and check the transaction count of the RecordTopic-04 virtual service.
You can see that now the transaction is going to the virtual service instead of live service