Skip to main content

Republish (C)

If a client fails to receive a message NotificationMessage due to network packet loss, Republish have the server resend it from the cache:

OPCUA_API DarraUa_Status OPCUA_CALL DarraUa_Subscription_Republish(
DarraUa_SubscriptionHandle h,
uint32_t retransmit_sequence_number);
Generally, there is no need to call it.

This is primarily API used for SDK Send a notification when a sequence gap is detected internally, The user layer is generally not called directly.

When to Use​

  • The client detected SequenceNumber a gap and actively filled it.
  • After a temporary network outage, I want to retrieve the data from that period.
  • Debugging Phase / Testing SDK Republish Behavior

Usage​

DarraUa_Status st = DarraUa_Subscription_Republish(sub, /*seqNo*/ 12345);
if (UA_STATUS_IS_GOOD(st))
printf("Republish 请求已被服务端接受, 缺失数据会在下一次正常 Publish 收到\n");
else
printf("Republish failed: %s\n", DarraUa_StatusName(st));

Note​

  • The current version does not parse NotificationMessage content, Returns only the top level StatusCode — This API does not directly output data
  • Missing data will be received during the next normal publish and will follow the standard DarraUa_OnDataChange callback process.
  • The server only caches the most recent entries in the retransmit queue NotificationMessage; anything beyond that cannot be retrieved.
  • Error code UA_STATUS_BAD_MESSAGE_NOT_AVAILABLE indicates that the item SequenceNumber has exceeded the cache limit

Difference from TransferSubscriptions​

APIMeaning
RepublishThe server remembers the subscription; it's just that one message was missed.
Session_TransferSubscriptionsTaking Over the Subscriptions of the Old Session After a Session Reconnection

Next Step​