PHP code example of trainjunkies-packages / data-feeds-queue-subscriber
1. Go to this page and download the library: Download trainjunkies-packages/data-feeds-queue-subscriber library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
trainjunkies-packages / data-feeds-queue-subscriber example snippets
// ./trust-durable-example.php
use ThirdRailPackages\QueueSubscriber\NetworkRail\Topics;
use ThirdRailPackages\QueueSubscriber\Stomp\DurableSubscription;
use ThirdRailPackages\QueueSubscriber\Stomp\Message;
use ThirdRailPackages\QueueSubscriber\Stomp\StompClientFactory;
Best practice for durable subscriptions
return new DurableSubscription(
$client,
'my-nrod-production'
);
$subscription->consume(Topics\Trust::MOVEMENT_ALL, function(Message $message) {
echo PHP_EOL;
var_dump(json_decode($message->getBody(), true));
echo PHP_EOL;
});
} catch (\Exception $e) {
echo $e->getMessage() . PHP_EOL;
// Place sleep(X) here or implement exponential backoff
exit(1);
}
php scripts/network-rail/trust.php