I updated to the new capnp-rpc 0.8.1 with futures support and it works like
a charm with multiple services on the same port following your suggestion.
Migration was painless and it feels like the logic is much cleaner now :)
Awesome work :)
-Alex
Le mardi 3 janvier 2017 03:15:15 UTC+7, David Renshaw a écrit :
>
> Hi!
>
> One way to bind multiple capabilities to the same port with Cap'n Proto is
> to use a bootstrap interface with methods corresponding to each capability.
> For example, if you want to serve Foo and Bar capabilities on a single
> connection, you could define
>
> interface MyBootstrap {
> getFoo @0 () -> (foo: Foo);
> getBar @1 () -> (bar: Bar);
> }
>
> and then provide a MyBootstrap object as the bootstrap interface when
> constructing your RpcSystem. Due to promise pipelining, the calls to
> `getFoo()` and `getBar()` do not require an extra network roundtrip.
>
> If you want your Foo and Bar objects to perform work on separate threads,
> then things are more tricky, because gj does not have great support for
> cross-thread communication. The situation should improve when I release the
> next version of capnp-rpc-rust, which will use futures-rs rather than gj,
> and hence will be compatible with futures-cpupool
> <https://github.com/alexcrichton/futures-rs/tree/master/futures-cpupool>.
>
> - David
>
>
>
>
>
>
>
> On Mon, Dec 19, 2016 at 12:33 AM, <[email protected] <javascript:>>
> wrote:
>
>> Hi,
>>
>> I have multiple services and selectively send back references to nodes
>> joining a cluster depending on their role.
>>
>> At the moment, I'm using a dedicated EventLoop and thread for each
>> service.
>>
>> Coming from go/grpc which allows you to bind multiple services to the
>> same port, I wondered if capnproto RPC (gj/gjio) supports it?
>>
>> If not what is the preferred/recommended way to serve multiple services
>> using capnproto rpc with rust?
>>
>> Thanks!
>>
>> Cheers,
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Cap'n Proto" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> Visit this group at https://groups.google.com/group/capnproto.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.