I want to send JMS message from *1 java program to another java* program 
using protocol buffer. I am not able to parse GPB message properly in 
consumer (receiver) program. It's not able to get the fields(ID, name) what 
I am setting from producer(sender) program. I know there are some issues, 
how I am using BytesMessage type...but don't know what exactly is.
Please find out the issue or suggest me a approach how I can send GBP 
message from 1 java program to another using jms. Thanks

*Producer---*
Employee.Builder person = Employee.newBuilder();
person.setName("DGadadad");person.setId(2213132);person.build();
BytesMessage message=session.createBytesMessage();
message.writeUTF(person.toString());
producer.send(message);

*Consumer---*
javax.jms.Message message = consumer.receive();
BytesMessage textMessage = (BytesMessage) message;
CodedInputStream stream 
=CodedInputStream.newInstance(textMessage.readUTF().toString().getBytes());
Employee p1= Employee.parseFrom(stream);

*.proto---*
message Employee {
  required string name = 1;
  required int32 id = 2;
  }

*com.google.protobuf.InvalidProtocolBufferException: Message missing 
required fie*
lds: name, id
        at 
com.google.protobuf.UninitializedMessageException.asInvalidProtocolBu
fferException(UninitializedMessageException.java:81)
        at 
com.google.protobuf.AbstractParser.checkMessageInitialized(AbstractPa
rser.java:71)
        at 
com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:89)
        at 
com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:95)
        at 
com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
        at main.IdDtlsProtos$Employee.parseFrom(IdDtlsProtos.java:302)
        at Consumer.main(Consumer.java:76)
 

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to