Skip to content

Commit 474cffd

Browse files
committed
Function to get solace api info. Ref: #35
1 parent ab4f89c commit 474cffd

File tree

4 files changed

+35
-11
lines changed

4 files changed

+35
-11
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ Destroys the previously created session.
9090

9191
### Utility Functions
9292

93+
```
94+
K version_solace(K unused);
95+
```
96+
Returns a dictionary of Solace API version info. Useful for checking current deployment/build versions.
97+
98+
9399
```
94100
K iscapable_solace(K capabilityName);
95101
```

examples/sol_capabilities.q

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ soloptions:`SESSION_HOST`SESSION_VPN_NAME`SESSION_USERNAME`SESSION_PASSWORD!(`$f
88
.solace.setsessioncallback_solace:`libdeltasolace 2:(`setsessioncallback_solace;1)
99
.solace.setflowcallback_solace:`libdeltasolace 2:(`setflowcallback_solace;1)
1010
.solace.init_solace:`libdeltasolace 2:(`init_solace;1)
11+
.solace.version_solace:`libdeltasolace 2:(`version_solace;1)
1112
.solace.getcapability_solace:`libdeltasolace 2:(`getcapability_solace;1)
1213
.solace.destroy_solace:`libdeltasolace 2:(`destroy_solace;1)
1314

@@ -19,6 +20,8 @@ sessionUpdate:{[eventType;responseCode;eventInfo]r:enlist each (`int$eventType;r
1920
flowUpdate:{[eventType;responseCode;eventInfo;destType;destName]r:enlist each (`int$eventType;responseCode;eventInfo;destType;destName);0N!("FLOW EVENT: ####";r);r};
2021
.solace.setflowcallback_solace[`flowUpdate];
2122

23+
("API Version Info: ";.solace.version_solace[1i])
24+
2225
.solace.init_solace[soloptions]
2326

2427
c:`$first params`opt

source/deltasolace.c

+21-11
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ K kdbCallback(I d)
234234
solClient_msg_getSenderTimestamp(msg,&sendTime);
235235
if (sendTime>0)
236236
sendTime=(sendTime*1000000l)-(946684800l*1000000000l);
237-
237+
238238
K keys = ktn(KS,4);
239239
kS(keys)[0]=ss((char*)"isRedeliv");
240240
kS(keys)[1]=ss((char*)"isDiscard");
@@ -286,16 +286,6 @@ K kdbCallback(I d)
286286
return (K)0;
287287
}
288288

289-
K sendack_solace(K flow, K msgid)
290-
{
291-
CHECK_PARAM_TYPE(flow,-KJ,"sendack_solace");
292-
CHECK_PARAM_TYPE(msgid,-KJ,"sendack_solace");
293-
solClient_opaqueFlow_pt solFlow = (solClient_opaqueFlow_pt)flow->j;
294-
solClient_msgId_t solMsgId = msgid->j;
295-
solClient_returnCode_t retCode = solClient_flow_sendAck (solFlow, solMsgId);
296-
return ki(retCode);
297-
}
298-
299289
/* The message receive callback function is mandatory for session creation. Gets called with msgs from direct subscriptions. */
300290
solClient_rxMsgCallback_returnCode_t defaultSubCallback ( solClient_opaqueSession_pt opaqueSession_p, solClient_opaqueMsg_pt msg_p, void *user_p )
301291
{
@@ -632,6 +622,16 @@ K destroy_solace(K a)
632622
return ki(SOLCLIENT_OK);
633623
}
634624

625+
K version_solace(K unused)
626+
{
627+
solClient_version_info_pt version = NULL;
628+
solClient_version_get (&version);
629+
K keys = knk(3,ks((char*)"solVersion"),ks((char*)"solDate"),ks((char*)"solVariant"));
630+
K vals = knk(3,ks((char*)version->version_p),ks((char*)version->dateTime_p),ks((char*)version->variant_p));
631+
K dict = xD(keys,vals);
632+
return dict;
633+
}
634+
635635
K setsessioncallback_solace(K callbackFunction)
636636
{
637637
CHECK_PARAM_TYPE(callbackFunction,-KS,"setsessioncallback_solace");
@@ -1061,6 +1061,16 @@ K subscribepersistent_solace(K type, K endpointname, K topicname, K callbackFunc
10611061
return ki(SOLCLIENT_OK);
10621062
}
10631063

1064+
K sendack_solace(K flow, K msgid)
1065+
{
1066+
CHECK_PARAM_TYPE(flow,-KJ,"sendack_solace");
1067+
CHECK_PARAM_TYPE(msgid,-KJ,"sendack_solace");
1068+
solClient_opaqueFlow_pt solFlow = (solClient_opaqueFlow_pt)flow->j;
1069+
solClient_msgId_t solMsgId = msgid->j;
1070+
solClient_returnCode_t retCode = solClient_flow_sendAck (solFlow, solMsgId);
1071+
return ki(retCode);
1072+
}
1073+
10641074
K unsubscribepersistent_solace(K type, K endpointname, K topicname)
10651075
{
10661076
CHECK_PARAM_TYPE(endpointname,-KS,"unsubscribepersistent_solace");

source/deltasolace.h

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ extern "C" {
2222
*/
2323
K init_solace(K options);
2424

25+
/**
26+
* Provides a dictionary of solace API version details.
27+
*/
28+
K version_solace(K unused);
29+
2530
/**
2631
* Should be called prior to init_solace. Provides notifications on session events
2732
* @param callbackFunction The kdb function to call for session events. The callback function will use 3 params - eventtype, responsecode, eventinfo.

0 commit comments

Comments
 (0)