markap14 commented on pull request #5279:
URL: https://github.com/apache/nifi/pull/5279#issuecomment-915298187


   @MikeThomsen I'm not sure I'm a fan of this approach to be honest, for a 
couple a reasons.
   
   - The point of ScriptedTransformRecord, as opposed to something like 
ExecuteScript, is to keep it as dead simple as possible to perform scripted 
modifications to records. There's also another PR up that we're working through 
(https://github.com/apache/nifi/pull/4948) to add more record-based scripted 
components. We need to be ruthlessly diligent about what we introduce here. We 
really want simplicity & usability here over power. ExecuteScript, etc. give us 
power, while this should yield simplicity.
   - If we do introduce Registry, we've perhaps started down a slipper slope. 
What happens when someone then needs a different type of Controller Service? A 
Record Lookup Service, for example. Do we then add another property for 
RecordLookupService? What if we need a StringLookupService instead of a 
RecordLookupService? Do we add yet another property for that? Now this is far 
from simple.
   - The notion of a "RegistryHelper" is nebulous. Whatever gets injected in, 
if it's a complex object, needs to have a properly formed API/interface with 
sufficient JavaDocs that explain exactly how it is used, and we need to protect 
that API/interface as new versions come out & things evolve.
   
   That being said, I do see benefit in having the ability to reference 
Controller Services.
   So what I would propose would be to attack this a bit differently. Instead 
of adding a "Schema Registry" property we could allow for user-defined 
properties. The name of the property would be the variable binding for the 
script. The dynamic property descriptor would then identify a Controller 
Service of type ControllerService. I.e., any Controller Service. In this way, a 
user can inject in 1 or more Controller Services of any type. For example, if I 
added a property named "MyService" and chose a SchemaRegistry as the property 
value, then my script would be able to reference `this.MyService` and that 
would be the actual Schema Registry controller service.
   
   Thoughts on this approach?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to