Replies: 2 comments
-
|
Hi @tenthe sounds great! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I have identified two adapters where the migration path is not straightforward and will require substantial additional effort:
Key Questions for DiscussionMy questions are centered on the necessity and migration strategy for these two components:
@obermeier, I would appreciate your thoughts on these points. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to propose a significant refactoring and enhancement of the StreamPipes Connect module.
The goal is to simplify the application logic, improve the user experience, and vastly increase the flexibility when connecting to new data sources, especially those with complex data structures.
I've already started a prototype implementation in PR #4033, which helped validate the approach and confirmed the potential for a much simpler connection creation process.
❓ The Problem with Current Capabilities
The current Connect module faces three key limitations that complicate its use for end-users:
✨ Proposed Solution: Function Transformation Step
I propose introducing a Function Transformation Step as the primary mechanism for preprocessing incoming events within the Connect module.
The core idea is to allow users to define a script (e.g., JavaScript) that takes the original event (a map) and returns the transformed event (a new map).
This change will fully resolve the limitations above by providing a flexible mechanism for defining complex parsing and schema mapping logic directly.
Key Advantages:
Map<String, Object>. The complex transformation and schema inference logic is centralized in the Function step and the backend.🔄 Impact on Transformation Rules
This new approach would replace most of the existing rigid
TransformationRuleDescriptionclasses with flexible scripting logic.Here is a table showing how current rules would be mapped to the new function-based approach:
DeleteRuleDescriptiondelete event.propertyNameMoveRuleDescriptionevent.newValue = event.oldNested.oldValueRenameRuleDescriptionevent.newName = event.oldNameAddTimestampRuleDescriptionevent.time = Date.now()AddValueTransformationRuleDescriptionevent.newValue = 0.1CorrectionValueTransformationRuleDescriptionevent.value = event.value * 2RegexTransformationRuleDescriptionevent.value = event.value.replace(/sensor/i, "")TimestampTranfsformationRuleDescriptionevent.time = new Date(event.time).getTime()EventRateTransformationRuleDescriptionRemoveDuplicatesTransformationRuleDescriptionChangeDatatypeTransformationRuleDescriptionUnitTransformRuleDescriptionThe few rules that won't change are those that operate after the schema has been inferred or require specialized calculations/metadata (like Unit Transformation).
🎨 Updated User Flow
The new user flow for adapter configuration:
transformEventscript.⚙️ Technical and Migration Details
This change introduces significant modifications to the UI, the data model, and the backend implementation.
Backend REST Endpoints:
We will introduce new REST endpoints to support the live-editing and preview capabilities in the UI:
/sample: Connects to the extension service to receive a sample event from the data source./sample/transform: Takes the sample event and the script, returning the new transformed event structure for UI preview./schema: Takes the resulting event (from the transformation) and returns the inferredEventSchemaobject./schema/preview: Takes the transformed event and applies the post-script value transformations (like Unit/Datatype changes) for a final preview.Data Model Migration:
The most crucial requirement is that all changes must be automatically transformed so that existing, old adapters continue to function without any manual change required by the user.
AdapterDescriptioncontains a list ofTransformationRuleDescription.Feedback
I believe these changes will greatly increase user flexibility and still remain straightforward for users to apply. Do you have any thoughts on the changes?
Beta Was this translation helpful? Give feedback.
All reactions