Comments (2)
The current at
parameter must be between the firstSequence
and the lastSequence
. You can do a current or sample and get the firstSequence
number and then issue a current?at={fistSequence}
. I would advise against this since by the time you start streaming with sample?from={nextSequence}
, the beginning of the buffer most likely has already moved.
Currently, current?at=0
is not supported; the data will probably no longer be present unless the system is completely idle. If you started a certain distance from firstSequence
, e.g., +1000, compute the observation rate and the latency between requests and then add that plus some slop to make sure.
Unfortunately, there is no easy way with a store and forward service to ensure the buffer's beginning stays in place between calls. This would go against the RESTful architectural model and state management. That is why we defaulted current to the end of the buffer since it provides the latest snapshot–similar to the only mode protocols like MQTT operate in without history.
I'd like to know what you're trying to do from an application point of view. Developing a creative solution that still abides by a RESTful architecture and solves your problem is possible. It may be a general problem others are having, and having a standardized solution could be useful.
from cppagent.
I'm improving the way my app synchronizes to the agent buffer for the first time (when adding a connection to an agent for example), taking advantage of the data the agent has in the buffer. Previously I was simply starting at the end of the buffer, a /current
request.
Now I'm using a similar process to what you describe in the second paragraph, finding the first sequence number and computing an offset.
If you started a certain distance from firstSequence, e.g., +1000
I guess I was curious about finding the sequence number of the first observation in the buffer. Any MTConnectStreams document will have the buffer stats in the header, I was thinking that since I only need the firstSequence
, it would be optimal to form a request that minimizes data transfer beside that; probably over thinking it. I ended up using /sample?count=1
which returns only the first observation. Granted, with only one observation, I can't compute the update rate, so thanks for pointing out that concept.
I understand the intended sequence of calls now; I'll write it out for future readers.
-
/sample
to get the first 100 observations, allowing you to estimate the observation update rate (which will vary some, over time). Use thecount
parameter if you don't like the default behavior of 100. -
/current?at=<firstSequence+offset>
to get an initial state for every dataItem in the device model. -
'/sample?from=<firstSequence+offset+1>' to start getting deltas from the initial state found in (2).
-
Continue streaming data by issuing
/sample?from=<nextSequence>
until you get a document header that hasnextSequence
>lastSequence
.
from cppagent.
Related Issues (20)
- Change the schema version for the stylesheets to match the version of the schema being used for the agent.
- Make 'sender' configurable to support docker HOT 2
- Add * uuid: to the README and make sure all the other adapter commands are documented HOT 5
- `device` REST param does not work HOT 9
- Unclear logging at startup when using Docker HOT 1
- Ubuntu 20.04: Error building test package HOT 25
- * uuid command handling in agent not as expected HOT 19
- AgentConfiguration::monitorThread message reports wrong number of seconds
- Crash when editing device dataitem in DeviceModel HOT 4
- XML Schema validation with lxml HOT 1
- Simple WebSockets for subscriptions HOT 3
- Add validation transform to support 2.5 quality attribute for observations.
- MQTT INGRESS connection not working on V2.3.0.4 HOT 5
- How to set initial dataitem value in the stream HOT 2
- Agent Reconnecting to Broker repeatedly HOT 20
- Condition ID format and example not matching on Agent version 2.3? HOT 25
- DELETEing an already deleted asset responds with old asset value; expected MTConnectError HOT 10
- Check why asset counts are not being reported in agent HOT 3
- json schema for agent cfg HOT 8
- Add pretty handling to assets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppagent.