Skip to content

Section 10 - Create a Data Sink using IntelliJ

Go back to Getting started guide

In this section we will:

Data Sink creation via the UI

Email and Filesystem Data Sink creation via the UI

TODO

Data Sink creation using Intellij

Create a Data Sink to send data as attachment in an email or write the file to the Filesystem.

Create a EMAIL ATTACH data sink to distribute data via email.

  1. Start by creating a file called DATA_SINK_CUSTOMER_EMAIL_ATTACH_CSV_0.xml and copy and paste the config below in the new file.
  2. Replace EMAIL_ATTACH_DATA_SINK_TEMPLATE with DATA_SINK_CUSTOMER_EMAIL_ATTACH_CSV_0 and add the email apirokai@gmail.com

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <apiroConf  version="1" xmlns="http://apiro.com/apiro/v1/root">
        <loadOrder>25</loadOrder>
        <dataSinks>
            <dataSink name="EMAIL_ATTACH_DATA_SINK_TEMPLATE" definition="EMAIL_ATTACH">
                <config>
                    <![CDATA[
                        {
                            "to":[""],
                            "cc":[],
                            "bcc":[],
                            "subject":""
                        }
                ]]>
                </config>
            </dataSink>
        </dataSinks>
    </apiroConf>
    
    Create a FILESYSTEM data sink to write data to the file system of the server.
  3. Start by creating a file called DATA_SINK_CUSTOMER_FILESYSTEM_0.xml and copy and paste the config below in the new file.

  4. Replace MY_FILESYSTEM_DATASINK_NAME with DATA_SINK_CUSTOMER_FILESYSTEM_0 and add the filePath with "filePath":"/apiro-output/customers_output.csv"

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
        <apiroConf xmlns="http://apiro.com/apiro/v1/root" version="1">
        <groups/>
        <loadOrder>10</loadOrder>
        <dataSinks>
            <dataSink definition="FILESYSTEM" name="MY_FILESYSTEM_DATASINK_NAME">
                <description>File system description</description>
                <execPriority>10</execPriority>
                <execPredicate>#GRV{ true }</execPredicate>
                <config>
                    <![CDATA[
                    {
                        "filePath":"/apiro-output/my_filename_output.csv"
                    }
    
                ]]>
                </config>
            </dataSink>
        </dataSinks>
        </apiroConf>
    
  5. The resulting files are shown below in the next session

  6. Follow the deployment instructions at the bottom of the page to enable these new DataSinks in the platform.

Configuration files

Completed configuration files
  • This is the completed 'Email Attach' Data Sink, that when is used it will email apirokai@gmail.com any provided data as an attachment.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
       <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <apiroConf  version="1" xmlns="http://apiro.com/apiro/v1/root">
            <loadOrder>25</loadOrder>
            <dataSinks>
                <dataSink name="DATA_SINK_CUSTOMER_EMAIL_ATTACH_CSV" definition="EMAIL_ATTACH">
                    <config>
                        <![CDATA[
                            {
                                "to":["apirokai@gmail.com"],
                                "cc":[],
                                "bcc":[],
                                "subject":"Customer data attached"
                            }
                    ]]>
                    </config>
                </dataSink>
            </dataSinks>
        </apiroConf>
    
  • This is the completed 'Filesystem' Data Sink, that when is used it will write data to apiro-output/customers_output.csv.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
        <apiroConf xmlns="http://apiro.com/apiro/v1/root" version="1">
        <groups/>
        <loadOrder>10</loadOrder>
        <dataSinks>
            <dataSink definition="FILESYSTEM" name="DATA_SINK_CUSTOMER_FILESYSTEM_0">
                <description>File system description</description>
                <execPriority>10</execPriority>
                <execPredicate>#GRV{ true }</execPredicate>
                <config>
                    <![CDATA[
                    {
                        "filePath":"/apiro-output/customers_output.csv"
                    }
    
                ]]>
                </config>
            </dataSink>
        </dataSinks>
        </apiroConf>
    
Deploy config files

Follow these steps Config Deployment to deploy and start using your configuration files.