Orion-ld Subscribe to all entities

72 Views Asked by At

Can i subscribe to all updates from any entity that Orion-LD receive? If yes what will a minimum example for it?

I have tried different option for entities attribute when i POST at orionld/ngsi-ld/v1/subscriptions/

  • "entities": [{"type": "*"}],
  • "entities": [{"type": "Entity"}],
  • "entities": [{"idPattern": ".", "type": "."}],
2

There are 2 best solutions below

0
kzangeli On

Right now the entity type is mandatory in NGSI-LD subscriptions. That said, we recently discussed this in ETSI ISG CIM where the NGSI-LD API is defined and a decision has been made to allow for a "*" value of the entity type, matching all entity types. This will most probably be be made official in the next release (v1.8.1) of the NGSI-LD API spec - early 2024. The new feature will soon be implemented in the Orion-LD context broker. Hopefully before the end of this month, October 2023.

0
Jason Fox On

At the moment The ETSI spec section 5.2.8 EntityInfo defines the options id, idPattern and type, so you cannot currently subscribe on type using a wildcard.

However, you can already use the /ngsi-ld/v1/types endpoint to retrieve a list of every available Entity type, so you could retrieve all types (which returns XXX, YYY, ZZZ for example and create a subscription holding an array of EntityInfo elements as shown

curl -L -X GET 'http://context-broker/ngsi-ld/v1/types
curl -L -X POST 'http://context-broker/ngsi-ld/v1/subscriptions/' \
-H 'Content-Type: application/ld+json' \
--data-raw '{
  "description": "Notify me of all changes",
  "type": "Subscription",
  "entities": [{"type": "XXX"}, {"type": "YYY"}, {"type": "ZZZ"}],
  ... etc
   "@context": "http://context/ngsi-context.jsonld"
}'