Hi,
I'm trying to use Apache Ignite to store protobuf messages in cache, trying
to speed up our web interface.
I'm using the thin client for nodejs, and the 2.12.0 of Ignite.

I've 2 function:
async function get_cache_value(name, key)
{
   const igniteClient = new IgniteClient();
   let value = null;
   try {
      await igniteClient.connect(new IgniteClientConfiguration(ignite_ip +
':10800'));
      const cache = (await igniteClient.getOrCreateCache(name)).
         setKeyType(ObjectType.PRIMITIVE_TYPE.STRING).
         setValueType(ObjectType.PRIMITIVE_TYPE.BYTE_ARRAY);

      value = await cache.get(key);
   }
   catch(err) {
      console.log(err.message);
   }
   finally {
      igniteClient.disconnect();
   }

   return value;
}

async function put_cache_value(name, key, value)
{
   const igniteClient = new IgniteClient();
   try {
      await igniteClient.connect(new IgniteClientConfiguration(ignite_ip +
':10800'));
      const cache = await igniteClient.getCache(name).
      setKeyType(ObjectType.PRIMITIVE_TYPE.STRING).
      setValueType(ObjectType.PRIMITIVE_TYPE.BYTE_ARRAY);

      await cache.put(key, value);
   }
   catch(err) {
      console.log(err.message);
   }
   finally {
      igniteClient.disconnect();
   }
}

The put seems work well, but I'm not sure, but when I try to do the get I
got this error: "Type "BinaryObject" can not be cast to byte array". I'm
putting the protobuf serialized message that should be a byte array.

What's wrong?

Thanks,
   F.D.

Reply via email to