Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11708278
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/app/Jobs/SendMessageToBroker.php b/app/Jobs/SendMessageToBroker.php
index b233fc0..d1ca104 100644
--- a/app/Jobs/SendMessageToBroker.php
+++ b/app/Jobs/SendMessageToBroker.php
@@ -1,49 +1,75 @@
<?php
namespace Nasqueron\Notifications\Jobs;
use Illuminate\Contracts\Bus\SelfHandling;
use Nasqueron\Notifications\Jobs\Job;
use Broker;
class SendMessageToBroker extends Job implements SelfHandling {
+ ///
+ /// Private members
+ ///
+
/**
* The routing key, for topic exchange
*
* @var string
*/
private $routingKey = '';
/**
* The message to send
*
* @var string
*/
private $message = '';
+ /**
+ * The target exchange
+ *
+ * @var string
+ */
+ private $target = 'github_events';
+
+ ///
+ /// Constructor
+ ///
+
/**
* Create a new job instance.
*
* @param $routingKey the routing key, for topic exchange
* @param $message the message to send
*
* @return void
*/
public function __construct ($routingKey, $message) {
$this->routingKey = $routingKey;
$this->message = $message;
}
+ ///
+ /// Task
+ ///
+
/**
* Executes the job.
*
* @return void
*/
public function handle() {
- Broker::setExchangeTarget("github_events")
+ $this->sendMessage();
+ }
+
+ /**
+ * Sends the message to the broker
+ */
+ protected function sendMessage () {
+ Broker::setExchangeTarget($this->target)
->routeTo($this->routingKey)
->sendMessage($this->message);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Sep 15, 05:37 (5 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2983771
Default Alt Text
(1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment