Contents
This topic describes the use of the ETP Adapter suite in a sample application to query and update data in an ETP server. For more information about this operator, see ETP Adapters.
Note
The ETP adapters are provided for Microsoft Windows systems only.
In order to run correctly, the adapters in this sample require that the Microsoft .NET Framework 4.8 or later be installed on your machine.
The sample's configuration file must be edited prior to running the sample to point to a working, accessible ETP server (with, optionally, additional settings to specify any required authentication credentials).
To configure the sample to connect to a different server, modify the server-url
entry of src/main/configurations/ETP.conf
to point to the ETP server of your
choice. If this server requires authentication or use of a proxy server, you will
also need to modify these values as applicable:
-
username
-
password
-
proxy-host
-
proxy-port
-
proxy-username
-
proxy-password
This sample demonstrates the adapters in the ETP adapter suite:
-
Control
-
Discovery
-
Get
-
Streaming
In StreamBase Studio, import this sample with the following steps:
-
From the top-level menu, select
> . -
Enter
etp
to narrow the list of options. -
Select ETP adapters from the IoT Adapters category.
-
Click
.
StreamBase Studio creates a project for the ETP adapter sample in your current Studio workspace.
The steps to run this sample in Studio are as follows:
-
In the Project Explorer view, open this sample's folder.
Keep an eye on the bottom right status bar of the Studio window. Make sure any
Updating
,Downloading
,Building
, orRebuild project
messages finish before you proceed. -
Open the
src/main/configurations
folder. -
Open the
ETP.conf
configuration file, and edit theserver-url
setting to point to a running ETP server. You may also need to edit other settings such asusername
andpassword
, or the proxy-related entries, depending on your ETP server's connection requirements. -
Open the
src/main/eventflow/
folder.packageName
-
Open the
etp.sbapp
file and click the Run button. This opens the SB Test/Debug perspective and starts the module. -
Wait for the Control operator to issue a status tuple indicating the connection was successful. If a connection problem occurs the console will provide more information.
-
In the Manual Input view, select the
DiscoveryIn
input stream, and entereml://
in the uri field, then click . This will return one or more tuples on theDiscoveryResults
output stream containing the entries representing all the top-level nodes available on your ETP server. For each of these entries, you can feed the value of theresource.uri
field back to theDiscoveryIn
stream to drill down and browse that node's children nodes. -
In the manner described in the previous step, drill down to a child node whose
contentType
is included in the list returned initially by the Control operator'sConnected
status tuple in its serverInfo.supportedObjects field. Use the node'suri
field's value as the input for theGetIn
stream'suri
field, to query the node's value. -
In the Manual Input view, select the
StreamingIn
input stream, and enter the following field values:-
command
:describe
-
uris
: The value of theDiscoveryResults
'uri
field that you used in the previous step
Click
, and observe thatStreamingStatus
output stream acknowledged the success of the operation, and theStreamingMetadataResults
output stream also emitted a tuple containing the description of the requested node. Itschannels
field contains a list of all subscribable values. You can use thechannelID
value of one or more of these entries to subscribe to real-time updates of these values by setting theStreamingIn
stream'scommand
field tostreamingStart
and create entries in thechannelInfos
list field, taking care to also set thereceiveNotifications
field's value totrue
(otherwise only a snapshot value will be returned rather than real-time updates). To initiate a subscription and start getting real-time updates on those value from the operator'sStreamingDataResult
output port. -
-
You can stop the subscriptions initiated in the previous step by setting the
command
field tostreamingstop
and filling in thechannelIDs
field with the list of channelID values for which you no longer wish to receive updates. -
When done, press F9 or click the Terminate EventFlow Fragment button.
This sample contains the following files:
-
The sample EventFlow application,
etp.sbapp
, located in thesrc/main/eventflow/
folder.packageName
-
The adapter configuration file,
ETP.conf
, located insrc/main/configurations
. -
This
Readme
file, in plain text and HTML formats.
When you load the sample into StreamBase® Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
Load this sample in StreamBase® Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:
studio-workspace
/sample_etp
See Default Installation
Directories for the default location of studio-workspace
on your system.