How to put a timeout on receiving messages in asynchronous mode in C Solace API?

Hi @TomF ,
Thank you for the Answer.
I am trying to send a message and it should be received within the given timeout.
For ex: If i pass 10 sec as time out value,- within 10 second if the receiving window doesn’t receive the message, then it should throw an error message.
I did try with Time To live property but i am unable to achieve it. Can you please give any example on how to make it to work.
The way I am doing is:
Step 1-

I am creating and connecting to Solace session.
In the session i am enabling the “Respect message TTL property” in my session.
Props[propIndex++] = SOLCLIENT_ENDPOINT_PROP_RESPECTS_MSG_TTL;
Props[propIndex++] = SOLCLIENT_PROP_ENABLE_VAL;
Step 2:
I am setting the TTL value and trying to produce the Timeout.

solClient_int64_t ttl = 1;
solClient_bool_t dmqe = FALSE;
const char *text_p = “Hello World!”;
if ( SOLCLIENT_OK != solClient_msg_alloc ( &msg_p ) )
{ std::cout << “Failed to Allocate memory \n”; }
if ( SOLCLIENT_OK != solClient_msg_setDeliveryMode ( msg_p, SOLCLIENT_DELIVERY_MODE_DIRECT ) )
{ std::cout << “Failed to set message delivery mode”; }
if ( (solClient_msg_setTimeToLive ( msg_p, ttl ) ) != SOLCLIENT_OK ) { Do Something }
if ( ( solClient_msg_setDMQEligible ( msg_p, dmqe ) ) != SOLCLIENT_OK ) { Do something }
destination.destType = SOLCLIENT_TOPIC_DESTINATION;
destination.dest = TopicName.c_str() ;
if ( SOLCLIENT_OK != solClient_msg_setDestination ( msg_p, &destination, sizeof ( destination ) ) )
{ std::cout << “Failed to set destination \n”;}
if(SOLCLIENT_OK != solClient_msg_setBinaryAttachment ( msg_p, text_p, ( solClient_uint32_t ) strlen ( (char *)text_p ) ))
{ std::cout << “Failed to Add content to message \n”; }
if ( SOLCLIENT_OK != solClient_session_sendMsg ( session_p, msg_p ) )
{ std::cout << “Failed to Send message \n”; }
freeMessage:
if ( SOLCLIENT_OK != solClient_msg_free ( &msg_p ) )
{std::cout << “Failed to free message \n”;}

I don’t see the message expiring although i have given 1 second.
It is still received by the receiving function.

solClient_rxMsgCallback_returnCode_t
className::sessionMessageReceiveCallback(solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p)
{
printf ( “Received message:\n” );
solClient_msg_dump ( msg_p, NULL, 0 );
printf ( “\n” );
return SOLCLIENT_CALLBACK_OK;
}

Is my proccess wrong? I have set the message mode to DIRECT.
Do i need to add any other session property to it.