AD0-E716 · Question #47
A message queue currently has queue/consumer-wait-for-messages set to true, which allows the consumer process to run until a message is inserted into the queue. A piece of functionality is driven by…
The correct answer is B. Call the function. The developer can use the plugin to trigger the consumer restart by calling the function \Magento\Framework\MessageQueue\Consumers\TriggerRe5tartInterface:trigger(). This function will write a flag to the cache storage that will be checked by the consumer process. If the flag…
Question
A message queue currently has queue/consumer-wait-for-messages set to true, which allows the consumer process to run until a message is inserted into the queue. A piece of functionality is driven by data stored in the model \Magento\variable\Model\variable and this value is only loaded once during the consumer run. If the variable is updated we want the consumer to restart so that the new value is loaded into memory without having to reload the variable on each message consumed. The Adobe Commerce developer has created an after plugin on the \Magento\Variable\Model\variable:: save() function. How would the developer use the plugin to trigger the consumer restart?
Options
- ACall the function \Magento\Framework\MessageQueue\PoisonPill\Poi5onPillPutInterface::put().
- BCall the function
- CSet the global Cache key trigger_consumer_restart t0 1.
How the community answered
(45 responses)- A16% (7)
- B56% (25)
- C29% (13)
Explanation
The developer can use the plugin to trigger the consumer restart by calling the function \Magento\Framework\MessageQueue\Consumers\TriggerRe5tartInterface:trigger(). This function will write a flag to the cache storage that will be checked by the consumer process. If the flag is set, the consumer process will terminate itself and restart with the updated configuration. Verified
Topics
Community Discussion
No community discussion yet for this question.