Enricher with dynamic params

6 views
Skip to first unread message

Ajay Babu

unread,
Sep 1, 2025, 6:50:38 PMSep 1
to Nussknacker
Hi,

1.I am building a custom HTTP enricher similar to the one in the demo version. I have created the factory class, but my requirement is to build the url and requestBody dynamically for each input record.

When I define these attributes as LazyParameter, I get the following error in Flink:
java.lang.IllegalArgumentException: argument type mismatch

If I define the type as String, I'm unable to update the url and requestBody dynamically in the UI using #input. I've attached the implemented class.

2.Is it possible to support string templates and json templates as in the demo version for Http enricher?

3.Is it possible to group attributes, similar to how it's done using annotations or an API?


advanced.PNG

4.In attached class is possible show fields retryErrorCodes, maxRetries, retryIntervalMs show only when select in  errorStrategy='RETRY_ERROR_CODES' in UI?

Thanks,
Ajay Babu Maguluri.

HttpServiceFactory.scala

Arkadiusz Burdach

unread,
Sep 3, 2025, 3:35:57 AMSep 3
to Ajay Babu, Nussknacker, enter...@nussknacker.io
Hi


On 2.09.2025 00:50, Ajay Babu wrote:
Hi,

1.I am building a custom HTTP enricher similar to the one in the demo version. I have created the factory class, but my requirement is to build the url and requestBody dynamically for each input record.

When I define these attributes as LazyParameter, I get the following error in Flink:
java.lang.IllegalArgumentException: argument type mismatch

Can you share the full stack trace? I'm guessing that it is because you've used the Service class. The Service is a legacy interface for which all parameters are "lazy" even if they are defined as normal types such as String.
It's a little bit longer story behind this, but currently, we are moving to the EagerService class which behave more similar to SourceFactory or SinkFactory. EagerService should return a ServiceInvoker. Let's try with this solution and take a look how it will work with this.

If I define the type as String, I'm unable to update the url and requestBody dynamically in the UI using #input. I've attached the implemented class.
It's strange, for Service, parameter defined as String should allow to use variables available in context, but let's try with EagerServce and LazyParameter.


2.Is it possible to support string templates and json templates as in the demo version for Http enricher?
Yes, you only have to annotate a parameter with @SpelTemplateParameterEditor or @JsonTemplateParameterEditor but I'm guessing that it is available only in unreleased 1.19 version.


3.Is it possible to group attributes, similar to how it's done using annotations or an API?
Yes, using @ParameterCategory(`type` = ParameterCategoryType.ADVANCED) annotation, but I'm not sure that if it was available in 1.18. Currently, there are available only two parameters categories: STANDARD and ADVANCED



advanced.PNG

4.In attached class is possible show fields retryErrorCodes, maxRetries, retryIntervalMs show only when select in  errorStrategy='RETRY_ERROR_CODES' in UI?
Yes, you can define dependencies between parameters but it requires to switch to more advanced, DynamicComponent API. In this API, instead of using annotations, you have to define a state machine (contextTransformation method)
which tells scenario compiler which parameters should be provided next after currently provided parameters. This is not so easy as a static approach which annotations but it enables full set of features.

Arek Burdach

Thanks,
Ajay Babu Maguluri.

--
You received this message because you are subscribed to the Google Groups "Nussknacker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nussknacker...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/nussknacker/48c9217f-8a4e-4608-bfb1-820266ff37c1n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages