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
etpto 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 projectmessages finish before you proceed. -
Open the
src/main/configurationsfolder. -
Open the
ETP.confconfiguration file, and edit theserver-urlsetting to point to a running ETP server. You may also need to edit other settings such asusernameandpassword, or the proxy-related entries, depending on your ETP server's connection requirements. -
Open the
src/main/eventflow/folder.packageName -
Open the
etp.sbappfile 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
DiscoveryIninput stream, and entereml://in the uri field, then click . This will return one or more tuples on theDiscoveryResultsoutput 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.urifield back to theDiscoveryInstream 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
contentTypeis included in the list returned initially by the Control operator'sConnectedstatus tuple in its serverInfo.supportedObjects field. Use the node'surifield's value as the input for theGetInstream'surifield, to query the node's value. -
In the Manual Input view, select the
StreamingIninput stream, and enter the following field values:-
command:describe -
uris: The value of theDiscoveryResults'urifield that you used in the previous step
Click , and observe that
StreamingStatusoutput stream acknowledged the success of the operation, and theStreamingMetadataResultsoutput stream also emitted a tuple containing the description of the requested node. Itschannelsfield contains a list of all subscribable values. You can use thechannelIDvalue of one or more of these entries to subscribe to real-time updates of these values by setting theStreamingInstream'scommandfield tostreamingStartand create entries in thechannelInfoslist field, taking care to also set thereceiveNotificationsfield'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'sStreamingDataResultoutput port. -
-
You can stop the subscriptions initiated in the previous step by setting the
commandfield tostreamingstopand filling in thechannelIDsfield 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
Readmefile, 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_etpSee Default Installation Directories for the default location of studio-workspace on your system.
