hemantvsn
hemantvsn

Reputation: 1446

Apache Nifi Custom processors With Spring Support

Im creating a custom NIFI processor (for now a stripped down version of NIFI's own emailProcessor).

It will be desirable if I could use Spring's dependency injection. Eg: EmailService bean is responsible for delivering mails. In my processor, EmailService should be autowired.

How can it be configured?

Upvotes: 2

Views: 876

Answers (1)

Bryan Bende
Bryan Bende

Reputation: 18630

Apache NiFi processors themselves are not related to Spring in any way. You would have to create an ApplicationContext in the processor's @OnScheduled method and then obtain the beans you want to be used later when onTigger is called. I don't think you would be able to @Autowire directly into the processor, since the processor itself is managed by the NiFi framework and is not a Spring bean.

Upvotes: 3

Related Questions