{
"cols": [
"schema_name"
],
"rows": [
[
"blob"
],
[
"doc"
],
[
"information_schema"
],
[
"pg_catalog"
],
[
"sys"
]
],
"rowcount": 5,
"duration": 7.289699
}
http://{{crate}}/_sql {"stmt":"SHOW SCHEMAS"} for read schemas. you can see there is no schema formed in "mtmytenant" (my service hearder is mytenant).
now see the below. You can see the subscribtion but there is no table schema. BUt i get all the subscribed sensor values.
{"stmt":"SHOW TABLES"}
{
"cols": [
"table_name"
],
"rows": [
[
"etdummydevice1"
],
[
"etdummydevice2"
],
[
"md_ets_metadata"
]
],
"rowcount": 3,
"duration": 24.486307
}
According to the doc https://ngsi-ld-tutorials.readthedocs.io/en/latest/time-series-data.html ,
Schema names are formed with the mt prefix followed by NGSILD-Tenant header in lower case. The IoT Agent is forwarding measurements from the dummy IoT devices, with the NGSILD-Tenant header openiot. These are being persisted under the mtopeniot schema.
If the mtopeniot does not exist, then the subscription to QuantumLeap has not been set up correctly. Check that the subscription exists, and has been configured to send data to the correct location. here openiot is the header.
Post with headers NGSILD-Tenant=mytenant, Content-Type=application/ld+json http://localhost:1026/ngsi-ld/v1/subscriptions/
{
"description": "Notify me of Dummydevice1 changes",
"type": "Subscription",
"entities": [{"type": "Dummydevice1"}],
"watchedAttributes": ["pilot_temperature"],
"notification": {
"attributes": ["location", "pilot_temperature"],
"format": "normalized",
"endpoint": {
"uri": "http://quantumleap:8668/v2/notify",
"accept": "application/json"
}
},
"@context": "http://context:3000/data-models/ngsi-context.jsonld"
}
This works perfectly with NSGI v2 I am getting all the table schemas but with NGSI LD it is a bit problem. If anyone solved this. As in the tutorial if I did, still the schema names are not formed, but it does in the tutorials
This is because QuantumLeap 0.8.3 only looks for the fiware-service
header, not the NGSILD-Tenant
header instead. You must deliberately supply it to the notification.
According to the 1.7.1 ETSI spec, 5.2.15 Endpoint includes an array called receiverInfo which can be used to send arbitrary headers - if you set this to include a fiware-service
key-value pair, then QuantumLeap will create an mt element for the tenant.
QuantumLeap should be reading NGSILD-Tenant
as an alias of fiware-service
, but you can help by adding something like this:
curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
-H 'Content-Type: application/ld+json' \
-H 'NGSILD-Tenant: openiot' \
--data-raw '{
"description": "Notify me using the openiot fiware-service",
"type": "Subscription",
"entities": [{"type": "FillingLevelSensor"}],
"watchedAttributes": ["filling"],
"notification": {
"attributes": ["filling", "location"],
"format": "normalized",
"endpoint": {
"uri": "http://quantumleap:8668/v2/notify",
"accept": "application/json",
"receiverInfo": [
{
"key": "fiware-service",
"value": "openiot"
}
]
}
},
"@context": "http://context/ngsi-context.jsonld"
}'