Reputation: 11
I use ManagedSubscription to subscribe to thousands of tokens, and dozens of tokens will change value at the same time. I observe that the change of the tokens will be read every four seconds, can I advance this interval?
Sorry, I am not a native English speaker, please forgive me if I have grammar problems
Code snippet:
private void handlerMultipleNodeData(OpcUaClient client, List<String> batchIdentifiers) {
try {
ManagedSubscription subscription = ManagedSubscription.create(client);
List<NodeId> nodeIdList = new ArrayList<>();
for (String id : batchIdentifiers) {
nodeIdList.add(new NodeId(3, id));
}
List<List<NodeId>> partitions = Lists.partition(nodeIdList, 100);
for (List<NodeId> partition : partitions) {
subscription.createDataItems(partition);
}
subscription.addDataChangeListener((items, values) -> {
for (int i = 0; i < items.size(); i++) {
HandleDistribute(client, items.get(i).getNodeId().getIdentifier().toString(), values.get(i).getValue().getValue());
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Log fragment:
elAdmin- 2024-03-26 15:12:35 [milo-shared-thread-pool-7] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[2]."paramValue" 改变值5.12
elAdmin- 2024-03-26 15:12:35 [milo-shared-thread-pool-7] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[3]."paramValue" 改变值32
elAdmin- 2024-03-26 15:12:38 [milo-shared-thread-pool-8] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[4]."paramValue" 改变值5.19
elAdmin- 2024-03-26 15:12:38 [milo-shared-thread-pool-8] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[5]."paramValue" 改变值82
elAdmin- 2024-03-26 15:12:42 [milo-shared-thread-pool-8] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[6]."paramValue" 改变值5.03
elAdmin- 2024-03-26 15:12:42 [milo-shared-thread-pool-8] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[7]."paramValue" 改变值39
elAdmin- 2024-03-26 15:12:46 [milo-shared-thread-pool-7] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[8]."paramValue" 改变值5.08
elAdmin- 2024-03-26 15:12:46 [milo-shared-thread-pool-7] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[9]."paramValue" 改变值27
elAdmin- 2024-03-26 15:12:54 [milo-shared-thread-pool-7] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[10]."paramValue" 改变值5.06
elAdmin- 2024-03-26 15:12:54 [milo-shared-thread-pool-7] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[11]."paramValue" 改变值41
elAdmin- 2024-03-26 15:12:58 [milo-shared-thread-pool-8] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[12]."paramValue" 改变值5.02
elAdmin- 2024-03-26 15:12:58 [milo-shared-thread-pool-8] INFO c.u.o.l.e.IdentifierSubscriptionEvent - 点位;"MES_Mutually"."MES"."OP140"."outbound"."S31-400KM"."params"[13]."paramValue" 改变值33
Upvotes: 1
Views: 51
Reputation: 7005
You are creating Subscriptions and MonitoredItems using the default publishing interval and sampling interval (1000ms each, respectively), so any delay is likely because of the server.
You can check to see if the server revised either of these values when the Subscription or MonitoredItems were created, but even if it hasn't, the server may simply not be able to sample as fast as requested.
Upvotes: 0