Skip to content

Commit 577f020

Browse files
committed
missing methods for laravel 4.1
1 parent 645591c commit 577f020

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/FintechFab/LaravelQueueRabbitMQ/Queue/Jobs/RabbitMQJob.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ public function fire()
2828
$this->resolveAndFire(json_decode($this->envelope->getBody(), true));
2929
}
3030

31+
/**
32+
* Get the raw body string for the job.
33+
*
34+
* @return string
35+
*/
36+
public function getRawBody()
37+
{
38+
return $this->envelope->getBody();
39+
}
40+
3141
/**
3242
* Delete the job from the queue.
3343
*

src/FintechFab/LaravelQueueRabbitMQ/Queue/RabbitMQQueue.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,33 @@ public function push($job, $data = '', $queue = null)
6262
return $job;
6363
}
6464

65+
/**
66+
* Push a raw payload onto the queue.
67+
*
68+
* @param string $payload
69+
* @param string $queue
70+
* @param array $options
71+
*
72+
* @throws \AMQPException
73+
* @return mixed
74+
*/
75+
public function pushRaw($payload, $queue = null, array $options = array())
76+
{
77+
$queue = $this->declareQueue($queue);
78+
79+
// get queue
80+
$queue = $this->declareQueue($queue);
81+
82+
// push task to a queue
83+
$job = $this->exchange->publish($payload, $queue->getName());
84+
85+
if (!$job) {
86+
throw new AMQPException('Could not push job to a queue');
87+
}
88+
89+
return $job;
90+
}
91+
6592
/**
6693
* Push a new job onto the queue after a delay.
6794
*

0 commit comments

Comments
 (0)