Good day, F.D.!

Can you provide ignite logs related to this problem?



On Tue, 1 Feb 2022 at 10:46, F.D. <free.devel...@gmail.com> wrote:

> 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.
>
>
>
>
>

-- 
Best regards, Eduard.

Reply via email to