Date: Fri, 29 Mar 2024 11:34:02 +0100 (CET) Message-ID: <1572334345.153.1711708442692@vmisdata19.uni-oldenburg.de> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_152_415572067.1711708442692" ------=_Part_152_415572067.1711708442692 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The create stream statement is used to tell Odysseus where the data come= s from, this normally opens a connection to a source, e.g. a sensor or serv= er.
The stream always consists of a name (here: "category") and a schema:
CREATE STREAM c= ategory (id INTEGER, name STRING, description STRING, parentid INTEGER) ...= .
Then, it is followed by a connection-property that tells how/where the s= tream can be accessed. Most used are the channel format and the generic acc= ess framework (which we recommend)
Odysseus has a built-in byte-based format for transfering data. This is,= for example, used by the nexmark example. This is called a "CHANNEL"-conne= ction and looks like follows:
CREATE STREAM n= exmark:person (timestamp STARTTIMESTAMP,id INTEGER,name STRING,email STRING= ,creditcard STRING,city STRING,state STRING) CHANNEL localhost : 65440
However, the recommended and new way is a generic access, which offers d= ifferent protocols, wrappers etc. as described in Access framework. An example would be:
CREATE = STREAM nexmark:person (timestamp STARTTIMESTAMP, id INTEGER, name STRING, e= mail STRING, creditcard STRING, city STRING, state STRING) WRAPPER 'GenericPush'=20 PROTOCOL 'SizeByteBuffer' TRANSPORT 'NonBlockingTcp' DATAHANDLER 'Tuple' OPTIONS ( 'port' '65440', 'host' 'odysseus.offis.uni-oldenburg.de', 'By= teOrder' 'Little_Endian')
As you may see, there is a direct mapping between the needed parameters.= So you can use each Protoco= l Handler and Data handler= a> and Transport Handler in a CREATE STREAM statement. Thus, the wrapper must be also existing, wh= ich are e.g. GenericPush or GenericPull (see also Access framework). The Options-parameter is optio= nal and is a comma separated list of key value pairs that are enclosed by q= uotation marks.
You can also create a view, which is a logical view on a result of a con= tinuous query.
CREATE = VIEW nexQuery FROM ( SELECT b.auction, DolToEur(b.price) AS euroPrice, b.bidder, b.datetime = FROM nexmark:bid [UNBOUNDED] AS b )
This allows you to resuse the query, e.g. as follows:
SELECT = * FROM nexQuery
Similar to creating sources for incoming data by "create stream", you ca= n also create sinks for outgoing data. The notation is very similar to "cre= ate stream". Since it is also based on the Access Framework, you can also need different Protocol Handler and Data handler and Transport Handler. For example, the following c= reates a sink that writes a CSV file:
CREATE = SINK writeout (timestamp STARTTIMESTAMP, auction INTEGER, bidder INTEGER, d= atetime LONG, price DOUBLE) WRAPPER 'GenericPush' PROTOCOL 'CSV' TRANSPORT 'File' DATAHANDLER 'Tuple' OPTIONS ( 'filename' 'E:\test')