Hi Ofir,

The config TimstampExtractor expects only the class name and an instance
will be created via reflection, and users cannot pass in an instance
directly via the config.

One way to fix it, is to let TimestampExtractor extend Configurable and
hence the created instance will auto trigger a user-customizable
configure() function.


Guozhang

On Tue, Dec 27, 2016 at 5:12 AM, Ofir Sharony <[email protected]>
wrote:

> Yes.
> In my case, I would like to inject some configuration to my custom
> timestamp extractor.
> For example, the name of the field where I place the timestamp within the
> message.
>
> From the error raised ('Expected a Class instance or class name') I thought
> that an instance is valid here.
> Any ideas?
>
> *Ofir Sharony*
> BackEnd Tech Lead
>
> Mobile: +972-54-7560277 | [email protected] | www.myheritage.com
> MyHeritage Ltd., 3 Ariel Sharon St., Or Yehuda 60250, Israel
>
> <http://www.myheritage.com/>
>
> <https://www.facebook.com/myheritage>
> <https://twitter.com/myheritage>         <http://blog.myheritage.com/>
>     <https://www.youtube.com/user/MyHeritageLtd>
>
>
> On Tue, Dec 27, 2016 at 12:53 PM, Matthias J. Sax <[email protected]>
> wrote:
>
> > Kafka Streams does create objects of TimestampExtractor class internally
> > and thus you should not provide an instance of MyTimestampExtractor but
> > the class object or name.
> >
> > Is there any problem for you with this approach?
> >
> > -Matthias
> >
> >
> > On 12/26/16 2:49 PM, Ofir Sharony wrote:
> > > Hi guys,
> > >
> > > I have an issue initializing a TimestampExtractor in KafkaStreams.
> > >
> > > The following (static) initialization works great:
> > > *config.put("timestamp.extractor", MyTimestampExtractor.class.
> > getName());*
> > >
> > > But when trying to initialize with an instance of the class as follows:
> > > *config.put("timestamp.extractor", new MyTimestampExtractor());*
> > >
> > > I get the following error:
> > >
> > > Invalid value
> > > com.myheritage.data.kafkastreamproc.CdcProcessor$
> > MyTimestampExtractor@50c87b21
> > > for configuration timestamp.extractor: Expected a Class instance or
> class
> > > name.
> > >
> > > Is this a bug or am I missing something here?
> > > Thanks.
> > >
> > > *Ofir Sharony*
> > > BackEnd Tech Lead
> > >
> > > Mobile: +972-54-7560277 | [email protected] |
> > www.myheritage.com
> > > MyHeritage Ltd., 3 Ariel Sharon St., Or Yehuda 60250, Israel
> > >
> > > <http://www.myheritage.com/>
> > >
> > > <https://www.facebook.com/myheritage>
> > > <https://twitter.com/myheritage>         <http://blog.myheritage.com/>
> > >     <https://www.youtube.com/user/MyHeritageLtd>
> > >
> >
> >
>



-- 
-- Guozhang

Reply via email to