marieai / marie-ai

Integrate AI-powered Document Analysis Pipelines
MIT License
60 stars 5 forks source link

Separate queues for response based on condition #69

Closed gregbugaj closed 1 year ago

gregbugaj commented 1 year ago

Different applications should have different response queues. Currently we have one shared 'extract' queue.

We need to have some kind of a condition in queue so that different subscribers will get different messages without having to set them.

Initial implementation could be based on Sender-selected Distribution or virtual hosts (vhost).

gregbugaj commented 1 year ago

This is done via API_KEY. Each request contains API_KEY and it able to be routed to a different queue.

Keys are in the format mau_ for Marie-AI App user-to-server tokens mas_ for Marie-AI App server-to-server tokens keys are of length 54 + 4(prefix) = 58, with a prefix of either mau or mas ^mau[a-zA-Z0-9]{54}$ or ^mas[a-zA-Z0-9]{54}$

    Sample keys :
      mas_0aPJ9Q9nUO1Ac1vJTfffXEXs9FyGLf9BzfYgZ_RaHm707wmbfHJNPQ
      mas_xw_rZMMvT3snDw7IUQAe6FB3iChESG8Nn8Ek6riarHYRPl85BlW4vA
      mau_0aPJ9Q9nUO1Ac1vJTfffXEXs9FyGLf9BzfYgZ_RaHm707wmbfHJNPQ
      mau_Gcp_GvCMrVVgp-BwGKLyELE3BaKtpmCrlwdIB-VWWWXwpm3k1CwVIg
      mas_XeuXeznfHd_n0qRqavWSu9EVD0OrcwnJwvl_NOz0ucBG5R3creEWmw