OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums OroCRM OroCRM – Programming Questions How to Use processes/Message Queues to trigger Process in Background Immediately

This topic contains 2 replies, has 2 voices, and was last updated by  shreyas 7 months, 2 weeks ago.

  • Creator
    Topic
  • #38655

    shreyas
    Participant

    Hi Team,

    I am involved in a task wherein as soon as User is created i will have to trigger a set of other processes which has to be taken care immediately as background process for which i am configuring in processes.yml . I tried the below code block where in i have configured supervisor(supervisor is working as expected for project as most tasks like mail , search indexes working) :

    when i try the process with above code snippet to trigger it will not trigger anytime , but if i comment the queued: true part from above code it will trigger immediately & works fine.The only issue with this approach is UI is frozen until the trigger has to complete. I am not much aware on how priority No. is taken to consideration . Is that Higher Priority i.e like priority: 100 will be given more preferences compared to other? i have tried changing priority also to around 100 but it behaves the same way as not triggering at all. i have tried even with time_shift property as well which defines that the trigger should start within defined no. of seconds but i am not able to get it working. Link for Reference used to refer: orocrm processes documentation

    I even tried with other way of using message queue but i found that there is no guarantee where in i found that a background job written under MQ will be triggered within a time span. Is there a option where in i can set in the given code reference (Message Queue Implementation Reference).

    Is there a way where in i can implement time consuming code to be run in background but on event trigger immediately being picked & started without any other job queues dependencies for it to delay/not process at all?

    Thanks & Regards,
    Shreyas S

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #38659
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    First, you must consider one more time, is it possible to postpone some part of this heavy task. Maybe you can do it only partially, but that will allow doing required things synchronously. This is the recommended option.

    You can increase chances to process the message in the desired time slot, by running more consumers. But you are right, there is no guaranty.

    In an Enterprise edition, there is a possibility to route some type of messages to a separate queue, so other heavy messages will not block the processing.
    When you’ll have a lot of messages in this queue, you can increase the number of consumers that works only on this separated queue. It still will not add 100% guarantee, because of the message queue architecture, but will increase chances a lot, that in most cases is enough.

    If above recommendations is not an option, you can take a looks at kernel.terminate event. But this method has a lot of disadvantages and not recommended.

    #38667

    shreyas
    Participant

    Thanks a lot Andrey for quick response.
    I will look at the guidance suggested by you.

    Thanks & Regards,
    Shreyas S

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No