Configuring a RichFunction on a DataStream

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Configuring a RichFunction on a DataStream

Robert Schmidtke
Hi everyone,

I noticed that in the DataSet API, there is the .withParameters function that allows passing values to a RichFunction's open method. I was wondering whether a similar approach can be used to the same thing in a DataStream. Right now I'm getting the parameters via getRuntimeContext, but it feels a little awkward given the available Configuration object.

Thanks!

Robert


--
My GPG Key ID: 336E2680
Reply | Threaded
Open this post in threaded view
|

Re: Configuring a RichFunction on a DataStream

Fabian Hueske-2
Hi Robert,

Function configuration via a Configuration object and the open method is an artifact from the past.
The recommended way is to configure the function object via the constructor.
Flink serializes the function object and ships them to the workers for execution. So the state of a function is preserved. Note, the function object must be serializable with Java serialization.

Best, Fabian

2016-04-28 10:33 GMT+02:00 Robert Schmidtke <[hidden email]>:
Hi everyone,

I noticed that in the DataSet API, there is the .withParameters function that allows passing values to a RichFunction's open method. I was wondering whether a similar approach can be used to the same thing in a DataStream. Right now I'm getting the parameters via getRuntimeContext, but it feels a little awkward given the available Configuration object.

Thanks!

Robert


--
My GPG Key ID: 336E2680