Add a custom proxy only if you can't do what you want using Events hook system.
Two choices:
- Implement Pyrowman\PheanstalkBundle\Proxy\PheanstalkProxyInterface
- Extend Pyrowman\PheanstalkBundle\Proxy\PheanstalkProxy
<?php
namespace Acme\DemoBundle\Proxy;
use Pheanstalk\Structure\Workflow;
use Pyrowman\PheanstalkBundle\Proxy\PheanstalkProxy as PheanstalkProxyBase;
use Pheanstalk\PheanstalkInterface;
class PheanstalkProxy extends PheanstalkProxyBase
{
/**
* {@inheritDoc}
*/
public function put(Workflow $workflow)
{
//crazy job here
return parent::put($workflow);
}
}
?>
The injection of a dispatcher isn't mandatory. Don't inject it and the logger will be disabled.
<service id="acme.demo.pheanstalk.proxy" class="Acme\DemoBundle\Proxy\PheanstalkProxy">
<call method="setDispatcher">
<argument type="service" id="event_dispatcher" on-invalid="ignore"/>
</call>
</service>
# app/config/config.yml
pheanstalk:
pheanstalks:
foo_bar:
server: evqueue-2.domain.tld
default: true
proxy: acme.demo.pheanstalk.proxy