Managing Assets in Coreflux: Command Guide
In Coreflux, assets are managed through a series of commands. This guide provides a comprehensive overview of these commands and their functionalities.
Authentication and Listing
-
Login to Coreflux Cloud:
Use this command to log in to the Coreflux cloud using the provided username and password. -
List All Assets:
Once logged in, you can list all available assets using this command. -
Help Information:
If you need assistance with the available commands, use this option to display help information.
Asset Installation and Removal
- Install an Asset: After logging in, you should list all available assets to determine the type of asset you want to install. Once you've identified the asset type, you can use this command to install it.
Example
Suppose you've logged :
And listed the assets.
Among the list, you find an asset type named coreflux_mssqlmqtt
which represents the MS SQL Connector. To install this asset, you would use the following command:
- Uninstall an Asset:
To remove an asset, use this command with the asset's unique GUID or its name. For example:
-U DEADBEEF-CAFE-BABE-BEEF-0123456789AB
or-U Machine1
.
Asset Configuration
-
Asset Help:
Each asset has its own help documentation. After installation, this command provides feedback on how to configure the asset, both by command and JSON configuration. For example:-assetHelp DEADBEEF-CAFE-BABE-BEEF-0123456789AB
or-assetHelp Machine1
. -
Reset Asset Configuration to Default:
Use this command with caution. It resets the asset's configuration to its default settings. For example:-assetDefaultConfig DEADBEEF-CAFE-BABE-BEEF-0123456789AB
or-assetDefaultConfig Machine1
. -
Load Asset Configuration:
This command displays the stored configuration of the asset in JSON format. For example:-assetConfigLoad DEADBEEF-CAFE-BABE-BEEF-0123456789AB
or-assetConfigLoad Machine1
. -
Save Asset Configuration:
To modify an asset's configuration, first run theassetHelp
command to obtain the default JSON. After making your desired changes to the JSON, use this command with the asset's GUID or name and the modified JSON to save the new configuration. For example:-assetConfigSave DEADBEEF-CAFE-BABE-BEEF-0123456789AB {'myjsonelement': 42}
or-assetConfigSave Machine1 {'myjsonelement': 42}
.
Pratical Example of Save Config
To modify an asset's configuration, first run the assetHelp
command to obtain the default JSON. After making your desired changes to the JSON, use this command with the asset's GUID or name and the modified JSON to save the new configuration.
For example, if you're configuring the MS SQL Connector:
-assetConfigSave MSSQLConnector {
"MQTTParameters": {
"Port": 1883,
"Address": "127.0.0.1",
"IsAnonymous": true,
"Username": "",
"Password": "",
"EnableTLS": true,
"EnableDebugTopic": true,
"DebugTopic": "test/debugtopic"
},
"MSSQLParameters": {
"ServerAddress": "192.168.20.19",
"DatabaseName": "MyDB",
"Username": "admin",
"Password": "pass",
"QueryTimeoutInSeconds": 0
},
"Tags": [
{
"Name": "Test",
"WriteDirection": 1,
"MQTTTriggerTopic": "sqlasset/triggerTopicDirectSQL",
"MQTTFeedbackTopic": "feedback/topic",
"MQTTFeedbackQoS": 0,
"MQTTFeedbackRetain": false,
"Query": "INSERT INTO {value.json.table} (CustomerID,CustomerName, ContactName, Country) VALUES ({value.json.data.CustomerID},{value.json.data.CustomerName}, {value.json.data.ContactName}, {value.json.data.Country});",
"ResultInJsonFormat": true
}
]
}
Asset Operations
-
Run an Asset:
Use this command to start a specific asset. Always verify the asset's state in the Assets topic after execution. For example:-R DEADBEEF-CAFE-BABE-BEEF-0123456789AB
or-R Machine1
. -
Stop an Asset:
To halt an asset's operations, use this command and ensure you verify the asset's state in the Assets topic afterward. For example:-S DEADBEEF-CAFE-BABE-BEEF-0123456789AB
or-S Machine1
. -
Set Asset Restart Policy:
This command allows you to modify the restart behavior of an asset. The<policy>
can be one of the following: 'Always', 'OnFailure', 'OnFailureWithMaxRetries', or 'Never'. For instance, to set the policy to 'Always', use the command as shown in the example. -
Set Asset Name:
This command allows you to change the asset's name to a more readable format. For example:-assetNameSet DEADBEEF-CAFE-BABE-BEEF-0123456789AB NewMachineName
or-assetNameSet OldMachineName NewMachineName
.
Asset Restart Policies in Coreflux
Coreflux provides various restart policies to control the behavior of assets, especially when they encounter errors or stop running. These policies determine how and when an asset should be restarted.
-
Always: This policy ensures that the asset is always restarted, regardless of whether it was stopped due to an error or other reasons.
-
OnFailure: With this policy, the asset is restarted only if it stops due to an error. If the asset is stopped manually or for reasons other than an error, it will not be restarted.
-
OnFailureWithMaxRetries: This policy is similar to the OnFailure policy, but with an added constraint. The asset will be restarted upon failure, but only up to a specified maximum number of retries. After reaching this limit, the asset will not be restarted again.
-
Never: As the name suggests, with this policy, the asset will never be restarted, irrespective of why it was stopped.
graph TD
A[Asset Stops] --> B{Reason?}
B -->|Error| C[OnFailure]
B -->|Max Retries Reached| D[OnFailureWithMaxRetries]
B -->|Any Reason| E[Always]
B -->|Manual/Other| F[Never]
C --> G[Restart Asset]
D -->|Retry Count < Max| G
D -->|Retry Count = Max| H[Do Not Restart]
E --> G
F --> H
This diagram visually represents the flow of how each restart policy behaves when an asset stops. Depending on the reason for the asset's stoppage and the set policy, the asset might either be restarted or left in its stopped state.
Conclusion
Coreflux provides a robust and intuitive platform for managing assets. With the hubless solution, users can directly interact with the MQTT Broker, offering a streamlined experience. Whether you're adding new assets, configuring them, or monitoring their performance, Coreflux ensures that you have all the tools necessary for efficient asset management.