Page MenuHomeDevCentral

D808.diff
No OneTemporary

D808.diff

diff --git a/app/Listeners/AMQPEventListener.php b/app/Listeners/AMQPEventListener.php
--- a/app/Listeners/AMQPEventListener.php
+++ b/app/Listeners/AMQPEventListener.php
@@ -2,73 +2,13 @@
namespace Nasqueron\Notifications\Listeners;
-use Nasqueron\Notifications\Events\GitHubPayloadEvent;
use Nasqueron\Notifications\Events\NotificationEvent;
-use Nasqueron\Notifications\Analyzers\GitHub\GitHubPayloadAnalyzer;
use Nasqueron\Notifications\Jobs\SendMessageToBroker;
use Nasqueron\Notifications\Notifications\Notification;
use Config;
class AMQPEventListener {
- ///
- /// GitHub events
- ///
-
- /**
- * Gets routing key, to allow consumers to select the topic they subscribe to.
- *
- * @param GitHubPayloadEvent $event the payload event
- */
- protected static function getGitHubEventRoutingKey (GitHubPayloadEvent $event) : string {
- $key = [
- strtolower($event->door),
- self::getGroup($event),
- $event->event
- ];
- return implode('.', $key);
- }
-
- protected static function getAnalyzer (GitHubPayloadEvent $event) : GitHubPayloadAnalyzer {
- return new GitHubPayloadAnalyzer(
- $event->door,
- $event->event,
- $event->payload
- );
- }
-
- /**
- * Gets the group for a specific payload
- *
- * @return string the group, central part of the routing key
- */
- protected static function getGroup (GitHubPayloadEvent $event) : string {
- $analyzer = self::getAnalyzer($event);
- return $analyzer->getGroup();
- }
-
- /**
- * Handles a GitHub payload event.
- *
- * @param GitHubPayloadEvent $event
- */
- public function onGitHubPayload(GitHubPayloadEvent $event) : void {
- $this->sendRawPayload($event);
- }
-
- /**
- * This is our gateway GitHub Webhooks -> Broker
- *
- * @param GitHubPayloadEvent $event
- */
- protected function sendRawPayload(GitHubPayloadEvent $event) : void {
- $target = Config::get('broker.targets.github_events');
- $routingKey = static::getGitHubEventRoutingKey($event);
- $message = json_encode($event->payload);
-
- $job = new SendMessageToBroker($target, $routingKey, $message);
- $job->handle();
- }
///
/// Notifications
@@ -127,10 +67,6 @@
public function subscribe (\Illuminate\Events\Dispatcher $events) : void {
$class = 'Nasqueron\Notifications\Listeners\AMQPEventListener';
$events->listen(
- 'Nasqueron\Notifications\Events\GitHubPayloadEvent',
- "$class@onGitHubPayload"
- );
- $events->listen(
'Nasqueron\Notifications\Events\NotificationEvent',
"$class@onNotification"
);

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 16:32 (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2232106
Default Alt Text
D808.diff (2 KB)

Event Timeline