Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make data retrieval of IOLink sensor more robust #2024

Merged
merged 4 commits into from
Oct 16, 2023

Conversation

bossenti
Copy link
Contributor

Purpose

This PR makes the data retrieval within the IOLink adapter more robust. Prior to it, an error occurring for one port stopped the processing of all subsequent ports. This means, that in case the processing fails for port 2, e.g., since this port is not connected to a sensor and therefore does not deliver any data, parsing for port 3 and 4 is skipped.
From now on, only the affected port will be skipped.

Remarks

PR introduces (a) breaking change(s): no

PR introduces (a) deprecation(s): no

@bossenti bossenti added this to the 0.93.0 milestone Oct 13, 2023
@github-actions github-actions bot added java Pull requests that update Java code connect Related to the `connect` module (adapters) backend Everything that is related to the StreamPipes backend labels Oct 13, 2023
collector.collect(parsedEvent);
try {
var portResult = getMap(payload,
"/iolinkmaster/port[%s]/iolinkdevice/pdin".formatted(ports.get(i)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check if the port exists here before fetching it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

try {
var portResult = getMap(payload,
"/iolinkmaster/port[%s]/iolinkdevice/pdin".formatted(ports.get(i)));
var eventData = (String) portResult.get("data");
Copy link
Member

@dominikriemer dominikriemer Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here for portResult

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@bossenti bossenti merged commit a2d4e61 into dev Oct 16, 2023
@bossenti bossenti deleted the make-io-link-adapter-more-robust branch October 16, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Everything that is related to the StreamPipes backend connect Related to the `connect` module (adapters) java Pull requests that update Java code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants