onOldMessagesReceived

Called with one batch of the topic's persisted messages after subscribing.

Fired on the main thread. Only messages published with setPersist enabled are persisted; a topic with none fires no history callback at all.

History is replayed in server-paced batches, so this is called once per batch with a partial list — append the messages to what you already hold rather than replacing it. This method carries no end-of-replay signal; override onOldMessagesReceived when you need to know that history is complete.

Parameters

messages

a List of PubSubMessage objects representing the historical messages in this batch


Called for each batch of the topic's persisted messages after subscribing.

Fired on the main thread. History streams in server-paced batches; the final batch carries info.isLast() == true. A topic with no history fires no history callback at all — do not wait on isLast to detect an empty topic.

Both subscribe and the PubSubSubscribeOptions overload replay history this way; the options change only how much of it is replayed, never how it is delivered.

The default implementation forwards each batch to onOldMessagesReceived, so a listener written against that method receives every message without overriding this one.

Parameters

messages

the historical messages in this batch

info

batch metadata — info.isLast() is true on the final batch, meaning history is complete