Skip to content

Conversation

@ukautz
Copy link
Member

@ukautz ukautz commented Aug 1, 2013

As discussed. See example below for shortest code with this builder draft.

/*** CONSUMER EXAMPLE ***/

use Bernard\Builder;
use Bernard\Driver\IronMqDriver;

$builder  = new Builder(new IronMqDriver(new IronMq(/* .. */)));
$queues   = $builder->getQueueFactory();
$consumer = $builder->createConsumer(array('SendMail', new WorkerService));
$consumer->consume($queues->create('mails'));


/*** PRODUCER EXAMPLE ***/

use Bernard\Builder;
use Bernard\Driver\IronMqDriver;
use Bernard\Driver\DefaultMessage;

$builder  = new Builder(new IronMqDriver(new IronMq(/* .. */)));
$producer = $builder->createProducer();
$producer->produce(new DefaultMessage('SendMail', array('foo' => 'bar')));

@henrikbjorn
Copy link
Contributor

Have thought about this a lot. and i like the idea of it but i cannot see a good way of implementing it. Bernard should aim to have bindings for most of the popular frameworks and that way be easy to use. All libraries i know have some sort of setup if used standalone.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants