RsEventSource
The RsEventSource
provides a RESTful web-service API to the event system. The REST service is published at a configured endpoint and offers several service interfaces for event generation:
/data
: The data interface consumes XML-based events when invoked with a POST operation.
POST /nevisdp/event/data HTTP/1.0
Content-Type: application/xml
<eventData>
<data>
<name>key1</name>
<value>value1</value>Y
</data>
<data>
<name>key1</name>
<value>value1</value>Y
</data>
</eventData>
/query
: The query interface uses the URL's query parameter to create an event when invoked with the POST operation.
POST /nevisdp/event/query?key1=value1&key2=value2 HTTP/1.0
Authentication is handled by means of two-way SSL.
If the result of the triggered jobs is of interest, the WS can be invoked in a synchronous mode by including the matrix parameter „sync" in the URL:
POST /nevisdp/event/data;sync=true HTTP/1.0
POST /nevisdp/event/query;sync=true?key1=value1&key2=value2 HTTP/1.0
/xml
: The xml interface consumes arbitrary XML documents. For every call an event is generated. Data is extracted using X-path expressions.
POST /nevisdp/event/xml HTTP/1.0
Content-Type: application/xml
<user>
<name>Mustermann</name>
<firstName>Hans</firstName>
</user>
Configuration
Name | Type, usage constraints, defaults | Description |
---|---|---|
endpoint | required: paraVal default: none type: URL of the endpoint | The URL which is used to create the service. |
threads | optional: paraVal default: 10 type: integer | The number of threads the HTTP server uses to handle client requests. |
sslSettings | optional: paraMap default: none type: string/string | The SSL configuration settings used for this HTTP server. It uses the Java system property names to set up the key and trust stores. |
data | optional: paraMap default: none type: string/xpath | Only required when using the XML endpoint. Defines the event's data fields using XPath queries. The current node in the XPath queries is the document root received through the xml endpoint. |
xpathNamespaces | optional: paraMap default: none type: string/string (uri) | Register namespace prefixes to the specified URIs. Those prefixes are used to parse the XPath expressions. The URIs specified have to match the URIs in the XML document. |
Example
Register a RESTful web-service at URLs:
http://localhost:1234/nevisdp/rs/data
http://localhost:1234/nevisdp/rs/query
<eventSource name="rsEvents" type="RsEventSource">
<dp:paraVal name="endpoint" value="http://localhost:1234/nevisdp/rs" />
</eventSource>