| @@ 43-53 (lines=11) @@ | ||
| 40 | * @param string $command |
|
| 41 | * @param OptionsInterface $options |
|
| 42 | */ |
|
| 43 | public function acknowledge($command, OptionsInterface $options) |
|
| 44 | { |
|
| 45 | array_map(function ($name) use ($options) { |
|
| 46 | $this->emitter->emit($name, $options); |
|
| 47 | }, [ |
|
| 48 | static::MESSAGE_ACKNOWLEDGE, |
|
| 49 | sprintf('%s.%s', static::MESSAGE_ACKNOWLEDGE, $command) |
|
| 50 | ]); |
|
| 51 | ||
| 52 | $this->logger->info(sprintf('`%s` job started', $command)); |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * Emits message finished events |
|
| @@ 61-71 (lines=11) @@ | ||
| 58 | * @param string $command |
|
| 59 | * @param OptionsInterface $options |
|
| 60 | */ |
|
| 61 | public function finish($command, OptionsInterface $options) |
|
| 62 | { |
|
| 63 | array_map(function ($name) use ($options) { |
|
| 64 | $this->emitter->emit($name, $options) ; |
|
| 65 | }, [ |
|
| 66 | static::MESSAGE_FINISH, |
|
| 67 | sprintf('%s.%s', static::MESSAGE_FINISH, $command) |
|
| 68 | ]); |
|
| 69 | ||
| 70 | $this->logger->info(sprintf('`%s` job finished', $command)); |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * Emits message rejection events |
|
| @@ 80-90 (lines=11) @@ | ||
| 77 | * @param OptionsInterface $options |
|
| 78 | * @param Exception $exception |
|
| 79 | */ |
|
| 80 | public function reject($command, OptionsInterface $options, Exception $exception) |
|
| 81 | { |
|
| 82 | array_map(function ($name) use ($options, $exception) { |
|
| 83 | $this->emitter->emit($name, $options, $exception); |
|
| 84 | }, [ |
|
| 85 | static::MESSAGE_REJECT, |
|
| 86 | sprintf('%s.%s', static::MESSAGE_REJECT, $command) |
|
| 87 | ]); |
|
| 88 | ||
| 89 | $this->logger->error((string) $exception); |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * Emits message shutdown events |
|
| @@ 97-107 (lines=11) @@ | ||
| 94 | * |
|
| 95 | * @param string $command |
|
| 96 | */ |
|
| 97 | public function shutdown($command) |
|
| 98 | { |
|
| 99 | array_map(function ($name) { |
|
| 100 | $this->emitter->emit($name) ; |
|
| 101 | }, [ |
|
| 102 | static::QUEUE_SHUTDOWN, |
|
| 103 | sprintf('%s.%s', static::QUEUE_SHUTDOWN, $command) |
|
| 104 | ]); |
|
| 105 | ||
| 106 | $this->logger->notice(sprintf('shutting down by request of `%s`', $command)); |
|
| 107 | } |
|
| 108 | } |
|
| 109 | ||