Giter Club home page Giter Club logo

Comments (11)

enumag avatar enumag commented on September 20, 2024 1

It's not so easy. The thing is there are two uuid formats out there using different byte order. EventStore is internally using the less common one - usually referred to as guid (thank microsoft) while the libraries you mentioned are all using the common uuid byte order. We used ramsey/uuid because it does support the guid format. The only issue is that they accidentally broke this feature in v4. So you can't simply replace it with any other random uuid library since most don't support guids. It would be best to fix it in ramsey/uuid. We'll be happy to allow v4 when it's fixed.

https://stackoverflow.com/questions/48659919/convert-a-uuid-into-a-guid-and-vice-versa

from event-store-client.

prolic avatar prolic commented on September 20, 2024

from event-store-client.

majidalaeinia avatar majidalaeinia commented on September 20, 2024

I am running this code now from the examples, and still get the same error:

    public function test()
    {
        Loop::run(function () {
            $settings = ConnectionSettings::create()
                                          ->setClusterDns('0.0.0.0')
                                          ->setClusterGossipPort(2113)
                                          ->build();

            $connection = EventStoreConnectionFactory::createFromSettings(
                $settings,
                'dns-cluster-connection'
            );

            $connection->onConnected(function (): void {
                echo 'connected' . PHP_EOL;
            });

            $connection->onClosed(function (): void {
                echo 'connection closed' . PHP_EOL;
            });

            yield $connection->connectAsync();

            $slice = yield $connection->readStreamEventsForwardAsync(
                'foo-bar',
                10,
                2,
                true
            );

            \var_dump($slice);

            $slice = yield $connection->readStreamEventsBackwardAsync(
                'foo-bar',
                10,
                2,
                true
            );

            \var_dump($slice);

            $event = yield $connection->readEventAsync('foo-bar', 2, true);

            \var_dump($event);

            $m = yield $connection->getStreamMetadataAsync('foo-bar');

            \var_dump($m);

            $r = yield $connection->setStreamMetadataAsync('foo-bar', ExpectedVersion::ANY, new StreamMetadata(
                null, null, null, null, null, [
                    'foo' => 'bar',
                ]
            ));

            \var_dump($r);

            $m = yield $connection->getStreamMetadataAsync('foo-bar');

            \var_dump($m);

            $wr = yield $connection->appendToStreamAsync('foo-bar', ExpectedVersion::ANY, [
                new EventData(EventId::generate(), 'test-type', false, 'jfkhksdfhsds', 'meta'),
                new EventData(EventId::generate(), 'test-type2', false, 'kldjfls', 'meta'),
                new EventData(EventId::generate(), 'test-type3', false, 'aaa', 'meta'),
                new EventData(EventId::generate(), 'test-type4', false, 'bbb', 'meta'),
            ]);

            \var_dump($wr);

            $ae = yield $connection->readAllEventsForwardAsync(Position::start(), 2, false, new UserCredentials(
                'admin',
                'changeit'
            ));

            \var_dump($ae);

            $aeb = yield $connection->readAllEventsBackwardAsync(Position::end(), 2, false, new UserCredentials(
                'admin',
                'changeit'
            ));

            \var_dump($aeb);

            $connection->close();
        });
    }

What's wrong with my code and configuration, I have tried it with different configurations and none of them seems working for me.

from event-store-client.

prolic avatar prolic commented on September 20, 2024

from event-store-client.

majidalaeinia avatar majidalaeinia commented on September 20, 2024

Now I get this error:

Ramsey\Uuid\Exception\UnableToBuildUuidException
The byte string received does not contain a valid version

I have to mention that I have forked your repository and used version ^4.2.0 for the ramsey/uuid package. Seems this is the reason you do not update that package! I think I have to fork that package too!

from event-store-client.

prolic avatar prolic commented on September 20, 2024

from event-store-client.

majidalaeinia avatar majidalaeinia commented on September 20, 2024

Ramsey v3 is not compatible with Laravel 8. I would be happy if those two were compatible and that's why I forked the project to be able to install the package.

from event-store-client.

enumag avatar enumag commented on September 20, 2024

Well I told you clearly that ramsey v4 is bugged. The error you see is exactly the problem why we can't use it. We didn't disallow it on a whim. 🙂

from event-store-client.

majidalaeinia avatar majidalaeinia commented on September 20, 2024

I know (and thanks), but I needed to make it work with Laravel 8 and it seemed the only way at that time. Any plan to replace the ramsey/uuid package with another uuid package? This seems the only way left to make this package compatible with the Laravel 8.

from event-store-client.

enumag avatar enumag commented on September 20, 2024

I'm leaning towards "no" but if you have a specific package in mind, we can have a look.

from event-store-client.

majidalaeinia avatar majidalaeinia commented on September 20, 2024

Well there are many packages, but I don't know if they are able to be replaced with it.
For example this one: https://laravel.com/docs/8.x/helpers#method-str-uuid
or this one: https://github.com/webpatser/laravel-uuid

And I have used this one already in some projects: https://github.com/binarycabin/laravel-uuid/blob/b78fe0226a767c5ef3ef077ed521c4f4f30a1e10/src/Traits/HasUUID.php#L26

Maybe if you give me a clue on where to start, I will be able to make a pull request for changing it!

from event-store-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.