You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "samer.masaad@murex.com" <sa...@murex.com> on 2019/07/30 14:53:09 UTC

C++ Thin Client can't consume complex objects published by a Java thick client - IgniteError: Unsupported binary protocol flag

Hello everyone,

In short, I am producing complex data from a Java Thick Client, and consume
it from a C++ Thin Client.
In the C++ consumer, after calling cache.GetAll(keys, results); I am getting
this error: Unsupported binary protocol flag:
IGNITE_BINARY_FLAG_COMPACT_FOOTER: 32

However, it works fine when I switch the Java producer to a Thin Client, and
I found no problems consuming the same data from Java Thin and Thick
Clients.
It looks like a serialization incompatibility issue between the Java Thick
Clients and the C++ Thin Clients.
So, I tried these scenarios:

Java thick -> C++ thin = Error
Java thin -> C++ thin = Works
Java thick -> Java thin = Works
Java thick -> Java  thin = Works

I attached the code that reproduces the error:
1. Producer.java starts an ignite node and pushes 3 ComplexValues to Ignite
and successfully consumes them.
2. Consumer.cpp starts an ignite client node and consumes. (Fails)

Publisher.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t2530/Publisher.java>  
Consumer.cpp
<http://apache-ignite-users.70518.x6.nabble.com/file/t2530/Consumer.cpp>  

Please ask for any additional information if needed.
Thanks in advance.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: C++ Thin Client can't consume complex objects published by a Javathick client - IgniteError: Unsupported binary protocol flag

Posted by "samer.masaad@murex.com" <sa...@murex.com>.
Hello,

It works indeed like a charm.
Thanks for your support!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

RE: C++ Thin Client can't consume complex objects published by a Javathick client - IgniteError: Unsupported binary protocol flag

Posted by Alexandr Shapkin <le...@gmail.com>.
Hello,

I assume that the main difference is how thin and thick clients handles class names metadata.

For thick client you definitely need to register such information manually.

I made your solution work by addition this configuration to the Java part (no changes in c++ consumer):
BinaryConfiguration bc = new BinaryConfiguration()
   .setCompactFooter(false)
   .setIdMapper(new BinaryBasicIdMapper(true))
   .setNameMapper(new BinaryBasicNameMapper(true))
   .setClassNames(Arrays.asList("yourPackage.ComplexValue"));
cfg.setBinaryConfiguration(bc);

This is a java counterpart of xml config at the bottom “Spring Configuration” section [1]

Also, I would suggest you to implement Binarylizable interface for Java part as well.
Just to be sure, that fields ordering and naming stays the same during serialization for both sides.

Please, let me know if it helps.

[1] - https://apacheignite-cpp.readme.io/docs/cross-platform-interoperability#section-defining-cross-platform-type


From: samer.masaad@murex.com
Sent: Tuesday, July 30, 2019 5:53 PM
To: user@ignite.apache.org
Subject: C++ Thin Client can't consume complex objects published by a Javathick client - IgniteError: Unsupported binary protocol flag

Hello everyone,

In short, I am producing complex data from a Java Thick Client, and consume
it from a C++ Thin Client.
In the C++ consumer, after calling cache.GetAll(keys, results); I am getting
this error: Unsupported binary protocol flag:
IGNITE_BINARY_FLAG_COMPACT_FOOTER: 32

However, it works fine when I switch the Java producer to a Thin Client, and
I found no problems consuming the same data from Java Thin and Thick
Clients.
It looks like a serialization incompatibility issue between the Java Thick
Clients and the C++ Thin Clients.
So, I tried these scenarios:

Java thick -> C++ thin = Error
Java thin -> C++ thin = Works
Java thick -> Java thin = Works
Java thick -> Java  thin = Works

I attached the code that reproduces the error:
1. Producer.java starts an ignite node and pushes 3 ComplexValues to Ignite
and successfully consumes them.
2. Consumer.cpp starts an ignite client node and consumes. (Fails)

Publisher.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t2530/Publisher.java>  
Consumer.cpp
<http://apache-ignite-users.70518.x6.nabble.com/file/t2530/Consumer.cpp>  

Please ask for any additional information if needed.
Thanks in advance.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/