You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@bookkeeper.apache.org by Dan Di Spaltro <da...@gmail.com> on 2011/06/17 18:22:01 UTC

Client in node.js

Hi,

I am trying to experiment around with a client for Hedwig in node.js.  Is
there a better doc for how to parse the protocol? Note: I am not familiar
with Netty at all.

*  it looks like there is a length framing?
*  Is every request the hedwig server get's PubSubRequest, or is there a
magic byte somewhere, that registers a handler.

These are just some questions I had after spending about 5 hrs looking at
the source and futzing with the build system.

hw.bash script is pretty hard to understand, btw.

-Dan

-- 
Dan Di Spaltro

Re: Client in node.js

Posted by Ivan Kelly <iv...@yahoo-inc.com>.
> It can be extended in actual c++, but it would require that I hook it 
> up to the libev, which might not be a bad idea.
I just checked, there are unofficial js generators for protobufs. The 
spec file is at 
bookkeeper-server/hedwig-protocol/src/main/protobuf/PubSubProtocol.proto

-Ivan

Re: Client in node.js

Posted by Dan Di Spaltro <da...@gmail.com>.
No worries, I totally get it, thanks for being responsive that really helps.

On Fri, Jun 17, 2011 at 9:33 AM, Ivan Kelly <iv...@yahoo-inc.com> wrote:

> On 17/06/2011 18:22, Dan Di Spaltro wrote:
>
>> Hi,
>>
>> I am trying to experiment around with a client for Hedwig in node.js.  Is
>> there a better doc for how to parse the protocol? Note: I am not familiar
>> with Netty at all.
>>
> Unfortunately there's very little doc yet. This is something we are aware
> that we really need to fix.
>
>
>> *  it looks like there is a length framing?
>> *  Is every request the hedwig server get's PubSubRequest, or is there a
>> magic byte somewhere, that registers a handler.
>>
> Yes, to both. Every request is <packetlength:int><payload:**PubSubRequest>
> and responses are similarly <packetlength:int><payload:**PubSubResponse>.
> PubSub{Request,Response} are generated by protobufs. Im not sure if there
> are JS bindings for that. Actually, there's already a c++ client, in
> bookkeeper/hedwig-client/main/**cpp/. Can node.js be extended in C?


It can be extended in actual c++, but it would require that I hook it up to
the libev, which might not be a bad idea.


>
>
>> These are just some questions I had after spending about 5 hrs looking at
>> the source and futzing with the build system.
>>
>> hw.bash script is pretty hard to understand, btw.
>>
> Yes, this is something else we need to fix. I'd prefer to get rid of
> hw.bash completely and replace it with a bin/hedwig which would allow you to
> start a server or a commandline client.
>

Again, not trying to complain just an fyi.


>
> -Ivan
>



-- 
Dan Di Spaltro

Re: Client in node.js

Posted by Ivan Kelly <iv...@yahoo-inc.com>.
On 17/06/2011 18:22, Dan Di Spaltro wrote:
> Hi,
>
> I am trying to experiment around with a client for Hedwig in node.js. 
>  Is there a better doc for how to parse the protocol? Note: I am not 
> familiar with Netty at all.
Unfortunately there's very little doc yet. This is something we are 
aware that we really need to fix.
>
> *  it looks like there is a length framing?
> *  Is every request the hedwig server get's PubSubRequest, or is there 
> a magic byte somewhere, that registers a handler.
Yes, to both. Every request is <packetlength:int><payload:PubSubRequest> 
and responses are similarly <packetlength:int><payload:PubSubResponse>. 
PubSub{Request,Response} are generated by protobufs. Im not sure if 
there are JS bindings for that. Actually, there's already a c++ client, 
in bookkeeper/hedwig-client/main/cpp/. Can node.js be extended in C?
>
> These are just some questions I had after spending about 5 hrs looking 
> at the source and futzing with the build system.
>
> hw.bash script is pretty hard to understand, btw.
Yes, this is something else we need to fix. I'd prefer to get rid of 
hw.bash completely and replace it with a bin/hedwig which would allow 
you to start a server or a commandline client.

-Ivan