Page MenuHomeDevCentral

No OneTemporary

diff --git a/app/Jobs/SendMessageToBroker.php b/app/Jobs/SendMessageToBroker.php
index 67ca799..7419558 100644
--- a/app/Jobs/SendMessageToBroker.php
+++ b/app/Jobs/SendMessageToBroker.php
@@ -1,106 +1,106 @@
<?php
namespace Nasqueron\Notifications\Jobs;
use Nasqueron\Notifications\Actions\ActionError;
use Nasqueron\Notifications\Actions\AMQPAction;
use Nasqueron\Notifications\Events\ReportEvent;
use Nasqueron\Notifications\Jobs\Job;
use Broker;
use Event;
class SendMessageToBroker extends Job {
///
/// 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 = '';
/**
* If not null, an exception thrown during the task
*
* @var \Exception
*/
private $exception;
///
/// Constructor
///
/**
* Create a new job instance.
*
* @param string $routingKey the routing key, for topic exchange
* @param string $message the message to send
*
* @return void
*/
public function __construct ($target, $routingKey, $message) {
$this->target = $target;
$this->routingKey = $routingKey;
$this->message = $message;
}
///
/// Task
///
/**
* Executes the job.
*
* @return void
*/
public function handle() {
$this->sendMessage();
$this->report();
}
/**
* Sends the message to the broker
*/
protected function sendMessage () {
try {
- Broker::setExchangeTarget($this->target)
+ Broker::setExchangeTarget($this->target, "topic", true)
->routeTo($this->routingKey)
->sendMessage($this->message);
} catch (\Exception $ex) {
$this->exception = $ex;
}
}
/**
* Prepares a report and fires a report event
*/
protected function report () {
$actionToReport = new AMQPAction(
"publish",
$this->target,
$this->routingKey
);
if ($this->exception !== null) {
$actionToReport->attachError(new ActionError($this->exception));
}
Event::fire(new ReportEvent($actionToReport));
}
}
diff --git a/composer.json b/composer.json
index 92422bb..ed4517e 100644
--- a/composer.json
+++ b/composer.json
@@ -1,65 +1,65 @@
{
"name": "nasqueron/notifications",
"description": "Nasqueron notifications center",
"keywords": [
"nasqueron",
"activemq",
"AMQP",
"notifications"
],
"license": "BSD-2-Clause",
"type": "project",
"require": {
"php": ">=5.6.0",
"laravel/framework": "5.2.*",
"keruald/github": ">=0.2.0",
- "keruald/broker": ">=0.3.3",
+ "keruald/broker": ">=0.4.0",
"netresearch/jsonmapper": "~0.1.0",
"raven/raven": "^0.13.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpmd/phpmd" : "@stable",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"squizlabs/php_codesniffer": "2.*",
"symfony/css-selector": "~3.0",
"symfony/dom-crawler": "~3.0"
},
"autoload": {
"psr-4": {
"Nasqueron\\Notifications\\": "app/",
"Nasqueron\\Notifications\\Tests\\": "tests/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"phpmd": [
"vendor/bin/phpmd app/ xml ruleset.xml"
],
"test": [
"phpunit --no-coverage"
]
},
"config": {
"preferred-install": "dist"
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 07:47 (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259770
Default Alt Text
(4 KB)

Event Timeline