Hi Eduard, sorry for my late reply. I've attached it to this email. But now I got a different error message: "Value "220" can not be cast to byte" or "Value "238" can not be cast to byte"
The line where I got the error is:
await cache.put(key, value);
Where value is
[image: image.png]
Thank you in advance.
F.D.
On Tue, Feb 1, 2022 at 6:32 PM Eduard Rakhmankulov <[email protected]>
wrote:
> Good day, F.D.!
>
> Can you provide ignite logs related to this problem?
>
>
>
> On Tue, 1 Feb 2022 at 10:46, F.D. <[email protected]> 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.
>
ignite-e39d51be.0.log
Description: Binary data
