FriendsOfOuro/geteventstore-php-core

HTTP Client Decoupling

Closed this issue · 4 comments

I would like to refactor to decouple Guzzle as a required dependency and introduce a HTTP client interface that can be switched out. In a high volume system I would rather use persistent sockets for example which will allow me to keep pace with the speed of EventStore. While testing I can maintain 1000 requests per second with persistent sockets but only 200-250 a second with Guzzle on the same machine.

This also makes it easier to test the EventStore class in isolation and allow for dependency injection.

I would be more than happy to write this change, just want to get feedback on what everyone thinks first.

interface EventStore\Http\Client

$client = new EventStore\Http\Guzzle($uri);
$es = new EventStore\EventStore(Client $client);

$client = new EventStore\Http\PersistentSockets($uri);
$es = new EventStore\EventStore(Client $client);

$client = new EventStore\Http\Curl($uri);
$es = new EventStore\EventStore(Client $client);

Hi Jim, I will have a better look at both #10 and this on it during next days

will discuss this after february 16th

sorry for postponing many times, but I'm busy with university in the spare time.

Can you please post an example with PersistentSockets?

What about waiting for PSR-7?