X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=sample-services%2Fics-producer-consumer%2FREADME.md;fp=sample-services%2Fics-producer-consumer%2FREADME.md;h=1731c17272ff2368885343f8dc0333237f5d4290;hb=af9b38ae549e2d6a128a00e5d8b9f5f56fc32755;hp=0000000000000000000000000000000000000000;hpb=9ddce2b0e23655371aa311c94ce9605dcc74f74e;p=nonrtric.git diff --git a/sample-services/ics-producer-consumer/README.md b/sample-services/ics-producer-consumer/README.md new file mode 100644 index 00000000..1731c172 --- /dev/null +++ b/sample-services/ics-producer-consumer/README.md @@ -0,0 +1,102 @@ + +# Automatic +### Using Kafka with a Java Producer and Consumer + +Run the demo script +It will check prerequisites, build a consumer and producer, and run them with kafka and ICS. + +```shell +./start.sh +``` +Or run the other script to bring up RedPanda on port 8888 and NONRTRIC control panel UI on port 8181 + +```shell +./red.sh +``` + +For a faster execution you can add: + +--skip-build to skip creating the app jar and building the docker images + +--no-console to skip running RedPanda and NONRTRIC control panel + +```shell +./red.sh --skip-build --no-console +``` +# Manual +### Run Kafka in a container + +```shell +docker-compose up -d kafka-zkless +``` + +### Starting the REST application individually + +In a new terminal window: + +```shell +mvn spring-boot:run +``` + +### Starting a producer + +```shell +sh ./runproducer.sh +``` + +### Starting a Consumer + +```shell +sh ./runproducer.sh +``` + +## Reading the logs + +A sample of the output is as follows: + +``` +Demo Producer Docker logs + +2024-04-02 12:48:05 INFO c.d.p.p.SimpleProducer:141 - {"bootstrapServers":"kafka-zkless:9092","topic":"mytopic","source":"com.demo.producer.producer.SimpleProducer","message":"ygHwxXSIxW","key":"f8f1a7a7-a78e-4c7d-9b8d-108bb0cc9e2c"} +2024-04-02 12:48:06 INFO c.d.p.p.SimpleProducer:141 - {"bootstrapServers":"kafka-zkless:9092","topic":"mytopic","source":"com.demo.producer.producer.SimpleProducer","message":"KNIbP10zfN","key":"b058d00f-bbcd-4d2c-936b-6327847d4c2a"} +2024-04-02 12:48:07 INFO c.d.p.p.SimpleProducer:141 - {"bootstrapServers":"kafka-zkless:9092","topic":"mytopic","source":"com.demo.producer.producer.SimpleProducer","message":"V6fH1NkdeH","key":"ae1a83a3-d8a7-40c8-9d98-529230f8b585"} +2024-04-02 12:48:08 INFO c.d.p.p.SimpleProducer:141 - {"bootstrapServers":"kafka-zkless:9092","topic":"mytopic","source":"com.demo.producer.producer.SimpleProducer","message":"m76qvRFh6f","key":"abccde52-fa72-4fd4-99ab-5bc21514d825"} +2024-04-02 12:48:09 INFO c.d.p.p.SimpleProducer:141 - {"bootstrapServers":"kafka-zkless:9092","topic":"mytopic","source":"com.demo.producer.producer.SimpleProducer","message":"t7FJYnFr43","key":"0602239e-34e9-45a6-a04a-3c67b4c7d9e4"} + +++++++++++++++++++++++++++++++++++++++++++++++++++++ + +Demo Consumer Docker logs + +2024-04-02 12:48:05 INFO c.d.c.c.SimpleConsumer:158 - {"message":"Topic: mytopicMessage: ygHwxXSIxW"} +2024-04-02 12:48:06 INFO c.d.c.c.SimpleConsumer:158 - {"message":"Topic: mytopicMessage: KNIbP10zfN"} +2024-04-02 12:48:07 INFO c.d.c.c.SimpleConsumer:158 - {"message":"Topic: mytopicMessage: V6fH1NkdeH"} +2024-04-02 12:48:08 INFO c.d.c.c.SimpleConsumer:158 - {"message":"Topic: mytopicMessage: m76qvRFh6f"} +2024-04-02 12:48:09 INFO c.d.c.c.SimpleConsumer:158 - {"message":"Topic: mytopicMessage: t7FJYnFr43"} + +++++++++++++++++++++++++++++++++++++++++++++++++++++ + +ICS logs + +2024-04-02T12:48:05.615Z DEBUG 1 --- [or-http-epoll-2] o.o.i.c.r1producer.ProducerCallbacks : Job subscription 1 started OK 1 +2024-04-02T12:48:05.820Z DEBUG 1 --- [io-8083-exec-10] o.o.i.repository.InfoTypeSubscriptions : Added type status subscription 1 +``` + +The script will fail (exit 1) if there are anny ERRORS logged in the kafka-producer and kafka-consumer. \ No newline at end of file