[protobuf] field of type timestamp or date with protobuf message
HI all is it possible to add a field of type timestamp , or date, to a protobuf message.. i have quickly read the guide, and i saw no trace of timestamps or fields of type date. could anyone assist? w/kindest regards marco -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Error with Netty and extensions
Hi all i am trying to use extensions with protobuf and Netty here's my proto file package tutorial; option java_package = com.example.messages; option java_outer_classname = MessageProtos; option optimize_for = LITE_RUNTIME; enum MessageType { TEST = 0; DEBUG = 1; DO_TASK = 2; SPECIAL = 3; } message Message { required string content = 1; required MessageType type = 2; extensions 3 to 99; } extend Message { optional string enhancedContent = 3; optional Share share = 4; optional int32 bar = 5; } message Share { required string ticker = 10; required string company = 11; required double price = 12; } I am setting extensions this way in my client if(line.startsWith(task)) { builder.setType(MessageProtos.MessageType.DO_TASK); builder.setExtension(MessageProtos.bar, 1); } else { builder.setType(MessageProtos.MessageType.DEBUG); } I have written an unit test which works fine @Test public void testExtensions() throws Exception { MessageProtos.Message.Builder builder = MessageProtos.Message.newBuilder(); builder.setExtension(MessageProtos.bar, 1); builder.setContent(foobar); builder.setType(MessageProtos.MessageType.DEBUG); MessageProtos.Message message = builder.build(); Assert.assertTrue(message.hasExtension(MessageProtos.bar)); } However, on the serverside i am getting this exception 2011-02-06 20:44:58,130 [handlers.EchoServerHandler ] ERROR * Unexpected exception from downstream. [New I/O server worker #1-1] java.lang.NullPointerException at com.google.protobuf.GeneratedMessageLite $ExtendableBuilder.parseUnknownField(GeneratedMessageLite.java:311) at com.example.messages.MessageProtos$Message $Builder.mergeFrom(MessageProtos.java:273) at com.example.messages.MessageProtos$Message $Builder.mergeFrom(MessageProtos.java:187) at com.google.protobuf.AbstractMessageLite $Builder.mergeFrom(AbstractMessageLite.java:107) at com.google.protobuf.AbstractMessageLite $Builder.mergeFrom(AbstractMessageLite.java:161) at com.google.protobuf.AbstractMessageLite $Builder.mergeFrom(AbstractMessageLite.java:93) at org.jboss.netty.handler.codec.protobuf.ProtobufDecoder.decode(ProtobufDecoder.java: 103) at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java: 72) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java: 302) at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java: 317) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java: 299) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java: 216) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java: 274) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java: 261) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:350) at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java: 281) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201) at org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java: 46) at java.util.concurrent.ThreadPoolExecutor $Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor $Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Do i need to somehow declare extensions whenever i register my ProtocolDecoder / ProtocolEncoder? If i don't set any extensions, the client-server communication works fine could anyone help? w/kindest regards marco -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: Problem when generating classes
Hi ok i think i found the problem. I am compiling using protobuffer 2.2.0 , and in my project i am using libraries from protobuf 2.3.0 rgds marco On Jan 28, 11:45 pm, Marco@worldcorp mmistr...@gmail.com wrote: Hi all i am starting to learn protobuffers so that i can use them alongside Netty I have created this simple .proto file package tutorial; option java_package = com.example.messages; option java_outer_classname = MessageProtos; message Message { required string content = 1; enum MessageType { TEST = 0; DEBUG = 1; DO_TASK = 2; } required MessageType type = 2; } THis has generated a class with two methods that Errors out due to 'Cannot dereference boolean' public static com.example.messages.MessageProtos.Message parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeDelimitedFrom(input).buildParsed(); } public static com.example.messages.MessageProtos.Message parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeDelimitedFrom(input, extensionRegistry) .buildParsed(); } could anyone tell me what have i done wrong in my .proto file? thanks and regards marco -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] why am i getting this exception?
HI all i have wrote a simple messages.proto, compiled it (On Ubuntu Lucid Lynx) with protobuf 2.2.0. here's the .proto file package tutorial; option java_package = com.example.messages; option java_outer_classname = MessageProtos; enum MessageType { TEST = 0; DEBUG = 1; DO_TASK = 2; } message Message { required string content = 1; optional MessageType type = 2; } I am using Netty as well, and when i run it i get the following exception 2011-01-29 11:05:30,708 [client.NettyEchoHandler ] ERROR * Unexpected exception from downstream. [New I/O client worker #1-1] com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type. at com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java: 78) at com.google.protobuf.UnknownFieldSet $Builder.mergeFieldFrom(UnknownFieldSet.java:496) at com.google.protobuf.GeneratedMessage $Builder.parseUnknownField(GeneratedMessage.java:271) at com.example.messages.MessageProtos$Message $Builder.mergeFrom(MessageProtos.java:318) at com.example.messages.MessageProtos$Message $Builder.mergeFrom(MessageProtos.java:215) could anyone help pls? w/kindest regards marco -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Re: why am i getting this exception?
Hello, PLs ignore my message It was a Netty problem as i was using multiple decoders / encoders / frames and that was messing up the result sorry for bothering regards marco On Jan 29, 11:09 am, Marco@worldcorp mmistr...@gmail.com wrote: HI all i have wrote a simple messages.proto, compiled it (On Ubuntu Lucid Lynx) with protobuf 2.2.0. here's the .proto file package tutorial; option java_package = com.example.messages; option java_outer_classname = MessageProtos; enum MessageType { TEST = 0; DEBUG = 1; DO_TASK = 2; } message Message { required string content = 1; optional MessageType type = 2; } I am using Netty as well, and when i run it i get the following exception 2011-01-29 11:05:30,708 [client.NettyEchoHandler ] ERROR * Unexpected exception from downstream. [New I/O client worker #1-1] com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type. at com.google.protobuf.InvalidProtocolBufferException.invalidWireType(InvalidProtocolBufferException.java: 78) at com.google.protobuf.UnknownFieldSet $Builder.mergeFieldFrom(UnknownFieldSet.java:496) at com.google.protobuf.GeneratedMessage $Builder.parseUnknownField(GeneratedMessage.java:271) at com.example.messages.MessageProtos$Message $Builder.mergeFrom(MessageProtos.java:318) at com.example.messages.MessageProtos$Message $Builder.mergeFrom(MessageProtos.java:215) could anyone help pls? w/kindest regards marco -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] Problem when generating classes
Hi all i am starting to learn protobuffers so that i can use them alongside Netty I have created this simple .proto file package tutorial; option java_package = com.example.messages; option java_outer_classname = MessageProtos; message Message { required string content = 1; enum MessageType { TEST = 0; DEBUG = 1; DO_TASK = 2; } required MessageType type = 2; } THis has generated a class with two methods that Errors out due to 'Cannot dereference boolean' public static com.example.messages.MessageProtos.Message parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeDelimitedFrom(input).buildParsed(); } public static com.example.messages.MessageProtos.Message parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeDelimitedFrom(input, extensionRegistry) .buildParsed(); } could anyone tell me what have i done wrong in my .proto file? thanks and regards marco -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
[protobuf] protocol buffers and client-server communication
Hi all i am new to protocol buffer, and was wondering if i can use it for my needs. Basically, i am trying to implement a client-server communication where i can have this type of messages: - INCOMING (from client to server) - String - a Savings Object - a Share object - OUTCOMING (from server to client) - String - a List of Savings objects - a List of Share object Basically, what i am trying to say is that i have N types of messages from client to server and M types of messages from server to client, and all this messages are differents from each other (having in total N + M) types of messages. I am guessing i will need 1 proto file for each type of message, correct? w/kindest regards marco -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.