User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:devel:corebos_mqtm [2017/04/28 00:16]
joebordes
en:devel:corebos_mqtm [2020/12/13 14:08] (current)
joebordes [Task Manager]
Line 115: Line 115:
 Returns true if there is a message waiting on the given channel by the producer for the consumer. Returns true if there is a message waiting on the given channel by the producer for the consumer.
  
-=== Subscribe and Unsubscribe ===+==== Subscribe and Unsubscribe ​====
  
 Will register or unregister a listener on a channel for a producer and will define which task must be executed when a message arrives. This task can be defined in one of two ways: as a file name and a function or as a file name, a class name and a method. Will register or unregister a listener on a channel for a producer and will define which task must be executed when a message arrives. This task can be defined in one of two ways: as a file name and a function or as a file name, a class name and a method.
Line 127: Line 127:
 The default task manager in coreBOS is incredibly simple, consisting of an infinite loop that looks for messages on the queue for all subscribers​ and launches the defined task when one arrives. The default task manager in coreBOS is incredibly simple, consisting of an infinite loop that looks for messages on the queue for all subscribers​ and launches the defined task when one arrives.
  
-On every iteration of the loop it checks and expires messages accordingly.+The task manager is an independent process that must be launched or initiated manually with the "​run"​ command like this:
  
-This is implemented using the OSS [[https://​github.com/​shaneharter/​PHP-Daemon||PHP-Daemon]] project (thanks!!)+<​code>​ 
 +cd your_corebos_install_top_directory 
 +php include/​cbmqtm/​run.php -d 
 +</​code>​ 
 + 
 +This will run forever in an infinite loop that, on every iteration of the loop will check and expires messages accordingly. If a message must be delivered it will launch the indicated tasks for all subscribers so they can consume the messages. 
 + 
 +This is implemented using the OSS [[https://​github.com/​shaneharter/​PHP-Daemon|PHP-Daemon]] project (thanks!!)
  
 =====Examples and Ideas===== =====Examples and Ideas=====
Line 157: Line 164:
 Mass editing can be a very long running process. Sending a request to modify a couple of fields on 1000 records can take a long time. Currently, coreBOS sends this request and waits for the process to end. This can produce timeouts in the browser or, worse, on the webserver. Mass editing can be a very long running process. Sending a request to modify a couple of fields on 1000 records can take a long time. Currently, coreBOS sends this request and waits for the process to end. This can produce timeouts in the browser or, worse, on the webserver.
  
-So,the idea is to modify mass edit to send a message with the work to be done. Then the task manager will do the work in background so there is no timeout issues and no blocking in the browser. The background task will report its progress as messages on the queue which will be consumed by a browser process that reads the messages and informs of the progress on screen. This will probably be implemented using server side events and service workers.+So,the idea is to modify mass edit to send a message with the work to be done. Then the task manager will do the work in background so there is no timeout issues and no blocking in the browser. The background task will report its progress as messages on the queue which will be consumed by a browser process that reads the messages and informs of the progress on screen. This will probably be implemented using [[en:​devel:​corebos_sse|server side events]] and service workers.
  
 ====Logging==== ====Logging====
Line 167: Line 174:
 I would like to end this description with a quick comparison to the global view defined by Martin Fowler: I would like to end this description with a quick comparison to the global view defined by Martin Fowler:
  
-Image+{{ :​en:​devel:​mfmq.png |Martin Fowler'​s Message Queue}}
  
-The **channel** is the parameter definition on EA h of the calls as is the **message** itself.+The **Message Channel** and the **Message** itself ​are the parameters on each of the calls of each method.
  
-**Pipes, ​filtersrouter ​and translators** do not exist in the default implementation but they all could be easily created to push the message along the queue to it's destination.+**Pipes, ​FiltersRouters ​and Translators** do not exist in the default implementation but they all could be easily created ​as tasks to push the message along the queue to it's destination.
  
-The endpoint ​is simply the getmessage ​method.+The **Message Endpoint** ​is simply the getMessage ​method.
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>