JMS Listeners¶
Virtual DataPort can subscribe to a JMS server (Java Message Service (JMS)) to listen to requests. Therefore, clients, instead of connecting to Virtual DataPort via JDBC, ODBC or a Web service, can send a request to a JMS server, which forwards it to Virtual DataPort. Then, the response is sent back to a queue or a topic of the JMS server, which forwards it to the client/s.
When creating a JMS listener you can set it up to:
Execute the VQL statements received from a JMS server.
Or, define a query with the interpolation variable (
@JMSEXPRESSION
) in the JMS listener and at runtime, replace this variable with the values received from the JMS server.
The output of a JMS listener can be either an XML
document or a
JSON
document.
Example of how the option a) works: a client sends a message such as
SELECT * FROM internet_inc WHERE iinc_id=1
to the JMS server.
The JMS server will forward this to Virtual DataPort, which will send a
response back like XML response message sent by a JMS listener if the
selected output is XML, or like JSON response message sent by a JMS
listener if the selected output is JSON.
<?xml version="1.0" encoding="UTF-8"?>
<response>
<item>
<iinc_id>1.00</iinc_id>
<summary>Error in ADSL router</summary>
<ttime>29-jun-2005 19h 19m 41s</ttime>
<taxid>B78596011</taxid>
<specific_field1>1</specific_field1>
<specific_field2>1</specific_field2>
</item>
</response>
[{
"IINC_ID": 1,
"SUMMARY": "Error in ADSL router",
"TTIME": "2005-06-29",
"TAXID": "B78596011",
"SPECIFIC_FIELD1": "1",
"SPECIFIC_FIELD2": "1"
}]
If the request is a DML sentence such as
ALTER VIEW incidents CACHE INVALIDATE
, the response will be
empty (see XML response message to a DML query and JSON response
message to a DML query)
<?xml version="1.0" encoding="UTF-8"?>
<response />
[]
Example of how option b) works: if you have created a JMS listener with the following query:
SELECT *
FROM incidents
WHERE taxid = '@JMSEXPRESSION'
When the listener receives a value like B78596014
, the Server will
execute the following query:
SELECT *
FROM incidents
WHERE taxid = 'B78596014'
If the query defined in the JMS listener does not contain the
@JMSEXPRESSION
variable, the value received from the listener is
ignored and the query will be executed “as is”.