/** * @param string $name the name of the job to run * @param array $params the parameters to pass to the job * @param array $options the options to use when running the job */ public function push($name, array $params = [], array $options = []) { $this->getJobOptionsValidator()->validateJobOptions($options); if (!empty($options['run_after'])) { $options['run_after'] = $options['run_after']->format('c'); } $this->producer_q->push(['name' => $name, 'params' => $params, 'options' => $options, 'meta' => ['buffered_at' => gmdate('c'), 'buffered_from' => gethostname()]]); }
/** * @covers ::__construct * @covers ::push */ public function testMessageCanBeProduced() { $expected_value = "hi there, " . uniqid(); $pusher = function ($message) use($expected_value) { $this->assertSame($expected_value, $message); }; $producer_queue = new ProducerQueue($pusher); $producer_queue->push($expected_value); }
/** * @param string $name the name of the job to run * @param array $params the parameters to pass to the job * @param array $meta meta-information about the job */ public function push($name, array $params = [], array $meta = []) { $this->producer_q->push(['name' => $name, 'params' => $params, 'meta' => $meta]); }