Implementing a CustomTransformer in Java

26 views
Skip to first unread message

Mathieu Pedrero

unread,
May 11, 2020, 11:22:46 AM5/11/20
to Nussknacker
Hi Everyone,

I need some help. I would like to implement a CustomTransformer in java, but the related section of the NN API documentation is still empty.

I would like to build a transformer (DataStream Transformer for Flink), equivalement to the map DataStream Flink API, that would create some complex object (from a template, for example) from input datas selected by the NN user (more or less as the mapVariable transformer works).

I tried to start by analyzing the sources of an existing CustomTransformer (UnionTransformer), but i'm not very "fluent" in scala, and that's not so easy to me.

Could you help me ? Is there some Java examples of advanced API implementation ?

Thanks a lot, and best regards.

--
Mathieu

arek.b...@gmail.com

unread,
May 11, 2020, 2:01:48 PM5/11/20
to Nussknacker
Hi Mathieu,

It provides two java custom transformers:

Basically the main thing that you need is to write a class implementing CustomStreamTransformer with method annotated by @MethodToInvoke. This method should return Flink's data stream transformation wrapped with JavaFlinkCustomStreamTransformation.apply().

At the end you need to return instance of this class from your model's customStreamTransformers registry located in implementation of your ProcessConfigCreator.

Does my answer help you figuring out what is needed to do?

Arek

Mathieu Pedrero

unread,
May 14, 2020, 3:26:37 AM5/14/20
to Nussknacker
Hi,

Thanks for the information. It looks promising. I'll try this later today.

Best regards,
--
Reply all
Reply to author
Forward
0 new messages