Azure-docs: The example query for routing leaf messages is incorrect

Created on 21 Mar 2019  Â·  12Comments  Â·  Source: MicrosoftDocs/azure-docs

The example in the "Declare routes" to route messages from leaf devices is incorrect.

Incorrect
FROM /messages/* WHERE NOT IS_DEFINED($connectionModuleId) INTO $upstream

Correct
FROM /messages/* WHERE NOT IS_DEFINED({$ConnectionModuleId}) INTO $upstream

The instructions for using system properties states:

  • System properties: $<propertyName> or {$<propertyName>}

but I have found the first format with the $ prefix does not work and the property must be enclosed with {} in addition to the $


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

assigned-to-author doc-bug iot-edgsvc triaged

All 12 comments

@mill5james Thank you for pointing that out . We will have this reviewed and updated as required.

Thanks for the feedback! I have assigned the issue to the content author to evaluate and update as appropriate.

@mill5james I'm surprised to see this issue because I have seen both versions working successfully. It's also not just relevant to this code sample, but would mean that something has changed in the IoT Hub message routing query language.

What method are you using to deploy? The Azure portal, Visual Studio/Visual Studio Code, CLI, etc? Perhaps some tool you're using needs the curly brackets in order to escape the $ character.

we use a deployment.json from azure cli and VS Code

Very strange. I don't think this means that system properties must always have curly brackets, but that there are some scenarios in which curly brackets are needed. I'll change the code sample to cover those corner cases, but will keep the system property syntax explanation as-is. Does that work for you?

Sure. This just caused issues where we literally cut-and-pasted from the documentation into the deployment.json and it did not work. It took a second reading with some trial and error to get the routing working. But then again, my team is doing identity translation on the edge and there is no documentation for that anywhere. :)

Yes, the product group is still working on the identity translation pattern. You can cast your vote on the feedback site to have this feature prioritized: https://feedback.azure.com/forums/907045-azure-iot-edge/suggestions/32497981-code-sample-for-identity-translation-pattern

For the query example, I will create the pull request now and automatically close this issue when the update gets merged. Thanks for providing your feedback.

Not to say there are never any edge cases where curly brackets are required, but I think the issue in this example is casing, rather than brackets.

Working:
FROM /messages/* WHERE NOT IS_DEFINED($ConnectionModuleId) INTO $upstream
Not working:
FROM /messages/* WHERE NOT IS_DEFINED($connectionModuleId) INTO $upstream

Thanks for adding that info, @betsy-c. I'm also adding @varunpuranik for visibility and will hold off on updating the article until we all come to a consensus.

@mill5james Did you have a chance to test whether the difference in your two code samples was the capitalization of the parameter, rather than the use of brackets?

@mill5james Have you had a chance to see the above response? Please update if that helps.

Feel free to close it. I have two people that swear it didn't work but now it does.
meh.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bdcoder2 picture bdcoder2  Â·  3Comments

JamesDLD picture JamesDLD  Â·  3Comments

Ponant picture Ponant  Â·  3Comments

JeffLoo-ong picture JeffLoo-ong  Â·  3Comments

monteledwards picture monteledwards  Â·  3Comments