-
Notifications
You must be signed in to change notification settings - Fork 265
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
Subscriptions to do internal modifications to CB entities #4513
Comments
With regards to the syntax to use, with regards to the proposal above: {
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "T"
}
]
},
"notification": {
"internal": {
"ngsi": {
"sum": {
"value": "${a+b}",
"type": "Number"
}
}
}
}
} In involves the definition of a new notification sub-key ( As alternative, we could reuse {
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "T"
}
]
},
"notification": {
"httpCustom": {
"ngsi": {
"sum": {
"value": "${a+b}",
"type": "Number"
}
}
}
}
} It's more dirty (as we are using |
Another important thing to take into account is loop protection. For instance, we could have something like this: {
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "T"
}
]
},
"notification": {
"internal": {
"ngsi": {
"a": {
"value": "${a+1}",
"type": "Number"
}
}
}
}
} causing an infinite loop if a E1-T a=1 arrives to the CB. In the past we implemented a loop protection for HTTP notifications (issue #2937, PR #2941) but it's heavily based on fiware-correlator header in HTTP. Should be improved to take also into account this new internal notification scenario. |
Currently we have four ways of specifying the payload of a notification:
Only 1 and 4 make sense for internal notifications |
Could this feature be implemented through IoTA? |
That would involve an external notification. That mechanism already exists, but what we are addressing with this issue is internal modification. It's a way of programming calculations at Orion, but reusing the subscription logic. |
Is your feature request related to a problem / use case?
Currently we have HTTP and MQTT external notifications (
http
,httpCustom
,mqtt
andmqttCustom
in the subscription JSON). It would be great to have a subscription-based mechanism to modify internal entities without notifications. In some sense, a kind of internal notifications.This could be used in combination with JEXL expressions (#4004) in order to generate calculated attributes in entities
Describe the solution you'd like
For instance, let's consider something like this:
So if CB receives an update on entity E1-T with attributes a=2 and b=4 the final state of that entity would be the following attributes:
Describe alternatives you've considered
We could have a new API to define attribute calculations, but it seem wiser to reuse all the existing logic for subscriptions, enhancing with a new "notification" type.
Describe why you need this feature
Do you have the intention to implement the solution
The text was updated successfully, but these errors were encountered: