Multiple chat conversation

Hi, How can I handle several clients chatting with the bot and not get either in a queue or mixing conversations? Scenario: having 4 or more persons chatting thru Telegram with the bot. I am using the weather bot as a trial

Also, how should I size the server to manage the simultaneous conversations

Rasa Core handles this out of the box

1 Like

@akelad, lets assume that all the 4 users requesting bot to trigger a function at a time in which will take 3+ minutes to execute for each request, how we can queue that requests so that my bot will be freed up to respond the simple 5th user query? is it already taken care by Rasa core or i need to include RabitMQ or Celery in my

if your custom action takes 3 minutes to execute then yes you may have to add some extra handling to that

@akelad Any code snippet available? do i need to add celery in ?

not really sure, i’m afraid this is up to you to decide how to implement

@akelad @erohmensing @ricwo

I have implemented asynchronous action task handler using redis and Celery setup in but with a challenge.

class Blackout(Action):
    def name(self):
        return 'action_blackout'
    def run(self, dispatcher, tracker, domain):	
        if tracker.get_slot("hostname") is None:
           db_or_hostname = tracker.get_slot("dbname")
            db_or_hostname = tracker.get_slot("hostname")

        usrid = slackitems(tracker)
        tgtname = db_or_hostname
        total_hours = tracker.get_slot("duration")
        comments = tracker.get_slot("blackout_comments")
        if tracker.get_slot("hostname") is None:
            argmnt = "database"
            argmnt = "host"
        final_msg = blackoutfn.delay(dispatcher,cxpassword,usrid,tgtname,total_hours,comments,argmnt)

With out sending dispatcher to celery blackoutfn function , bot can’t send message back to slack. But sending dispatcher to celery blackoutfn throwing up “kombu.exceptions.EncodeError: Object of type CollectingDispatcher is not JSON serializable”.

@celery.task(task_acks_late = True,worker_prefetch_multiplier = 1)	
def blackoutfn(dispatcher,cxpassword,usrid,tgtname,total_hours,comments,argmnt):
    checkpriv = BlackoutBackend(cxpassword,usrid,tgtname)
    validation = checkpriv.validate_target_privs()
    #dispatcher.utter_message("validation op")
    if validation != 0:

        msg = checkpriv.run_blackout(total_hours,comments,argmnt)

Any idea how to convert dispatcher into json serializable format?

Hi @vigneshp826,

I wouldn’t try serializing the Dispatcher but rather use External Action triggers to get the message back to the user. Does that make sense?

Oh yes, it worked. I directly reached the user through slack api call. Thanks @Tobias_Wochinger