In Java you need to provide an ExtensionRegistry to the parse method

Something like:

ExtensionRegistry registry = ExtensionRegistry.newInstance();
Test.registerAllExtensions(registry);

Test.BsgRequest req = Test.BsgRequest.parseFrom(payload, registry);

On Thu, Dec 3, 2009 at 8:01 AM, Michael Laccetti <[email protected]
> wrote:

> I'm trying to use PB as a means to send data from a C++ system to a
> Java-based ESB with BEEP as the underlying transport.  For now, I'm
> using a test Java client to inject messages, just to ensure that the
> ESB is both listening and capable of processing the inbound messages.
> I've validated that my messages are coming through, which is
> wonderful.  However, the extensions aren't working properly - on the
> receiving end, the object has the extension set as unknown fields.
>
> Here's the proto file I'm using (test.proto):
>
> package crypto.esb.messaging.gpb;
>
> message BsgRequest {
>        extensions 1000 to 5000;
> }
>
> extend BsgRequest {
>        optional int32 the_num = 1000;
> }
>
> The sender creates a message like this:
> Test.BsgRequest req = Test.BsgRequest.newBuilder().setExtension
> (Test.theNum, 5).build();
> req.writeTo(builder.getOutputStream());
>
> The receiver processes the inbound message as follows (payload is a
> byte[]):
> Test.BsgRequest req = Test.BsgRequest.newBuilder().mergeFrom
> (payload).build();
>
> Any thoughts/suggestions?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<protobuf%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.


Reply via email to