Editing Adapter Configuration Files

Edit a set of adapter configuration files in order to make the custom adapter available to both the HANA Streaming Analytics server at run time and in HANA Studio at design time.

You will learn

Locate which files to edit locally on HANA Studio and on the Streaming Server

How to edit the modulesdefine and custommodulesdefine.xml files

How to edit the parametersdefine.xml file

To transfer the files edited on the Streaming Server to the client where the HANA Studio is running

IMPORTANT! Since you’re running a multidb SAP HANA environment, $STREAMING_CUSTOM_ADAPTERS_HOME will refer to

/hana/shared/<SID>/streaming/cluster/<tenant db>/adapters

assuming you have used the default location of /hana as the root directory for the installation.

For this step, we will be adding our custom modules to the modulesdefine.xml file and custommodulesdefine.xml file, and adding parameter definitions from the .cnxml file to parametersdefine.xsd. The modulesdefine.xml file is located in the $STREAMING_HOME/adapters/framework/config directory, the custommodulesdefine.xml file is located in the $STREAMING_CUSTOM_ADAPTERS_HOME/configdirectory, and the parametersdefine.xsd is located in the $STREAMING_CUSTOM_ADAPTERS_HOME/config directory. We are not creating these files from scratch. The purpose of the modulesdefine.xml file is to define our custom modules (Transporter and Formatter) so HANA Streaming Analytics knows what they do and where they reside.

The parametersdefine.xsd file simply defines what elements are valid in an adapter_config.xml file (adapter configuration file). Since we have used a custom element – MqttInputTransporterParameters – in our adapter_config.xml file, we must define it in parametersdefine.xsd.

The full source code for the modulesdefine.xml and custommodulesdefine.xml files are provided in the Appendix Section

Open modulesdefine.xml in a text editor.

We will add our Transporter module to the TransporterDefnList

Create a <TransporterDefn> element.

<TransporterDefn>

Create a <Name> element. Specify the name of our custom Transporter class.

<Name>MqttTransporter</Name>

Create a <Class> element.

<Class>com.sap.MqttTransporter</Class>

Create an <OutputData> element.

<OutputData>String</OutputData>

Close off the <TransporterDefn> element.

</TransporterDefn>

We will add our formatter module to the formatterDefnList

Create a <FormatterDefn> element.

<FormatterDefn>

Create a <Name> element. Specify the name of our custom Transporter class.

<Name>MqttFormatter</Name>

Create a <Class> element.

<Class>com.sap.MqttFormatter</Class>

Create an <InputData> element.

<InputData>String</InputData>

Create an <OutputData> element.

<OutputData>Esp</OutputData>

Close off the <FormatterDefn> element.

</FormatterDefn>

Repeat steps 1 to 3 for custommodulesdefine.xml.

For the question below, select the correct answer, and click Validate.

What is the purpose of editing the `modulesdefine.xml` file:

to define our custom modules so HANA Streaming Analytics knows what they do and where they resideTo specify whether this is an input or output adapterTo control how the custom adapter's records are communicated to and from Streaming AnalyticsTo provide lower level support for building custom adapters using `C` or `.NET`