You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Robert Schmidtke <ro...@gmail.com> on 2016/04/28 10:33:03 UTC

Configuring a RichFunction on a DataStream

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

Re: Configuring a RichFunction on a DataStream

Posted by Fabian Hueske <fh...@gmail.com>.
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 <ro...@gmail.com>:

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