First I used Rohan's
code, which did not work for two simultaneous requests because it globally shares the queue data.
Then I changed the code a bit. I initiate the CustomEventHandler object inside the request function, create a new queue for each user request, and collect the event from the CustomEventHandler object defined inside the request function.
But a new issue arrived. The llamaindex internal list event never got cleared. Now, I am getting old events, including new events, unless the server restarts.
In the attached screenshot you will notice that each event emits 5 times because I was asked 5 questions without restarting the server. Asking new questions will repeat each event for 6 times. That is my issue.
I have added the updated code file based on Rohan's implementation.