Search code examples
opc-uaopc

opc hda - History Read, issue with continuationPoint when trying to read in batches


I have connected to OPC HDA Server using OPC milo java SDK and trying to read history in batches for single node by passing numValuesPerNode as 15 to ReadRawModifiedDetails(..) to read only 15 data values in batches. But I have noticed continuationPoint is null. I want to set this continuationPoint to read remaining data values nodes. this will be in loop to read 15 data values in batches. Below is the code. Can you please help to read data values in batches and continuationPoint having values?

    HistoryReadDetails historyDetails = new ReadRawModifiedDetails(
            false,
            dateStart,
            dateEnd,
            UInteger.valueOf(15),
            true
    );
    HistoryReadValueId nodeId= new HistoryReadValueId(
            new NodeId(1, 22),
            null,
            QualifiedName.NULL_VALUE,
            ByteString.NULL_VALUE
    );
    List<HistoryReadValueId> nodesToRead = new ArrayList<>();
    nodesToRead.add(nodeId);
    HistoryReadResponse historyReadResponse = client.historyRead(
            historyReadDetails,
            TimestampsToReturn.Both,
            false,
            nodesToRead
    ).get();

    HistoryReadResult[] historyReadResults = historyReadResponse.getResults();

Here historyReadResults returning continuationPoint as null.


Solution

  • There is a miss understanding on your side. ContinuationPoints are created from the server, if they can't supply all values in on request. It's not designed to get the next values.

    • Either you read all at once, the server will generate ContinuationPoints , if it's limit is exceed.
    • Or modifiy dateStart to be later then the last value from the previous call.