republish
If a client does not receive a request NotificationMessage due to network packet loss, the republish server should resend it:
def republish(self, retransmit_sequence_number: int) -> StatusCode: ...
Generally, there is no need to call this.
Under normal circumstances, the SDK's internal AutoPublish (ua.auto_publish) continuously pulls Publish, and the client is unaware of it. This API is used only in special scenarios (active packet recovery / debugging).
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
st = sub.republish(retransmit_sequence_number=12345)
if st == StatusCode.Good:
print("Server confirmed retransmit, data will arrive in next Publish")
else:
print(f"Republish failed: {st.name}")
Implementation Limitations (Must Read)
- The current implementation does not parse the returned content NotificationMessage:
republishOnly send a request and return a status code; the data will be received "via the next normal publish," as described SDK, and will still go through the callbackdata_changed, so the client does not need to take any special action. - Returns means only
StatusCode.GoodThe server has confirmed that it will resend the request., There is no guarantee that the data can be recovered. - The server itself determines the depth of the cache refresh; this value cannot be read SDK from the client side —— Don't assume that "the most recent N entries will definitely be retrieved.". If the cache is exceeded, the server will return a failure status code.
- Failure status codes are returned by the server andSDK passed through as-is. On the Python side, in the enumeration
StatusCode...NoneBadMessageNotAvailableFor this member, usest.nameto see the actual name returned.
Difference from transfer_subscriptions
| API | Meaning |
|---|---|
| republish | The server remembers the subscription; it's just that one message was missed. |
| transfer_subscriptions | Taking Over the Subscriptions of the Old Session After a Session Reconnection |
For more information, see Session Overview.