In the callback function definition, there is no provision to know whether a received message was 'retained' (only topic, payload and length).
The data should be available in the retain flag of the message.
A subscribing client can identify if a received message was a retained message or not, because the broker sends out retained messages with the retained flag still set to true. A client can then decide on how to process the message.