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

Hi @TestSolace - ah-ha! You definitely want Request/Reply messaging in that case. Have a look at the documentation link. You then simply set the response timeout to the value you need and if the consumer doesn’t reply within that timeout, the function returns a status code.

Use:
solClient_session_sendRequest()

To send your message. In your receiver, once you’ve got the incoming request, processed it, and you’re ready to send a response, use:

solClient_session_sendReply()

Remember that you should not call and sends from within the message receive callback - it should be called from the application thread.

solClient_rxMsgCallback_returnCode_t className::sessionMessageReceiveCallback(...) {
  processMsg();
  solClient_session_sendReply();   // DON'T DO THIS!
}

Do something like:

solClient_rxMsgCallback_returnCode_t className::sessionMessageReceiveCallback(...) {
  processMsg();
  appendMsgOnStructure();
}

// in application thread
while( getMsgInStructure() ) {
  solClient_session_sendReply();
}