Show TOC

Publish Using a Streaming ConnectionLocate this document in the navigation structure

Connect to the ESP project using a streaming connection and publish data to one or more streams in that project.

Establishing a Publisher Connection
To establish a connection and publish data to the ESP project:
ws[s]://host:port/publish/workspace/project?<auth>
where
  • workspace is the workspace to which the project belongs
  • project is the name of the project you wish to publish to
  • <auth> is the authentication credentials. The only supported authentication type is username and password. For example, basic-authorization =’<base64 encoded user:password>. Encode your password using any third-party tool or library which performs base 64 encoding.
    Note You can include the authentication credentials in the authentication header instead of the URL as shown above. If you choose to include it in the header, specify it as Basic ’<base64 encoded user:password>.
Publish Using JSON Requests
Once you have established a connection to publish to the ESP project, your Web service client can send the following JSON message to the WebSocket provider:
{
"version": 1,
"stream": <stream>,
"flags": -,
"rows": 
  [
{ "ESP_OPS" : "INSERT|UPDATE|DELETE|UPSERT|SAFEDELETE", column : value, column : value, ... },
{ "ESP_OPS" : "INSERT|UPDATE|DELETE|UPSERT|SAFEDELETE", column : value, column : value, ... },
     ... 
  ]
}
Table 1: Message Fields
Field Description
version

This is an integer field. Specify the version of the message. The only supported value is 1.

stream

Specify the stream or window to which you wish to publish data.

flags

This is an integer field. This field is not currently used.

rows

An array of maps. Each map consists of a column name: column value pair. You can use the predefined column named ESP_OPS to specify the operation code. Valid operation codes are INSERT, UPDATE, DELETE, UPSERT, and SAFEDELETE.

The operation code is optional. If you do not specify one, the row is interpreted as an insert.

Examples
Here is an example of connecting and publishing to project test in workspace w1 with the credentials sap:sap.
ws://localhost:9092/publish/ws1/test?basic-authorization=c3liYXNlOnN5YmFzZQ=="
Note that the credentials are encoded.