Gpslab Cqrs Versions Save

Infrastructure for creating CQRS applications.

v2.0.0

4 years ago

Release Changelog (since 1.2.1...2.0.0)

  • feature #22 Test with Symfony 3.4, 4.4, 5.0 (@peter-gribanov)
  • feature #21 Test failed deserialize (@peter-gribanov)
  • bug #20 PHPStan level 7 (@peter-gribanov)
  • feature #19 Use phar of Scrutinizer CI and PHP Coveralls (@peter-gribanov)
  • bug #18 Fix missing iterable value type for PHPStan (@peter-gribanov)
  • feature #17 Require PHPStan for Static Analysis PHP (@peter-gribanov)
  • feature #16 Copy simple usage docs in main README.md (@peter-gribanov)
  • bug #15 Update 2.0 from master (@peter-gribanov)
  • feature #12 Add Command and Query subscribers (@peter-gribanov)
  • bug #10 Copy rules from PHP CS Fixer to Style CI config (@peter-gribanov)
  • feature #9 Declare strict types (@peter-gribanov)
  • feature #8 Change PHP-CS-Fixer rules (@peter-gribanov)
  • bug #7 Not use a call_user_func() function (@peter-gribanov)
  • feature #6 Declare type hinting (@peter-gribanov)
  • bug #5 Optimize use assert*() method in tests (@peter-gribanov)
  • bug #4 Optimize use will* methods (@peter-gribanov)
  • bug #3 Change $this->exactly(1) to $this->once() (@peter-gribanov)
  • feature #2 Add PHP 7.4 version test (@peter279k)

[PR] #23

v1.2.1

4 years ago

Release Changelog (since 1.2.0...1.2.1)

  • bug #13 Test coverage only once (@peter-gribanov)
  • bug #11 Apply fixes from StyleCI (@peter-gribanov)
  • feature #1 Test enhancement (@peter279k)

v1.2.0

6 years ago

Changelog (since 1.1.0...1.2.0)

Command serialization

  • 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);
    

Subscribe queue

  • 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);
    

v1.1.0

6 years ago

Changelog (since 1.0.0...1.1.0)

  • Added a common interface of command queue and use it in Pull queues.
interface CommandQueue
{
    public function publish(Command $command);
}

Before:

$queue->push($command);

After:

$queue->publish($command);

Renamed namespaces

  • The GpsLab\Component\Command\Queue\PubSub renamed to GpsLab\Component\Command\Queue\Subscribe.
  • The GpsLab\Component\Command\Queue\PullPush renamed to GpsLab\Component\Command\Queue\Pull.
  • The GpsLab\Component\Tests\Command\Queue\PubSub renamed to GpsLab\Component\Command\Queue\Subscribe.
  • The GpsLab\Component\Tests\Command\Queue\PullPush renamed to GpsLab\Component\Command\Queue\Pull.

Renamed interfaces

  • The GpsLab\Component\Command\Queue\PubSub\CommandQueue renamed to GpsLab\Component\Command\Queue\Subscribe\SubscribeCommandQueue.
  • The GpsLab\Component\Command\Queue\PullPush\CommandQueue renamed to GpsLab\Component\Command\Queue\Pull\PullCommandQueue.

Renamed classes

  • The GpsLab\Component\Command\Queue\PubSub\ExecutingCommandQueue renamed to GpsLab\Component\Command\Queue\Subscribe\ExecutingSubscribeCommandQueue.
  • The GpsLab\Component\Command\Queue\PubSub\PredisCommandQueue renamed to GpsLab\Component\Command\Queue\Subscribe\PredisSubscribeCommandQueue.
  • The GpsLab\Component\Command\Queue\PullPush\MemoryCommandQueue renamed to GpsLab\Component\Command\Queue\Pull\MemoryPullCommandQueue.
  • The GpsLab\Component\Command\Queue\PullPush\MemoryUniqueCommandQueue renamed to GpsLab\Component\Command\Queue\Pull\MemoryUniquePullCommandQueue.
  • The GpsLab\Component\Command\Queue\PullPush\PredisCommandQueue renamed to GpsLab\Component\Command\Queue\Pull\PredisPullCommandQueue.
  • The GpsLab\Component\Command\Queue\PullPush\PredisUniqueCommandQueue renamed to GpsLab\Component\Command\Queue\Pull\PredisUniquePullCommandQueue.
  • The GpsLab\Component\Tests\Command\Queue\PubSub\ExecutingCommandQueueTest renamed to GpsLab\Component\Command\Queue\Subscribe\ExecutingSubscribeCommandQueueTest.
  • The GpsLab\Component\Tests\Command\Queue\PubSub\PredisCommandQueueTest renamed to GpsLab\Component\Command\Queue\Subscribe\PredisSubscribeCommandQueueTest.
  • The GpsLab\Component\Tests\Command\Queue\PullPush\MemoryCommandQueueTest renamed to GpsLab\Component\Command\Queue\Pull\MemoryPullCommandQueueTest.
  • The GpsLab\Component\Tests\Command\Queue\PullPush\MemoryUniqueCommandQueueTest renamed to GpsLab\Component\Command\Queue\Pull\MemoryUniquePullCommandQueueTest.
  • The GpsLab\Component\Tests\Command\Queue\PullPush\PredisCommandQueueTest renamed to GpsLab\Component\Command\Queue\Pull\PredisPullCommandQueueTest.
  • The GpsLab\Component\Tests\Command\Queue\PullPush\PredisUniqueCommandQueueTest renamed to GpsLab\Component\Command\Queue\Pull\PredisUniquePullCommandQueueTest.

Renamed methods

  • The GpsLab\Component\Command\Queue\PullPush\MemoryCommandQueue::push() renamed to GpsLab\Component\Command\Queue\Pull\MemoryPullCommandQueue::publish().
  • The GpsLab\Component\Command\Queue\PullPush\MemoryUniqueCommandQueue::push() renamed to GpsLab\Component\Command\Queue\Pull\MemoryUniquePullCommandQueue::publish().
  • The GpsLab\Component\Command\Queue\PullPush\PredisCommandQueue::push() renamed to GpsLab\Component\Command\Queue\Pull\PredisPullCommandQueue::publish().
  • The GpsLab\Component\Command\Queue\PullPush\PredisUniqueCommandQueue::push() renamed to GpsLab\Component\Command\Queue\Pull\PredisUniquePullCommandQueue::publish().

v1.0.0

6 years ago