如何配置Context Broker与FiROS,实现传感器数据通过QuantumLeap流转至CrateDB?
Hey there! Let's work through getting your FiROS sensor data flowing from Context Broker to CrateDB via QuantumLeap. From what you've shared, here are the key configuration and troubleshooting steps to focus on:
First things first: even though you can see sensor data in FiROS, we need to make sure it's being successfully sent to the Context Broker.
- Run this command to list entities in the Broker (replace
<YourSensorEntityType>with the type of your FiROS sensor entity, likeLaserScanorCamera):curl -X GET http://<your-broker-host>:1026/v2/entities?type=<YourSensorEntityType> - If no entities show up, double-check FiROS's configuration:
- Ensure the Context Broker host/port in FiROS settings matches your actual Broker deployment.
- Verify FiROS is set to publish updates when sensor data changes—some configurations require explicit triggers for entity updates.
You mentioned FiROS has subscribed to the Broker, but the subscription rules might not be aligned to trigger QuantumLeap notifications. Compare it to the working manual subscription you set up:
- Check the subscription's
entitiesfilter: it must exactly match thetype(and optionallyid) of the entities FiROS is sending. A mismatch here means the Broker won't trigger notifications for those entities. - Confirm the
notificationendpoint points to QuantumLeap's correct URL—usually something likehttp://quantumleap:8668/v2/notify(adjust the host/port if your QuantumLeap is on a different setup). - Make sure the
attrsfield either includes all the sensor attributes you want to store, or is omitted (to default to all attributes). Sometimes explicitly listing attributes avoids unexpected filtering. - Use this command to list all active subscriptions and cross-check:
curl -X GET http://<your-broker-host>:1026/v2/subscriptions
The Broker's logs will tell you if it's failing to send notifications to QuantumLeap, and why.
- Pull the Broker's container logs (replace
<orion-container-name>with your actual container name):docker logs <orion-container-name> - Search for keywords like
notification,error, orfailed—you might see issues like:- Network connectivity problems between the Broker and QuantumLeap.
- Invalid payloads that QuantumLeap rejected (returning 400/404 errors).
- If connectivity is an issue, verify both services are on the same Docker network, and test reachability with:
docker exec <orion-container-name> ping quantumleap
FiROS might be sending data in a format that QuantumLeap isn't expecting.
- Check that FiROS's entity attributes follow NGSI-v2 (or NGSI-LD, if you're using that) specs. For example, numeric values should include a
typefield:{"value": 2.7, "type": "Number"} - Look at QuantumLeap's logs for parsing errors:
docker logs <quantumleap-container-name> - If you're using NGSI-LD, confirm QuantumLeap is configured to support it by setting the environment variable
QUANTUMLEAP_NGSI_VERSION=ldwhen starting the service.
Even if the subscription exists, FiROS might not be triggering entity updates correctly:
- Check if FiROS is set to update the Broker only when sensor data changes—if the sensor value stays static, the Broker won't send a notification (since there's no change to report).
- Confirm the subscription is in an
activestate (you can see this in the subscription details from the Broker's API). Sometimes misconfigurations can mark subscriptions as inactive.
Start with these checks, and you'll likely spot where the flow is breaking. If you hit specific error messages in logs or need more details on any step, feel free to share them!
内容的提问来源于stack exchange,提问作者exc8020

