kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guozhang Wang <wangg...@gmail.com>
Subject Re: [DISCUSS] KIP-378: Enable Dependency Injection for Kafka Streams handlers
Date Sun, 30 Sep 2018 19:31:33 GMT
Hello Wladimir,

Thanks for proposing the KIP. I think the injection can currently be done
by passing in the key/value pair directly into the properties which can
then be accessed from the `ProcessorContext#appConfigs` or
`#appConfigsWithPrefix`. For example, when constructing the properties you
can:

```
props.put(myProp1, myValue1);
props.put(myProp2, myValue1);
props.put("my_app_context", appContext);

KafkaStreams myApp = new KafkaStreams(topology, props);

// and then in your processor, on the processor where you want to construct
the injected handler:

Map<String, Object> appProps = processorContext.appConfigs();
ApplicationContext appContext = appProps.get("my_app_context");
MyHandler myHandler =
applicationContext.getBeanNamesForType(MyHandlerClassType);
```

Does that work for you?

Guozhang


On Sun, Sep 30, 2018 at 6:56 AM, Dongjin Lee <dongjin@apache.org> wrote:

> Hi Wladimir,
>
> Thanks for your great KIP. Let me have a look. And let's discuss this KIP
> in depth after the release of 2.1.0. (The committers are very busy for it.)
>
> Best,
> Dongjin
>
> On Sun, Sep 30, 2018 at 10:49 PM Wladimir Schmidt <wlsc.dev@gmail.com>
> wrote:
>
> > Dear colleagues,
> >
> > I am happy to inform you that I have just finished my first KIP
> > (KIP-378: Enable Dependency Injection for Kafka Streams handlers
> > <
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-
> 378%3A+Enable+Dependency+Injection+for+Kafka+Streams+handlers
> > >).
> >
> > Your feedback on this submission would be highly appreciated.
> >
> > Best Regards,
> > Wladimir Schmidt
> >
>
>
> --
> *Dongjin Lee*
>
> *A hitchhiker in the mathematical world.*
>
> *github:  <http://goog_969573159/>github.com/dongjinleekr
> <http://github.com/dongjinleekr>linkedin: kr.linkedin.com/in/dongjinleekr
> <http://kr.linkedin.com/in/dongjinleekr>slideshare:
> www.slideshare.net/dongjinleekr
> <http://www.slideshare.net/dongjinleekr>*
>



-- 
-- Guozhang

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message