Hi,

Is my understanding correct that we cannot use BinaryObjects in
IgniteCallable as it already uses serializable interface?

I am using IgniteCallable to retrieve a customClass object using
BinaryObject but facing a type cast exception.(ExchangeRate cannot be cast
to org.apache.ignite.binary.BinaryObject)

CacheConfiguration<ExchangeRateKey, ExchangeRate> cacheCfg = new
CacheConfiguration<>("ExchangeRateCache");
                 cacheCfg.setCacheMode(CacheMode.REPLICATED);
                 IgniteCache<ExchangeRateKey, ExchangeRate> cache =
ignite.getOrCreateCache(cacheCfg);
                 IgniteDataStreamer<ExchangeRateKey, ExchangeRate> Cachestmr =
ignite.dataStreamer(cache.getName());
Cachestmr.addData(rate.getRateKey(), rate);

IgniteCache<ExchangeRateKey, BinaryObject> binaryCache =
ignite.cache("ExchangeRateCache").withKeepBinary(); 
           ExchangeRate obj = binaryCache .get(key);
           System.out.println("Cache in : " + obj.getOfferRate() );     ------> 
This
works

BinaryObject rate1 = ignite.compute().call(
                         
                            new IgniteCallable<BinaryObject>() {
                                private static final long serialVersionUID = 1L;
                         
                                
                                public BinaryObject call() throws 
UnknownHostException {
                                                        
System.out.println(binaryCache.get(key));
                                                    BinaryObject obj = 
binaryCache.get(key);     -------> This gives
error 
                                        return obj;
                                }
                                
                                
                            });  



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/BinaryObjects-in-IgniteCallable-tp13152.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to