Message Queue


Info

Short description The Message Queue provides services that enable developers to process messages asynchronously therefore messages that are plain PHP objects, are stacked on the queue whereas receivers, represented by MessageDriven beans, consumes them in a chronological order. Software developers are enabled to optimize a system for optimal resource utilization by prioritizing messages.
Availability since 1.0.0
Type Main Module
Dependencies Appserver.io Runtime, Appserver.io, Persistence Container
PSR https://github.com/appserver-io-psr/messagequeueprotocol


Functions

Features
  • Asynchronous processing of message objects
  • Uses MessageDriven beans to process messages
  • Possibility to priories messages and their execution
  • DI support to inject queue sender into all bean types and servlets
  • High performance and best usage of resources through independent thread for each message
  • Usage of standardized protocols like HTTP
  • Interface for integrating other protocols like STOMP

Use Case

Importing a huge number of products, e. g. into an online shop system can take some time using a single-threaded PHP environment. So if you have to import 100.000 products on a server with 4 CPU's each providing 8 cores, the import process will make, by default, use of exactly 1 of the 32 available cores. This will lead to an import time of approximately 14 hours, what in reality will be a huge problem. Using a Message-Queue can be a solution because it allows you to chunk the data, supposed 100 rows per chunk, and import them in separate threads by sending each to the queue. That can speed up the import process up to 0.5 hours in the best case.