Last active
August 29, 2015 14:09
-
-
Save chanmix51/c4a0bfc9284138be0d25 to your computer and use it in GitHub Desktop.
Using the observer with Pomm 2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // observer.php | |
require __DIR__.'/vendor/autoload.php'; | |
use PommProject\Foundation\Pomm; | |
// Edit the dsn with your database settings and credentials | |
$pomm = new Pomm(['my_db' => ['dsn' => 'pgsql://greg/greg']]); | |
do { | |
do { | |
sleep(1); | |
$notification = $pomm['my_db'] | |
->getObserver('pika') | |
->getNotification() | |
; | |
} while ($notification === null); | |
printf("%s\n", $notification['payload']); | |
} while ($notification['payload'] !== 'stop'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment