Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

AutomaticInboxProcessor registered as an RegistryListener #4192

Merged

Conversation

afuechsel
Copy link
Contributor

for the thing registry to handle REMOVED events correctly

Fixes: #4187
Signed-off-by: Andre Fuechsel andre.fuechsel@telekom.de

…ng registry to handle REMOVED events correctly

Fixes: eclipse-archived#4187
Signed-off-by: Andre Fuechsel <andre.fuechsel@telekom.de>
@@ -78,6 +79,8 @@ public void receiveTypedEvent(ThingStatusInfoChangedEvent event) {
}
}

// InboxListemer methods
Copy link
Contributor

Choose a reason for hiding this comment

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

Listener (m => n)

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need such marker? I don't think we used it on all the other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, will remove it. :)

@@ -278,6 +278,7 @@ private void onConnectionResumed() throws IOException, ApiException {
properties.put(Thing.PROPERTY_SERIAL_NUMBER, config.getMACAddress().replaceAll(":", "").toLowerCase());
properties.put(Thing.PROPERTY_FIRMWARE_VERSION, config.getSoftwareVersion());
updateProperties(properties);
updateThing(thing);
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this change related to the AutomaticInboxProcessor registered as an RegistryListener?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the properties would not be persisted, the automatic inbox listener would be unable to retrieve the representation property during deletion. Please note, that this was on purpose as long as the hue binding was updating the properties in each polling cycle. Now that it is guarded, that problem won't exist anymore and the properties should be persisted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just came across this here. How does it relate to #1682 and esp. #588 (comment)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SJKA I see your point but I wonder how to solve this issue without persisting the properties. As the thing is already gone when the removed callback is called I would not be able to get the property value. Hmm.

Copy link
Contributor

Choose a reason for hiding this comment

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

@afuechsel I is always a bad smell to do some specific code changes in one binding for a concept that should be applicable in the whole framework (and thus be the same for all bindings). Note that after #1682 had been implemented, we meanwhile had #2629 in place. This allows to do Thing updates (structure AND configuration) and persists those updates in case it is a managed Thing. Imho, what is missing in that PR is that it also tries to persist properties in the very same way. If this was done, it would be in line with how configuration updates are handled and it would be exactly what you need here (i.e. this line can be removed as the framework already takes care of everything). Do you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think, if properties would be persisted in some other way, this line could be removed. But did I understand correctly, that there is still some tiny piece missing (persisting the properties)? Would that mean to revert #1682?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. See #4688.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, then this PR needs to be changed too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes. See #4688.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, didn't see it in the first place :)

@@ -136,6 +136,7 @@ private synchronized void initializeProperties() {
}
updateProperty(LIGHT_UNIQUE_ID, fullLight.getUniqueID());
isOsramPar16 = OSRAM_PAR16_50_TW_MODEL_ID.equals(modelId);
updateThing(thing);
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this change related to the AutomaticInboxProcessor registered as an RegistryListener?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see above

Copy link
Contributor

@htreu htreu left a comment

Choose a reason for hiding this comment

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

looks good to me, just one small typo.

edit: oh, too late ;-)

@@ -78,6 +79,8 @@ public void receiveTypedEvent(ThingStatusInfoChangedEvent event) {
}
}

// InboxListemer methods
Copy link
Contributor

Choose a reason for hiding this comment

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

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already removed as @maggu2810 suggested

Signed-off-by: Andre Fuechsel <andre.fuechsel@telekom.de>
@maggu2810 maggu2810 merged commit bf241d4 into eclipse-archived:master Sep 6, 2017
@afuechsel afuechsel deleted the fix-auto-ignore-removal branch September 6, 2017 08:17
@kaikreuzer kaikreuzer added this to the 0.9.0 milestone Nov 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants