GearmanEvents.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. /**
  3. * Gearman Bundle for Symfony2
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * Feel free to edit as you please, and have fun.
  9. *
  10. * @author Marc Morera <yuhu@mmoreram.com>
  11. */
  12. namespace Mmoreram\GearmanBundle;
  13. /**
  14. * Events dispatched by GearmanBundle
  15. *
  16. * @since 2.3.1
  17. */
  18. class GearmanEvents
  19. {
  20. /**
  21. * Sets the callback function to be used when a task is completed
  22. *
  23. * event.name : gearman.client.callback.complete
  24. * event.class : GearmanClientCallbackCompleteEvent
  25. *
  26. * @var string
  27. */
  28. const GEARMAN_CLIENT_CALLBACK_COMPLETE = 'gearman.client.callback.complete';
  29. /**
  30. * Sets the callback function to be used when a task does not complete
  31. * successfully
  32. *
  33. * event.name : gearman.client.callback.fail
  34. * event.class : GearmanClientCallbackFailEvent
  35. *
  36. * @var string
  37. */
  38. const GEARMAN_CLIENT_CALLBACK_FAIL = 'gearman.client.callback.fail';
  39. /**
  40. * Sets the callback function for accepting data packets for a task
  41. *
  42. * event.name : gearman.client.callback.data
  43. * event.class : GearmanClientCallbackDataEvent
  44. *
  45. * @var string
  46. */
  47. const GEARMAN_CLIENT_CALLBACK_DATA = 'gearman.client.callback.data';
  48. /**
  49. * Sets a function to be called when a task is received and queued by the
  50. * Gearman job server
  51. *
  52. * event.name : gearman.client.callback.created
  53. * event.class : GearmanClientCallbackCreatedEvent
  54. *
  55. * @var string
  56. */
  57. const GEARMAN_CLIENT_CALLBACK_CREATED = 'gearman.client.callback.created';
  58. /**
  59. * Specifies a function to call when a worker for a task sends an exception
  60. *
  61. * event.name : gearman.client.callback.exception
  62. * event.class : GearmanClientCallbackExceptionEvent
  63. *
  64. * @var string
  65. */
  66. const GEARMAN_CLIENT_CALLBACK_EXCEPTION = 'gearman.client.callback.exception';
  67. /**
  68. * Sets a callback function used for getting updated status information from
  69. * a worker
  70. *
  71. * event.name : gearman.client.callback.status
  72. * event.class : GearmanClientCallbackStatusEvent
  73. *
  74. * @var string
  75. */
  76. const GEARMAN_CLIENT_CALLBACK_STATUS = 'gearman.client.callback.status';
  77. /**
  78. * Sets a function to be called when a worker sends a warning
  79. *
  80. * event.name : gearman.client.callback.warning
  81. * event.class : GearmanClientCallbackWarningEvent
  82. *
  83. * @var string
  84. */
  85. const GEARMAN_CLIENT_CALLBACK_WARNING = 'gearman.client.callback.warning';
  86. /**
  87. * Sets a function to be called when a worker needs to send back data prior
  88. * to job completion.
  89. *
  90. * A worker can do this when it needs to send updates, send partial results,
  91. * or flush data during long running jobs
  92. *
  93. * event.name : gearman.client.callback.workload
  94. * event.class : GearmanClientCallbackWorkloadEvent
  95. *
  96. * @var string
  97. */
  98. const GEARMAN_CLIENT_CALLBACK_WORKLOAD = 'gearman.client.callback.workload';
  99. /**
  100. * Sets a function to be called when a worker has completed a job.
  101. *
  102. * This will be fired by the worker after completion of a job before preparing to start another work cycle.
  103. *
  104. * @var string
  105. */
  106. const GEARMAN_WORK_EXECUTED = 'gearman.work.executed';
  107. /**
  108. * Sets a function to be called when a worker is starting a job.
  109. *
  110. * This will be fired when the worker start another work cycle.
  111. *
  112. * @var string
  113. */
  114. const GEARMAN_WORK_STARTING = 'gearman.work.starting';
  115. }