-
-
Notifications
You must be signed in to change notification settings - Fork 7
Messaging
please note: for the functions on this page the user must be 'dba' or he must be in the 'jms' group
A JMS message can be sent as easy as calling the jms:send() function with three parameters:
messaging:send( $content as item(), $jmsMessageProperties as map(*)?,
$jmsConfiguration as map(*) )-
$contentis the actual data that must be sent. This can be an XML fragment or a XSD type -
$jmsMessagePropertiesare additional key-value pairs which can be used as meta-data -
$jmsConfigurationare the JMS configuration parameters.
Check the complete [example](Example send message) for inspiration.
Receiving messages is a bit more complex to do. First a higher-order-function (HoF) with 4 parameters need. to be defined:
handleMessage(
$content as item(), $additionalParameters as item()*,
$messageProperties as map(*), $jmsConfiguration as map(*)
)-
$contentis the actual data that will be received. This can be an XML fragment or a XSD type -
$additionalParametersare extra values set when the HoG is registered -
$messagePropertiesare additional key-value pairs which (meta-data) -
$jmsConfigurationis a report of the used JMS configuration parameters
In the second step the HoF need to be registered. This will initialise and start a data receiver process (JMS listener). When a message is delivered the HoF function is called.
messaging:register(
$callback as function(*), $additionalParameters as item()*,
$jmsConfiguration as map(*)
)-
$callbackis the HoF callback function -
$additionalParametersare additional values to be used by the HoF -
$jmsConfigurationare the JMS configuration parameters.
The complete [example](Example receive messages) shows how to register a HoF callback function.
Finally a number of functions are available to manage the receivers:
(:
Retrieve list of receiver ids.
:)
jms:list() as xs:integer*(:
Get report for specified receiver.
:)
jms:report($id as xs:integer) as node()A simple [example](Example receiver report) to show information about the receivers.
(:
Start specified receiver (when stopped)
:)
jms:start($id as xs:integer)(:
Stop specified receiver (when possible)
:)
jms:stop($id as xs:integer)(:
Stop and close specified receiver. Receiver cannot be started again.
:)
jms:close($id as xs:integer)