This message was deleted.
# general
s
This message was deleted.
l
so I did a small POC for Pulsar Functions too https://github.com/lburgazzoli/pulsar-function-wasm/ Note that I'm aware of the existence of a PR to bring Wasm to Pulsar
now, one of the goal of the implementation is to let the guest function to lazily get what is needed so I do want to be able to lazily get i.e. the value of a record as a byte array so avoid any serialization till is really needed
to do so I think I can implement my function to implement a method like:
Copy code
Record<GenericObject> process(GenericObject input, Context context)
however is not very clear to me how I can encode/decode a
GenericObject
any help would be really appreciated
l
this partially help yes, so in my case what I want to do is
Copy code
Record<GenericObject> --> byte[] --> Record<GenericObject>
for the first step, I guess the following code should work:
Copy code
byte[] bytes = record.getSchema().encode(...)
however the other way is not super clear, I guess it is something on the same line
Copy code
GenericObject result = record.getSchem().decode(bytes)
but it does not seems to be really be easy to do, or t least I have't figure out how to actually do it
a
this partially help yes, so in my case what I want to do is
Copy code
Record<GenericObject> --> byte[] --> Record<GenericObject>
Maybe I’m missing something, but the input and output are the same 😅
l
they are the same type but may be different depending on the function
in fact the wasm function can amend individual part of the record
i.e. the destination topi, the value, a property, etc
so I need to rebuild the record
in case the function wants to change the value, then I need first to serialize it to a byte[]
then deserialize it to the original type
whell, maybe not but that's what I'm trying to achieve
so I need to create a new GenericObject instance
it may be a bad design 🙂
don't know
a
I see I would recommend taking a look at the
AutoConsumeSchema
and
AutoProduceBytesSchema
l
I will, thx