From ab4f89c7b22f5ac839f27d888832f9316e00e715 Mon Sep 17 00:00:00 2001 From: Simon Shanks Date: Thu, 2 Apr 2020 16:22:02 +0100 Subject: [PATCH] Made directrequest sync only. Ref: #30 --- README.md | 2 +- source/deltasolace.c | 2 ++ source/deltasolace.h | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9948894..1c226e3 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ Used for sending direct messages (Ref: https://docs.solace.com/PubSub-Basics/Dir K senddirectrequest_solace(K topic, K data, K timeout); ``` -Used for sending direct messages that require a reply. Works as per senddirect_solace with an extra integer timeout param that indicate the millisecons to block/wait. Returns a byte list of message received, containing the payload. Otherwise will be an int to indicate the return code. If value 7, the reply wasnt received. If value 2 then the reply is currently in progress +Used for sending direct messages that require a sync reply. Works as per senddirect_solace with an extra integer timeout param that indicate the millisecons to block/wait (must be greater than zero). Returns a byte list of message received, containing the payload. Otherwise will be an int to indicate the return code. If value 7, the reply wasnt received. ``` K callbackdirect_solace(K cb); diff --git a/source/deltasolace.c b/source/deltasolace.c index fdac60a..9fe9348 100644 --- a/source/deltasolace.c +++ b/source/deltasolace.c @@ -843,6 +843,8 @@ K senddirect_solace(K topic, K data) CHECK_PARAM_TYPE(topic,-KS,"senddirectrequest_solace"); CHECK_PARAM_DATA_TYPE(data,"senddirectrequest_solace"); CHECK_PARAM_TYPE(timeout,-KI,"senddirectrequest_solace"); + if (timeout->i <= 0) + krr((char*)"senddirectrequest_solace must be provided with timeout greater than zero"); solClient_opaqueMsg_pt msg_p = createDirectMsg(topic,data); solClient_opaqueMsg_pt replyMsg = NULL; solClient_returnCode_t retCode = solClient_session_sendRequest ( session_p, msg_p, &replyMsg, timeout->i); diff --git a/source/deltasolace.h b/source/deltasolace.h index c819c8c..fb9286e 100644 --- a/source/deltasolace.h +++ b/source/deltasolace.h @@ -110,10 +110,9 @@ K senddirect_solace(K topic, K data); * * @param topic Should be a string. The Topic to send data to. * @param data Can be a symbol or string or byte array. The payload of the message. - * @param timeout Integer type representing milliseconds to wait/block + * @param timeout Integer type representing milliseconds to wait/block, must be greater than 0 * @return Returns a byte list of message received, containing the payload. Otherwise will be an int - * to indicate the return code. If value 7, the reply wasnt received. If value 2 - * then the reply is currently in progress + * to indicate the return code. If value 7, the reply wasnt received. */ K senddirectrequest_solace(K topic, K data, K timeout);