croservices / cro-core

The heart of the Cro library for building distributed systems in Raku, including pipeline composition and TCP support.
https://cro.services/
Artistic License 2.0
27 stars 9 forks source link

Cro::Connector suggests message-oriented protocols (?) #12

Open Altai-man opened 5 years ago

Altai-man commented 5 years ago

Right now, when you write a client, Cro::Connector makes a connection for you to a remote host and emits socket -> transform -> socket pipelines to work with.

However, from what I can understand, result of the connect is async - there is no way to receive a result of a connection before e.g. first message is sent, is there?

As LDAP is oriented on connection, not a message, I am looking for:

But from how establish method is implemented(https://github.com/croservices/cro-core/blob/master/lib/Cro/Connector.pm6#L9), I see no ways to do that. Any ideas?

What I am doing now is https://github.com/Altai-man/cro-ldap/blob/master/lib/Cro/LDAP/Client.pm6#L157-L158 but the issue is that even with incorrect host/port pair, the exception indeed occurs in establish supply, but I can't reach it from the outside, it is just a Supply. (ignore the Promise.kept line, I know it will be always kept, the question is how to make get-pipeline to produce a sync exception).