.solace. Solace interface
Event notifications
setSessionCallback Set a callback function for session events
setFlowCallback Set a callback function for flow events
Connect-disconnect
init Connect to and create a session
destroy Destroy a previously created session
Endpoint management
createEndpoint Create an endpoint from a session
destroyEndpoint Destroy an endpoint from a session
endpointTopicSubscribe Add a topic subscription to an existing endpoint
endpointTopicUnsubscribe Unsubscribe from a topic on an endpoint
Direct messaging
sendDirect Send a direct message
sendDirectRequest Send a direct message requiring a sync response
Topic subscription
setTopicMsgCallback Set callback for messages from topic subscriptions
setTopicRawMsgCallback Set callback for messages from topic subscriptions
subscribeTopic Subscribe to a topic
unSubscribeTopic Unsubscribe from a topic
Guaranteed/persistent messaging
sendPersistent Send a persistent message onto a queue or topic
sendPersistentRequest Send a guaranteed message for a synchronous reply
Flow bindings
setQueueMsgCallback Set callback for when message sent to an endpoint
setQueueRawMsgCallback Set callback for when message sent to an endpoint
bindQueue Bind to a queue
sendAck Acknowledge processing of a message
unBindQueue Remove subscription/binding created with bindQueue
Message functions
getPayloadAsBinary Get the binary part of the Solace message
getPayloadAsString Get the string part of the Solace message
getPayloadAsXML Get the XML part of the Solace message
Utility functions
getCapability Value of the specified capability for the session
version Current version of the build/deployment
Associate the provided function with session events
.solace.setSessionCallback callbackFunctionWhere callbackFunction is a symbol denoting a function in your q session with arguments:
- event type of event (integer)
- response code returned for some event, otherwise zero (integer)
- further information about the event (string)
associates the named function with session events, such as connection notifications or session errors.
Associate the provided function with flow events
.solace.setFlowCallback callbackFunctionWhere callbackFunction is a symbol denoting a function in your q session with arguments:
- type of event (integer)
- response code returned for some events, otherwise zero (integer)
- further information about the event (string)
- destination type (integer)
- destination name (string)
Connect to and create a session
.solace.init optionsWhere options is a symbol-to-symbol dictionary mapping Solace properties to their values.
Common properties are SESSION_HOST, SESSION_VPN_NAME, SESSION_USERNAME, SESSION_PASSWORD, SESSION_RECONNECT_RETRIES and SESSION_SSL_TRUST_STORE_DIR.
Destroy a session
.solace.destroy[]Destroys the current session.
Endpoint-management functions may be used to create or destroy endpoints from the kdb+ session. In some deployments, endpoints may already be created for you by an admin.
.solace.createEndpoint[options;provFlags]Create an endpoint
Where
optionsis a symbol-to-symbol dictionary mapping Solace endpoint properties to their values.provFlagsis the provision flag used by Solace (integer)
provisions an endpoint on the appliance from the session.
Destroy an endpoint
.solace.destroyEndpoint[options;provFlags]Where
optionsis a symbol-to-symbol dictionary mapping Solace endpoint properties to their valuesprovFlagsis the provision flag used by Solace (integer)
destroys an endpoint from the session.
Add a topic subscription to an existing endpoint
.solace.endpointTopicSubscribe[options;provFlags;topic]Where
optionsis a symbol-to-symbol dictionary mapping Solace endpoint properties to their valuesprovFlagsis the provision flag used by Solace (integer)topicis a topic subscription (symbol or string)
💡 Topic subscriptions can be added to queues or remote clients.
Unsubscribe from a topic on an endpoint
.solace.endpointTopicUnsubscribe[options;provFlags;topic]Where
optionsis a symbol-to-symbol dictionary mapping Solace endpoint properties to their valuesprovFlagsis the provision flag used by Solace (integer)topicis a topic subscription (symbol or string)
💡 Un-subscriptions from topics may be from either queues or remote clients.
Send a direct message
.solace.sendDirect[topic;data]Where
topicis the topic to which the message is sent (string)datais the message payload (string, symbol or byte array)
Each message will automatically be populated with message-eliding eligibility enabled and dead message queue (DMQ) eligibility enabled.
Send a direct message which requires a sync reply
.solace.sendDirectRequest[topic;data;timeout;replyType;replyDest]Where
| argument | type | value |
|---|---|---|
| topic | string | topic to which message is sent |
| data | string, symbol, or byte vector | message payload |
| timeout | integer | milliseconds to block/wait (> zero) |
| replyType | integer | reply destination type |
| replyDest | symbol | topic or queue a reply to this message goes to (empty for default session topic) |
returns either
- the payload (byte array)
- an integer error code (integer)
For example, if the result is 7, the reply wasn’t received.
Set callback for messages received from topic subscriptions
.solace.setTopicMsgCallback callbackFunctionWhere callbackFunction is a q function with arguments:
-
destination (symbol)
-
message binary payload (byte vector)
-
a dictionary:
key type value isRedeliv boolean whether redelivered isDiscard boolean whether messages discarded prior to the current message
(Congestion discards only; not affected by message eliding.)isRequest boolean whether client expects a reply
(In this case the function should return a byte array.)sendTime timestamp client’s send time, if populated
registers a q function to be called on receipt of messages from topic subscriptions.
If the dictionary value for isRequest is true, the function should return with the response message contents (a byte list) to indicate the sender requests a reply.
Set callback for messages received from topic subscriptions
.solace.setTopicRawMsgCallback callbackFunctionWhere callbackFunction is a function with arguments:
-
destination (symbol)
-
a pointer (long) to the underlying Solace message (can be used within the callback with the functions to get the payload based on the sender’s type e.g.
getPayloadAsXML,getPayloadAsString, etc) -
a dictionary:
key type content isRedeliv boolean whether redelivered isDiscard boolean whether messages discarded prior to the current message
(Congestion discards only; not affected by message eliding.)isRequest boolean whether client expects a reply
(In this case the function should return a byte array.)sendTime timestamp client’s send time, if populated
registers callbackFunction to be called on receipt of messages from topic subscriptions.
If the dictionary value for isRequest is true, the function should return with the response message contents (a byte list) to indicate the sender requests a reply.
This is an alternative to .solace.setTopicMsgCallback.
Subscribe to a topic
.solace.subscribeTopic[topic;isBlocking]Where
topicis the topic to subscribe to (string)isBlockingis whether the subscription is blocking (boolean)
Solace format wildcards (*, >) can be used in the topic subscription value.
If isBlocking is true then block until confirm or true to get session event callback on sub activation.
Unsubscribe from a topic
.solace.unSubscribeTopic topicWhere topic is a string denoting a topic, unsubscribes from it.
.solace.unSubscribeTopic "topic1"Send a persistent message onto a queue or topic
.solace.sendPersistent[destType;dest;data;correlationId]Where
| argument | type | value |
|---|---|---|
| destType | integer | destination type |
| dest | symbol | destination queue or topic |
| data | char/symbol/byte vector | message payload |
| correlationId | symbol | a Correlation ID to be carried in the Solace message headers unmodified – may be used for peer-to-peer message synchronization; null for default behavior |
Send a guaranteed message requiring a synchronous reply
.solace.sendPersistentRequest[destType;dest;data;timeout;replyType;replydest]Where
| argument | type | value |
|---|---|---|
| destType | integer | destination type |
| dest | symbol | destination queue or topic |
| data | char/symbol/byte vector | message payload |
| timeout | integer | milliseconds to block/wait (> zero) |
| replyType | integer | reply destination type |
| replyDest | symbol | topic/queue a reply to this message goes to (empty for default session topic) |
returns either
- the payload (byte array)
- an error code (integer)
For example, if the result is 7, the reply was not received.
Set a callback function for when a message is sent to an endpoint
.solace.setQueueMsgCallback callbackFunctionWhere callbackFunction is a q function with arguments:
-
flow destination: the queue from which the subscription originated (symbol)
-
message payload (byte vector)
-
a dictionary:
key type value destType integer destination type destName string destination name replyType integer reply destination type replyDest string topic/queue to reply to correlationId string original message’s correlation ID msgId long used for sending acks
Set a callback function for when a message is sent to an endpoint
.solace.setQueueRawMsgCallback callbackFunctionWhere callbackFunction is a q function with arguments:
-
flow destination: the queue from which the subscription originated (symbol)
-
a pointer (long) to the underlying Solace message (can be used within the callback with the functions to get the payload based on the sender’s type e.g.
getPayloadAsXML,getPayloadAsString, etc.) -
a dictionary:
key type value destType integer destination type destName string destination name replyType integer reply destination type replyDest string topic/queue to reply to correlationId string original message’s correlation ID msgId long used for sending acks
This is an alternative to .solace.setQueueMsgCallback.
Bind to a queue
.solace.bindQueue bindPropsWhere bindProps is a symbol-to-symbol dictionary mapping the Solace bind properties to their values.
Acknowledge processing of a message
.solace.sendAck[endpointname;msgid]Where
endpointnameis the name of an endpoint (string)msgidis the ID of a message (long)
This function allows you to acknowledge messages.
It should be called by the subscriptions callbackFunction to acknowledge that the message has been processed,
in order to prevent the message from being consumed on a subsequent subscription.
This is only required when you wish to take control and run with auto acks off (e.g. FLOW_ACKMODE disabled in the flow binding).
Remove a subscription/binding
.solace.unBindQueue endpointnameWhere endpointname is is a string naming an endpoint,
removes a subscription or binding created via .solace.bindQueue.
.solace.unBindQueue "endpoint1"Get binary part of a Solace message
.solace.getPayloadAsBinary msgWhere msg is a message provided in the callback function registered with setQueueRawMsgCallback or setTopicRawMsgCallback,
returns either
- a string
- a long representing the Solace error code if the payload could be retrieved as binary
This API defaults to sending messages as binary (of which string/XML/etc can be used.)
Get string part of a Solace message
.solace.getPayloadAsString msgWhere msg is a message provided in the callback function registered with setQueueRawMsgCallback or setTopicRawMsgCallback,
returns either
- a string
- a long representing the Solace error code if the payload was not a string Solace type
This corresponds to the Solace sender setting the payload using the Solace function to set the payload as a string. (There is no conversion to string by this API.)
Get XML part of a Solace message
.solace.getPayloadAsXML msgWhere msg is a message provided in the callback function registered with setQueueRawMsgCallback or setTopicRawMsgCallback,
returns either
- a byte vector
- a long representing the Solace error code if the payload was not an XML Ssolace type
This corresponds to the Solace sender setting the payload using the Solace function to set the payload as XML. (There is no conversion to XML by this API.)
Retrieve the value of the specified capability for the session
.solace.getCapability capabilityNameWhere capabilityName is a symbol or string denoting a capability returns the capability value for the session.
The returned value type will vary depending on the capability requested.
Current version of the build/deployment
.solace.version[]Returns Solace API version info as a dictionary.
-1 null
0 topic
1 queue
2 temp topic
3 temp queue