Infrastructure for creating CQRS applications.
Release Changelog (since 1.2.1...2.0.0
)
README.md
(@peter-gribanov)call_user_func()
function (@peter-gribanov)assert*()
method in tests (@peter-gribanov)will*
methods (@peter-gribanov)$this->exactly(1)
to $this->once()
(@peter-gribanov)[PR] #23
Release Changelog (since 1.2.0...1.2.1
)
Changelog (since 1.1.0...1.2.0
)
Created a separate serializer service for add opportunity change the implementation of serializer.
interface Serializer
{
public function serialize($data);
public function deserialize($data);
}
Before:
$predis = new Client('tcp://10.0.0.1:6379'); // Predis client
$pubsub_predis = new RedisPubSubAdapter($predis); // Predis PubSub adapter
$serializer = new Serializer(); // Symfony serializer
$logger = new Logger(); // PSR-3 logger
$queue_name = 'article_queue';
$format = 'json'; // default: predis
$queue = new PredisPullCommandQueue($predis, $serializer, $logger, $queue_name, $format);
$queue = new PredisUniquePullCommandQueue($predis, $serializer, $logger, $queue_name, $format);
$queue = new PredisCommandQueue($pubsub_predis, $serializer, $logger, $queue_name, $format);
After:
$predis = new Client('tcp://10.0.0.1:6379'); // Predis client
$pubsub_predis = new RedisPubSubAdapter($predis); // Predis PubSub adapter
$symfony_serializer = new Serializer(); // Symfony serializer
$logger = new Logger(); // PSR-3 logger
$queue_name = 'article_queue';
$format = 'json'; // default: predis
// you can create another implementation of serializer
$serializer = new SymfonySerializer($symfony_serializer, $format);
$queue = new PredisPullCommandQueue($predis, $serializer, $logger, $queue_name);
$queue = new PredisUniquePullCommandQueue($predis, $serializer, $logger, $queue_name);
$queue = new PredisCommandQueue($pubsub_predis, $serializer, $logger, $queue_name);
Added opportunity to use several handlers in subscribe queue.
Before:
$queue = new ExecutingSubscribeCommandQueue();
$queue->subscribe(function (Command $command) {
// do something
});
// this handler override the previous handler
$queue->subscribe(function (Command $command) {
// do something else
});
After:
$queue = new ExecutingSubscribeCommandQueue();
$queue->subscribe(function (Command $command) {
// do something
});
// both handlers will be called
$queue->subscribe(function (Command $command) {
// do something else
});
Added opportunity to unsubscribe of the queue.
interface SubscribeCommandQueue
{
public function subscribe(callable $handler);
public function unsubscribe(callable $handler);
}
$queue = new ExecutingSubscribeCommandQueue();
$handler = function (Command $command) {
// do something
};
$queue->subscribe($handler);
$queue->unsubscribe($handler);
Changelog (since 1.0.0...1.1.0
)
interface CommandQueue
{
public function publish(Command $command);
}
Before:
$queue->push($command);
After:
$queue->publish($command);
GpsLab\Component\Command\Queue\PubSub
renamed to GpsLab\Component\Command\Queue\Subscribe
.GpsLab\Component\Command\Queue\PullPush
renamed to GpsLab\Component\Command\Queue\Pull
.GpsLab\Component\Tests\Command\Queue\PubSub
renamed to GpsLab\Component\Command\Queue\Subscribe
.GpsLab\Component\Tests\Command\Queue\PullPush
renamed to GpsLab\Component\Command\Queue\Pull
.GpsLab\Component\Command\Queue\PubSub\CommandQueue
renamed to GpsLab\Component\Command\Queue\Subscribe\SubscribeCommandQueue
.GpsLab\Component\Command\Queue\PullPush\CommandQueue
renamed to GpsLab\Component\Command\Queue\Pull\PullCommandQueue
.GpsLab\Component\Command\Queue\PubSub\ExecutingCommandQueue
renamed to GpsLab\Component\Command\Queue\Subscribe\ExecutingSubscribeCommandQueue
.GpsLab\Component\Command\Queue\PubSub\PredisCommandQueue
renamed to GpsLab\Component\Command\Queue\Subscribe\PredisSubscribeCommandQueue
.GpsLab\Component\Command\Queue\PullPush\MemoryCommandQueue
renamed to GpsLab\Component\Command\Queue\Pull\MemoryPullCommandQueue
.GpsLab\Component\Command\Queue\PullPush\MemoryUniqueCommandQueue
renamed to GpsLab\Component\Command\Queue\Pull\MemoryUniquePullCommandQueue
.GpsLab\Component\Command\Queue\PullPush\PredisCommandQueue
renamed to GpsLab\Component\Command\Queue\Pull\PredisPullCommandQueue
.GpsLab\Component\Command\Queue\PullPush\PredisUniqueCommandQueue
renamed to GpsLab\Component\Command\Queue\Pull\PredisUniquePullCommandQueue
.GpsLab\Component\Tests\Command\Queue\PubSub\ExecutingCommandQueueTest
renamed to GpsLab\Component\Command\Queue\Subscribe\ExecutingSubscribeCommandQueueTest
.GpsLab\Component\Tests\Command\Queue\PubSub\PredisCommandQueueTest
renamed to GpsLab\Component\Command\Queue\Subscribe\PredisSubscribeCommandQueueTest
.GpsLab\Component\Tests\Command\Queue\PullPush\MemoryCommandQueueTest
renamed to GpsLab\Component\Command\Queue\Pull\MemoryPullCommandQueueTest
.GpsLab\Component\Tests\Command\Queue\PullPush\MemoryUniqueCommandQueueTest
renamed to GpsLab\Component\Command\Queue\Pull\MemoryUniquePullCommandQueueTest
.GpsLab\Component\Tests\Command\Queue\PullPush\PredisCommandQueueTest
renamed to GpsLab\Component\Command\Queue\Pull\PredisPullCommandQueueTest
.GpsLab\Component\Tests\Command\Queue\PullPush\PredisUniqueCommandQueueTest
renamed to GpsLab\Component\Command\Queue\Pull\PredisUniquePullCommandQueueTest
.GpsLab\Component\Command\Queue\PullPush\MemoryCommandQueue::push()
renamed to GpsLab\Component\Command\Queue\Pull\MemoryPullCommandQueue::publish()
.GpsLab\Component\Command\Queue\PullPush\MemoryUniqueCommandQueue::push()
renamed to GpsLab\Component\Command\Queue\Pull\MemoryUniquePullCommandQueue::publish()
.GpsLab\Component\Command\Queue\PullPush\PredisCommandQueue::push()
renamed to GpsLab\Component\Command\Queue\Pull\PredisPullCommandQueue::publish()
.GpsLab\Component\Command\Queue\PullPush\PredisUniqueCommandQueue::push()
renamed to GpsLab\Component\Command\Queue\Pull\PredisUniquePullCommandQueue::publish()
.