Skip to content

Instantly share code, notes, and snippets.

@Misiur
Created April 11, 2014 14:43
Show Gist options
  • Save Misiur/10474572 to your computer and use it in GitHub Desktop.
Save Misiur/10474572 to your computer and use it in GitHub Desktop.
<?php
namespace Mailbroker\MailDetailsBundle\EventListener;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
use Mmoreram\GearmanBundle\Event\GearmanClientCallbackStatusEvent;
use Mmoreram\GearmanBundle\Event\GearmanClientCallbackCreatedEvent;
use Mmoreram\GearmanBundle\Event\GearmanClientCallbackCompleteEvent;
use GearmanJob;
/**
* Event listener for converter worker
*/
class ConverterEventListener
{
protected $logger;
/**
* Constructor
*
* @param LoggerInterface $logger
*/
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* Callback called when job returns status
*
* @param GearmanClientCallbackStatusEvent $e
*/
public function onStatus(GearmanClientCallbackStatusEvent $e)
{
$this->logger->err('STATUS: ' . var_export($e->getGearmanTask(), true));
}
/**
* Callback called when job is complete
*
* @param GearmanClientCallbackCompleteEvent $e
*/
public function onComplete(GearmanClientCallbackCompleteEvent $e)
{
$this->logger->err('COMFLETE: ' . var_export($e->getGearmanTask(), true));
}
/**
* Callback called when job is created
*
* @param GearmanClientCallbackCreatedEvent $e
*/
public function onCreated(GearmanClientCallbackCreatedEvent $e)
{
$this->logger->err('CREATED ' . var_export($e->getGearmanTask(), true));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment