Skip to content

Instantly share code, notes, and snippets.

@fordnox
Created April 14, 2012 14:19
Show Gist options
  • Save fordnox/2384701 to your computer and use it in GitHub Desktop.
Save fordnox/2384701 to your computer and use it in GitHub Desktop.
Uploader message executor file
<?php
/*
* This file is part of Queue Manager.
*
* (c) 2011 SparkleBit <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace QueueExample;
use Queue\Message;
/**
* An example message with error
*
* Acts as an example message. It can be safely removed or replaced.
*
* @author SparkleBit <[email protected]>
*/
class Uploader extends Message
{
/**
* This Message purpose is to throw an Exception
*
* @return bool
*/
public function execute()
{
$file = $this->file_path; // file path which needs to uploaded
//upload to service logic goes here
}
}
@fordnox
Copy link
Author

fordnox commented Apr 14, 2012

Add message to the queue:

// your upload logic to store file on your server
$file_path = '/home/user/data/file.zip';
$data = array(
    'file_path' => $file_path,
);
$m = new \Queue\Message\Uploader($data);
$q = new \Queue\Queue();
$q->send($m);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment