Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Tip |
---|
Learn more about Sender module functions. |
Running module
Sender can be started using the provided starting script, automatically when installed using the installer or manually, by executing following command:
Code Block | ||
---|---|---|
| ||
java -Dapplication.name=sender-1 -Dfile.encoding=UTF8 -jar iot-collector-generic-sender-x.y.z.jar |
This command will start the sender with the default configuration of the cluster and audit. If necessary, it is also possible to manually specify these files:
Code Block | ||
---|---|---|
| ||
java -Dapplication.name=sender-1 -Dvertx.hazelcast.config=cluster.xml -Dfile.encoding=UTF8 -jar iot-collector-generic-sender-x.y.z.jar -conf config.json |
Runtime parameters explained
Parameter name | Description | Example |
---|---|---|
-Dapplication.name | Mandatory JVM parameter. Defines the name of the sender. | -Dapplication.name=sender-1 |
-Dvertx.hazelcast.config | Mandatory Optional JVM parameter. Specifies the file containing the cluster configuration. | -Dvertx.hazelcast.config=cluster.xml |
-Dfile.encoding | Optional JVM parameter. Specifies the encoding used when working with byte streams or reading messages and files. | -Dfile.encoding=UTF8 |
-jar | Specifies the collector JAR file to be started. | -jar iot-collector-generic-sender-x.y.z.jar |
-conf | Specifies the module configuration file | -conf config.json |
Configuration
Configuration is provided in config.json, which is passed to the application as -conf parameter
Info |
---|
Options are listed in dot notation - dot is refering to nested enttiy (e.g. senders[].license means { "senders" : [ { "license" : "abcdefgh" } ] } |
Tip |
---|
It is possible to run multiple senders using single JAR - by defining multiple receivers in senders array. See below. |
Common options
Option/Entity | Type | Default | Description |
---|---|---|---|
senders | Array of objects | Array of senders configuration. | |
senders[].license | String | empty | License provided by BellaDati |
senders[].name | String | empty | Name of the module |
senders[].host | String | localhost | HTTP host on which HTTP endpoints are running |
senders[].port | Integer | 8101 | HTTP port on which HTTP endpoints are running |
senders[].source | Object | Contains source receiver configuration. | |
senders[].source.receiver | String | Identification of associated receiver | |
senders[].source.inputMode | String | SINGLE | Data input mode:
Must correspond to the receiver's configuration. |
senders[].source.dataElement | String | data | Specifies "data" element path in BULK mode |
senders[].source.auth | Object | Contains authentication configuration | |
senders[].source.auth.enabled | Boolean | true | Flag indicating if Basic authentication is configured on receiver |
senders[].source.auth.username | String | Username (as defined in receiver's configuration) | |
senders[].source.auth.password | String | Plain text password (as defined in receiver's configuration) | |
senders[].bodyLimit | Integer | 2097152 | Maximum allowed request body size (in bytes) |
senders[].period | Integer | 60 | Delay (in seconds) after which the timer will fire new send event |
senders[].startId | Integer | -1 | Start ID that is used as a filter to obtain data from receiver (HSQL iterates from 0) |
senders[].limit | Integer | 1000 | Page size that is used as a filter to obtain data from receiver |
senders[].deleteProcessed | Boolean | true | Flag indicating if processed data should be deleted from receiver database |
senders[].actions | Array of strings | Specifies the automated action type. Available options are:
| |
senders[].actionRules | Object | Contains action rules configuration | |
senders[].actionRules.filterRules | Array of objects | Contains filter rules configuration objects | |
senders[].actionRules.filterRules.field | String | Name of the field within the normalized message. | |
senders[].actionRules.filterRules.operation | String | Compare operation type. Available operations:
| |
senders[].actionRules.filterRules.values | Array of strings | Array of values to filter. | |
senders[].db | Object | Contains database configuration. You can keep the default values unless you use some specific database. | |
senders[].db.url | String | jdbc:hsqldb:file:hsql/instance-db;shutdown=true | Database connection string |
senders[].db.user | String | SA | Database username |
senders[].db.password | String | empty | Database password |
senders[].db.driverclass | String | org.hsqldb.jdbcDriver | Database JDBC driver class |
senders[].db.max_pool_size | Integer | 100 | Database maximum pool size |
senders[].db.drop | Boolean | false | Flag indicating if database should be dropped during module startup |
senders[].auth | Object | Configuration of administrators common for all modules | |
senders[].auth.enabled | Boolean | true | Flag indicating if administrator authentication is enabled |
senders[].auth.drop | Boolean | false | Flag indicating if administrators should be dropped during module startup |
senders[].auth.merge | Boolean | true | Flag indicating if administrators should be merged during module startup |
senders[].auth.users | Array | Array of administrators to merge (insert new or update existing) | |
senders[].auth.users.username | String | admin | Unique username |
senders[].auth.users.password | String | Hashed password if 'salt' is defined, otherwise plain text password | |
senders[].auth.users.salt | String | Salt used to hash password | |
senders[].auth.users.roles | String array | [ "VIEWER" ] | Array of user roles |
Send data to BellaDati action options
If senders[].actions contains BELLADATI_REST, following options are available:
Option/Entity | Type | Default | Description |
---|---|---|---|
senders[].belladati | Object | Object containing sending data to BellaDati configuration | |
senders[].belladati.url | String | https://service.belladati.com | BellaDati URL |
senders[].belladati.useSsl | Boolean | true | Flag indicating if BellaDati is running on SSL port |
senders[].belladati.consumerKey | String | OAuth consumer key | |
senders[].belladati.consumerSecret | String | OAuth consumer secret | |
senders[].belladati.username | String | BellaDati username | |
senders[].belladati.password | String | BellaDati password | |
senders[].belladati.dataSet | Object | Destination data set configuration | |
senders[].belladati.dataSet.id | Integer | ID of the destination data set, where data should be imported | |
senders[].belladati.dataSet.columnId | String | Code of attribute/indicator that contains record identification | |
senders[].belladati.dataSet.columnReceiver | String | Code of attribute/indicator that contains receiver identification | |
senders[].belladati.dataSet.columnJson | String | Code of attribute/indicator that contains JSON data | |
senders[].belladati.dataSet.columnTimestamp | String | Code of attribute/indicator that contains timestamp | |
senders[].belladati.dataSet.jsonMapping | String | List of mappings between BellaDati indicator/attribute code and JSON key | |
senders[].belladati.dataSet.templateId | Integer | ID of import template, which should be used while executing the import | |
senders[].belladati.dataSet.splitByColumn | Integer | Index of column used to split data | |
senders[].belladati.continueOnError | Boolean | false | Determines whether to continue or not if error occurs |
HTTP request action options
If senders[].actions contains HTTP_REQUEST, following options are available:
Option/Entity | Type | Default | Description |
---|---|---|---|
senders[].httpRequset | Object | Object containing HTTP_REQUST action configuration options. | |
senders[].httpRequest.url | String | URL where the request will be sent | |
senders[].httpRequest.method | String | POST | HTTP method. Available options are:
|
senders[].httpRequest.headers | String | HTTP headers | |
senders[].httpRequest.content | String | HTTP request payload. It's possible to reference any of fields received from receiver. | |
enders[].httpRequest.sendAsForm | Boolean | false | Enables URL-encoding of the data, similar to --data-urlencode from cUrl. |
senders[].httpRequest.continueOnError | Boolean | false | Determines whether to continue or not if error occurs |
senders[].httpRequest.auth | Object | Contains authentication options. | |
senders[].httpRequest.auth.type | String | BASIC | Type of the authentication. Available options are:
|
senders[].httpRequest.auth.useSsl | Boolean | true | Flag indicating if server is running on SSL port |
senders[].httpRequest.auth.consumerKey | String | OAuth consumer key | |
senders[].httpRequest.auth.consumerSecret | String | OAuth consumer secret | |
senders[].httpRequest.auth.username | String | Username | |
senders[].httpRequest.auth.password | String | Password |
MQTT publish action options
If senders[].actions contains MQTT_PUBLISH, following options are available:
Option/Entity | Type | Default | Description |
---|---|---|---|
senders[].mqttPublish | Object | Provides configuration for MQTT_PUBLISH automated action. | |
senders[].mqttPublish.host | String | localhost | Host on which MQTT server is running. |
senders[].mqttPublish.port | Integer | 1883 | Port on which MQTT server is running. |
senders[].mqttPublish.topic | String | # | MQTT topic to publish to - wildcards (+ and #) are supported |
senders[].mqttPublish.qos | String | AT_MOST_ONCE | Quality of service. Available options: AT_LEAST_ONCE, AT_MOST_ONCE, EXACTLY_ONCE, FAILURE |
senders[].mqttPublish.content | String | HTTP request payload. It's possible to reference any of fields received from receiver. | |
senders[].mqttPublish.continueOnError | Boolean | false | Determines whether to continue or not if error occurs |
senders[].mqttPublish.receiveBufferSize | Integer | Set the TCP receive buffer size. | |
senders[].mqttPublish.timeoutOnConnect | Integer | 120 | Set the timeout on CONNECT packet in seconds. |
senders[].mqttPublish.maxMessageSize | Integer | -1 | Set max MQTT message size in bytes. |
senders[].mqttPublish.autoClientId | Boolean | false | Set if clientid should be auto-generated when it's "zero-bytes" |
senders[].mqttPublish.tcpNoDelay | Boolean | false | Set whether TCP no delay is enabled |
senders[].mqttPublish.tcpKeepAlive | Boolean | false | Set whether TCP keep alive is enabled |
senders[].mqttPublish.soLinger | Boolean | false | Set whether SO_linger keep alive is enabled |
senders[].mqttPublish.acceptBacklog | Integer | 1024 | Set the accept back log |
senders[].mqttPublish.useAlpn | Boolean | false | Set the ALPN usage. |
senders[].mqttPublish.logActivity | Boolean | false | Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger. |
senders[].mqttPublish.trafficClass | Integer | -1 | Set the value of traffic class |
senders[].mqttPublish.idleTimeout | Integer | -1 | Set the idle timeout, in seconds. |
senders[].mqttPublish.sendBufferSize | Integer | -1 | Set the TCP send buffer size |
senders[].mqttPublish.usePooledBuffers | Boolean | false | Set whether Netty pooled buffers are enabled |
senders[].mqttPublish.clientAuth | String | NONE |
|
senders[].mqttPublish.auth | Object | Defines the authentication options | |
senders[].mqttPublish.auth.ssl | Boolean | false | Set whether SSL/TLS is enabled |
senders[].mqttPublish.auth.type | String | Authentication type. Available options:
| |
senders[].mqttPublish.auth.keystorePath | String | Absolute path to Java keystore file (JKS) | |
senders[].mqttPublish.auth.keystorePassword | String | Password of Java keystore | |
senders[].mqttPublish.auth.clientCert | String | Client certificate name/alias | |
senders[].mqttPublish.auth.username | String | Username | |
senders[].mqttPublish.auth.password | String | Password |
Send email action options
If senders[].actions contains EMAIL, following options are available:
Option/Entity | Type | Default | Description |
---|---|---|---|
senders[].email | Object | Provides configuration for EMAIL automated action. | |
senders[].email.host | String | localhost | Host on which SMTP server is running. |
senders[].email.port | Integer | 25 | Port on which SMTP server is running. |
senders[].email.content | String | Email content. It's possible to reference any of fields received from receiver. | |
senders[].email.sender | String | Email sender | |
senders[].email.subject | String | Email subject. It's possible to reference any of fields received from receiver. | |
senders[].email.recipients | Array of strings | Array of email recipients | |
senders[].email.continueOnError | Boolean | false | Determines whether to continue or not if error occurs |
senders[].email.auth | Object | Defines the SMTP server authentication options | |
senders[].email.auth.useSsl | Boolean | false | Set whether SSL/TLS is enabled |
senders[].email.auth.username | String | SMTP server username | |
senders[].email.auth.password | String | SMTP server Password |
Configuration sample
Code Block | ||||
---|---|---|---|---|
| ||||
{ "senders": [ -> JSON array containing configuration of multiple receivers { "license": "n5NkzaEOALzvGs7LOExyAulYdqo8X+5==", -> License key "name": "Sender 01", -> Sender identification "source": { -> Source receiver definition "receiver": "Receiver 01", -> Identification of associated receiver "inputMode": "SINGLE", -> Data input mode (see Enumerations below) "httpClientConfig": { -> Optional Vert.x HttpClientOptions for HttpClient (see receiver's configuration) "keepAlive": true, -> Set whether keep alive is enabled "pipelining": false, -> Set whether pipe-lining is enabled "ssl": true, -> Set whether SSL/TLS is enabled "trustAll": true, -> Set whether all server certificates should be trusted "maxPoolSize": 25, -> Set the maximum pool size for connections "idleTimeout": 3, -> Set the idle timeout, in seconds (zero means don't timeout) "connectTimeout": 5000, -> Set the connect timeout, in milliseconds "maxWaitQueueSize": -1 -> Set the maximum requests allowed in the wait queue (-1 means unbounded) ... -> Other: http://vertx.io/docs/apidocs/io/vertx/core/http/HttpClientOptions.html }, "auth": { "enabled": true, -> Flag indicating if Basic authentication is configured on receiver "username": "editor", -> Username (see receiver's configuration) "password": "BellaDati01", -> Plain text password (see receiver's configuration) } }, "host": "localhost", -> HTTP host on which HTTP endpoints are running "port": 8101, -> HTTP port on which HTTP endpoints are running "bodyLimit": 2097152, -> Maximum allowed request body size (in bytes, default: 2 MB) "period": 60, -> Delay (in seconds) after which the timer will fire new send event "startId": -1, -> Start ID that is used as a filter to obtain data from receiver (HSQL iterates from 0) "limit": 1000, -> Page size that is used as a filter to obtain data from receiver "saveToFile": true, -> Deprecated - use actions instead. Flag indicating if transformed data should be saved to local file "sendToBellaDati": true, -> Deprecated - use actions instead. Flag indicating if transformed data should be send to BellaDati "deleteProcessed": true, -> Flag indicating if processed data should be deleted from receiver database "actions" : [ "BELLADATI_REST", "EMAIL" ], -> Specifies the sender type. Available types: BELLADATI_REST, HTTP_REQUEST, MQTT_PUBLISH, EMAIL, SAVE_TO_FILE; "belladati": { -> BellaDati configuration "url": "http://localhost:8081/", -> BellaDati URL "useSsl": false, -> Flag indicating if BellaDati is running on SSL port "consumerKey": "apiKey", -> OAuth consumer key "consumerSecret": "apiSecret", -> OAuth consumer secret "username": "dadmin01", -> BellaDati username "password": "BellaDati01", -> BellaDati password "dataSet": { -> DataSet configuration "id": "123", -> DataSet identification "columnId": "M_ID", -> Code of attribute/indicator that contains record identification "columnReceiver": "L_RECEIVER", -> Code of attribute/indicator that contains receiver identification "columnJson": "L_JSON", -> Code of attribute/indicator that contains JSON data "columnTimestamp": "L_TIMESTAMP", -> Code of attribute/indicator that contains timestamp "jsonMapping": "M_IND1=ind1_json,L_ATTR1=attr1_json", -> List of mappings between BellaDati indicator/attribute code and JSON key "templateId": 12345, -> Identification of import template "splitByColumn": 4 -> Index of column used to split data }, "continueOnError" : false }, "httpRequest" : { "url" : "http://host", "method" : "POST"|"GET"|"DELETE"|"PUT", "headers" : "header1=value1,header2=value2", "auth" : { "type" : "BASIC", -> Auth type: BASIC, DIGEST, OAUTH "useSsl": false, -> Flag indicating if BellaDati is running on SSL port "consumerKey": "apiKey", -> OAuth consumer key "consumerSecret": "apiSecret", -> OAuth consumer secret "username": "dadmin01", -> BellaDati username "password": "BellaDati01" -> BellaDati password }, "continueOnError" : false, "content" : "Message content with variables" -> It's possible to reference any of fields received from receiver }, "mqttPublish" : { "host" : "host", "port" : 1833, "topic" : "topic/to/publish/to", "qos" : "AT_LEAST_ONCE", -> Quality of service AT_LEAST_ONCE, AT_MOST_ONCE, EXACTLY_ONCE, FAILURE "auth" : { "type" : "BASIC", -> Auth type: BASIC, DIGEST, CLIENT_CERT "useSsl": false, -> Flag indicating if BellaDati is running on SSL port "keystorePath": "/path/to/server-keystore.jks", -> Absolute path to Java keystore file (JKS) "keystorePassword": "wibble", -> Password of Java keystore "clientCert": "certName", -> OAuth consumer key "username": "dadmin01", -> BellaDati username "password": "BellaDati01" -> BellaDati password }, "content" : "Message content with variables", -> It's possible to reference any of fields received from receiver "continueOnError" : false, "options" : { "receiveBufferSize" : 123456, -> Set the TCP receive buffer size "timeoutOnConnect" : 120, -> Set the timeout on CONNECT packet "maxMessageSize" : -1, -> Set max MQTT message size "autoClientId" : false, -> Set if clientid should be auto-generated when it's "zero-bytes" "tcpNoDelay" : false, -> Set whether TCP no delay is enabled "tcpKeepAlive" : false, -> Set whether TCP keep alive is enabled "soLinger" : false, "tcpQuickAck" : false, "tcpFastOpen" : false, "tcpCork" : false, "acceptBacklog" : false, "useAlpn" : false, "clientAuth" : false, "logActivity" : false, "trafficClass" : -1, "idleTimeout" : -1, "sendBufferSize" : -1, "usePooledBuffers" : false, "clientAuthRequired" : false, "enabledSecureTransportProtocols" : false } }, "email" : { "host" : "smtp_host", "port" : 25, "auth" : { "useSsl": false, -> Flag indicating if SMTP is running on SSL port "username": "dadmin01", -> SMTP username "password": "BellaDati01" -> SMTP password }, "sender" : "sender@email.com", "subject" : "Subject of the email", -> It's possible to reference any of fields received from receiver "content" : "Message content with variables", -> It's possible to reference any of fields received from receiver "continueOnError" : false }, "actionRules" : { "field1": { "op": "EQ", "value": "Slovakia" }, "field2": { "op": "IN", "values": [ "Type 1", "Type 2", "Type 3" ] }, "field3": { "op": "NOT_NULL" }, "field4": { "op": "GT", "value" : 1200 } } "db": { -> Database configuration "url": "jdbc:hsqldb:file:/path/to/my-sender01-db;shutdown=true", -> Database connection string "user": "SA", -> Database username "password": "", -> Database password "driverclass": "org.hsqldb.jdbcDriver", -> Database JDBC driver class (see dependencies in pom.xml) "max_pool_size": 100, -> Database maximum pool size "drop": true -> Flag indicating if database should be dropped during module startup }, "auth": { "enabled": true, -> Flag indicating if authentication is enabled "drop": false, -> Flag indicating if users should be dropped during module startup "merge": true, -> Flag indicating if users should be merged during module startup "users": [ -> Array of users to merge (insert new or update existing) { "username": "viewer", -> Unique username "password": "DAAF8173380C604B392A1EF8D7559AA0", -> Hashed password if 'salt' is defined, otherwise plain text password "salt": "BA1170DE9ADE8D29D2C18FD789EAB3BD", -> Salt used to hash password "roles": [ "VIEWER" ] -> Array of user roles (see Enumerations below) } ] }, "ssl": { "enabled": true, -> Flag indicating if HTTP server should run with enabled SSL/TLS "keystorePath": "/path/to/server-keystore.jks", -> Absolute path to Java keystore file (JKS) "keystorePassword": "wibble" -> Password of Java keystore } }, { "name": "sender02", ... } ] } |
On this page
Table of Contents |
---|