3

I am using the library: https://github.com/davibennun/laravel-push-notification

I am trying to convert this (100% working) example:

Queue::push(function() {
    $push = PushNotification::app('SomeApp')
                    ->to('some_recipient')
                    ->send('Hello World, im a push message');
});

To something like this:

$push = PushNotification::app('SomeApp')
                ->to('some_recipient')
                ->queue('Hello World, im a push message'); // notice ->send is switched out to ->queue (like the Mail::queue method)

I have tried this:

In the App.php (facade for PushNotification) - see: https://github.com/davibennun/laravel-push-notification/tree/master/src/Davibennun/LaravelPushNotification.

public function queue($message, $options = array()) {

    Queue::push(function($job) use($message, $options) {
        $this->send($message, $options);

        $job->delete();
    });

    return $this;
}

Now, my method does not work if my queue provider is Iron - it, however, works perfectly if my queue is sync which is not so effective.

The first provided example works, but is not as pretty as the way I wish to accomplish the same thing.

FooBar
  • 5,752
  • 10
  • 44
  • 93
  • 1
    You probably need to release the queue. In you terminal try php artisan queue:listen (make sure this is the exact command). Also make sure you have iron dependency installed(iron-io/iron_mq) – Helder Lucas Jan 21 '15 at 22:39

0 Answers0