Explainer
What the Historian SDK does with multiple event writes
Short answer
Keep one call per event: submit each value through the SDK's documented streaming method and let the SDK manage how accepted values reach the server. Counting calls does not count messages. Move to a collection-based write only when the API reference installed with your SDK version shows that exact signature and documents its completion behavior.
On this page
Keep one call per event. The AVEVA Historian SDK is built around a streaming write: its API reference documents AddStreamedValue on the HistorianAccess class for submitting values one at a time, and how accepted values are grouped and carried to the historian is the SDK's business, not something your loop controls. So you can post many events without building a bulk payload: feed them in one call at a time and let the SDK manage the wire. Adopt a collection-based write only when the API reference installed with your SDK release shows a signature that accepts a collection and documents its result and partial-failure behavior.
What the SDK reference actually documents #
The Historian SDK gives an application programmatic access to AVEVA Historian: tag and server configuration, queries against stored history, and write access for time-series values. The write side this question turns on is documented as a streaming method — AddStreamedValue, a member of the HistorianAccess class, one value per call.
Guidance quoted for this SDK names a plural AddStreamedValues() as well. Resolve that name before changing any code, against the authority that governs your build: the API reference installed with the SDK release your application links. A method name quoted in guidance is not a signature. Open the installed reference, or the object browser in your development environment, search the data-access classes, and check whether a method with that exact name exists and what arguments it accepts. If your installed reference shows only the singular method, the per-event loop is not a workaround — it is the documented interface, and there is nothing else to call.
The call boundary and the transport boundary are separate #
A streaming write path exists precisely for the loop you already have: one value per call into a client-side pipeline, with the SDK free to hold and group accepted values before they cross the wire. Your loop sets the submission rate. It does not set the message rate, the flush timing or the reconnect behavior — those are internals documented for your release, and the installed reference is where their limits live.
Two consequences matter in daily operation. First, counting calls measures your application, not the transport: ten thousand calls in a minute tell you nothing about how many messages reached the server. Second, a successful call and a stored event are different facts. A counter labeled submitted describes calls the local write path accepted; a counter labeled stored needs documented completion semantics or a readback. Between the two sits an intermediate state: an event can have left your queue without yet being visible to a query. When an operator reports a missing event, walk that state in order — submission result, completion, retrieval — before touching tag bindings or controller logic; an empty trend often traces to the collection path ahead of the historian rather than to the write calls, as in troubleshooting a historian trend that stays empty.
What a collection write changes, and what it does not #
A collection-based signature changes the call shape: your application hands over several values at once instead of one. By itself it changes no guarantee. Keep three layers apart:
| Layer | What it controls | What it guarantees |
|---|---|---|
| Application work unit | How your program organizes events: queues, retries, tracking | Nothing about the wire or about storage |
| SDK transport grouping | Where accepted values wait and how they travel | Whatever the reference for your release documents; grouping is an implementation detail, not a contract |
| Transaction | Whether a group succeeds or fails together | All-or-nothing, and only where a documented transactional interface exists |
Internal grouping is not transactional behavior: a bundled submission can still land event by event, with one rejection among acceptances. That gives a mechanical decision. Keep the per-event streaming loop as your write path. Consider a collection method only when the installed reference shows that exact signature and documents how it reports results and partial failures, and adopt it for call-shape reasons — fewer calls to track — not for transport or transaction behavior you have not verified.
Buffering exists one layer out as well: a collector that holds records through a link outage answers the same design question at the edge, covered in choosing an edge data path with store-and-forward for periodic records.
A 600-event proof run on one test tag #
Example inputs, chosen so every step can be checked; this is a test design, not a measured result. Create one integer tag for the test. Queue 600 events for it, each 100 ms after the previous, which spans 600 × 100 ms = 60 s of history. Submit at 10 events per second, so the run also takes 60 s: 10 events/s × 60 s = 600 events.
The rule the run proves: queued must equal accepted plus immediate rejections, and accepted must equal rows returned by a readback on the exact tag. Record five numbers as the run executes: queued (600), accepted by the streaming method (600), immediate rejections (0), completion errors (0), and rows returned by a query on that tag over the window padded by 1 s at each end, retrieved as raw stored values rather than interpolated samples (600).
Decision: with 600 accepted and 600 returned, the write path is proven for that tag and that code, so keep the per-event loop. If the readback returns fewer rows than were accepted, the fault sits in completion or retrieval — fix that layer before touching the loop. Then repeat the run at your production pace, because a pass at the test pace says nothing about a faster line.
Writing the loop so failures stay traceable #
- Validate each event before submission: the target tag exists, the timestamp format is right, the value type matches the tag, and any required quality is set. A working connection cannot repair a wrong tag or a rejected value.
- Capture the outcome of every call. Keep the event's original identity in your own tracking so a failure traces back to its input.
- Track four states separately: queued, submitted, failed, verified. Never label an accepted call as stored; verified means a readback found it.
- Shut down by the book: stop queueing, let the documented completion path drain, follow the SDK's documented disposal sequence, and only then exit the process. Anything still held inside the process is lost with it.
- Plan retries before you enable them. Retrying a whole work unit after an ambiguous failure can resubmit values already stored, and retrying rejected data in a tight loop hides a tag or value error while loading the channel. Retry only events you can identify as not accepted.
Verification is a retrieval question. A query that returns values between your event timestamps may be showing interpolated samples rather than stored events — the same events-versus-samples confusion that makes trends load slowly, covered in separating stored events from interpolated samples when trends load slowly. Read back the exact tags and timestamps you submitted and compare values one for one.
Questions asked
Does one call per event mean one network message per event?
No. The call boundary and the transport boundary are separate: your loop sets the submission rate, and how the SDK groups accepted values for the wire is its own documented behavior for your release. Do not tune the loop for efficiency you have not measured; if wire load matters, measure it at the server or on the network, not by counting calls.
How do I check whether my installed SDK has a collection-based write?
Open the API reference installed with your SDK for your Historian release and search the data-access classes for a write method whose signature accepts a collection of values. Confirm how it reports results and partial failures before adopting it. If no such signature exists in the installed reference, there is nothing to call, so keep the per-event streaming loop.
Is a streamed group of events a transaction?
No. Neither the call grouping nor any transport grouping is all-or-nothing; each event is accepted or rejected on its own. A transaction requires a documented transactional interface, and if your installed reference shows none for the streaming path, treat every event as an independent write and track failures event by event.
What happens to events still in the SDK if the application is killed?
Anything still held inside the application process is lost with the process; only events the SDK has completed against the historian are safe. Stop queueing first, let the documented completion path drain, follow the documented disposal sequence, and exit normally. A hard kill is not a completion mechanism and should never be your shutdown design.