Class MqttClientConfig
java.lang.Object
org.summerboot.jexpress.boot.config.BootConfig
org.summerboot.jexpress.integration.mqtt.MqttClientConfig
- All Implemented Interfaces:
JExpressConfig
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Nested Class Summary
Nested classes/interfaces inherited from class org.summerboot.jexpress.boot.config.BootConfig
BootConfig.ThreadingMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected intprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected KeyManagerFactoryprotected Stringprotected Stringprotected SocketFactoryprotected Stringprotected TrustManagerFactoryprotected Stringprotected booleanFields inherited from class org.summerboot.jexpress.boot.config.BootConfig
BR, cache, cfgFile, configName, CPU_CORE, DESC_KMF, DESC_PLAINPWD, DESC_TMF, FILENAME_KEYSTORE, FILENAME_SRC_TRUSTSTORE, generateTemplate, logger, props -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.paho.mqttv5.client.MqttAsyncClientbuild()org.eclipse.paho.mqttv5.client.MqttAsyncClientbuild(org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence, org.eclipse.paho.mqttv5.client.MqttPingSender pingSender, ScheduledExecutorService executorService) org.eclipse.paho.mqttv5.client.MqttConnectionOptionsorg.eclipse.paho.mqttv5.client.MqttConnectionOptionsbuildConnectionOptions(String username, String password) org.eclipse.paho.mqttv5.client.MqttConnectionOptionsbuildConnectionOptions(String username, String password, SocketFactory socketFactory) protected voidprotected voidintgetKmf()getTmf()booleanprotected voidloadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) static voidprotected voidpreLoad(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) voidshutdown()voidshutdown(org.eclipse.paho.mqttv5.client.MqttAsyncClient asyncClient) Methods inherited from class org.summerboot.jexpress.boot.config.BootConfig
buildThreadPoolExecutor, createIfNotExist, generateTemplate, getCfgFile, getLength, getProperties, info, instance, lineBreak, load, loadField, name, parse, registerSingleton, temp, updateConfigFile, updateFilePath
-
Field Details
-
FILENAME_TRUSTSTORE_4CLIENT
- See Also:
-
ID
- See Also:
-
serverURI
@ConfigHeader(title="1. MQTT.client server endpoint", desc="protocol: tcp/ssl/local/ws/wss", format="protocol://servername:port", example="ssl://localhost:8883") @Config(key="MQTT.client.serverURI", predefinedValue="ssl://localhost:8883", required=true) protected volatile String serverURI -
sslProtocol
-
KEY_kmf_key
- See Also:
-
KEY_kmf_StorePwdKey
- See Also:
-
KEY_kmf_AliasKey
- See Also:
-
KEY_kmf_AliasPwdKey
- See Also:
-
kmf
@ConfigHeader(title="2. MQTT.client keystore") @Config(key="MQTT.client.ssl.KeyStore", StorePwdKey="MQTT.client.ssl.KeyStorePwd", AliasKey="MQTT.client.ssl.KeyAlias", AliasPwdKey="MQTT.client.ssl.KeyPwd", desc="Path to key store file. Use SSL/TLS when keystore is provided, otherwise use plain socket", callbackMethodName4Dump="generateTemplate_keystore") protected volatile KeyManagerFactory kmf -
KEY_tmf_key
- See Also:
-
KEY_tmf_StorePwdKey
- See Also:
-
tmf
@ConfigHeader(title="3. MQTT.client truststore") @Config(key="MQTT.client.ssl.TrustStore", StorePwdKey="MQTT.client.ssl.TrustStorePwd", callbackMethodName4Dump="generateTemplate_truststore", desc="Path to trust store file. Auth the remote peer certificate when a truststore is provided, otherwise blindly trust all remote peer certificate") protected volatile TrustManagerFactory tmf -
verifyHostname
@Config(key="MQTT.client.VerifyHostname", defaultValue="true") protected volatile boolean verifyHostname -
socketFactory
-
clientId
@ConfigHeader(title="4. MQTT.client user credential") @Config(key="MQTT.client.clientId") protected volatile String clientId -
username
-
password
-
defaultQoS
@ConfigHeader(title="5. MQTT.client messaging") @Config(key="MQTT.client.defaultQoS", defaultValue="2", desc="0=At most once, Fire-and-Forget (QoS 0), 1=At least once (QoS 1), 2=Exactly once (QoS 2)") protected volatile int defaultQoS
-
-
Constructor Details
-
MqttClientConfig
protected MqttClientConfig()
-
-
Method Details
-
main
-
generateTemplate_keystore
-
generateTemplate_truststore
-
preLoad
- Overrides:
preLoadin classBootConfig
-
loadCustomizedConfigs
protected void loadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) throws Exception - Specified by:
loadCustomizedConfigsin classBootConfig- Throws:
Exception
-
shutdown
public void shutdown() -
build
public org.eclipse.paho.mqttv5.client.MqttAsyncClient build() throws org.eclipse.paho.mqttv5.common.MqttException- Throws:
org.eclipse.paho.mqttv5.common.MqttException
-
build
public org.eclipse.paho.mqttv5.client.MqttAsyncClient build(org.eclipse.paho.mqttv5.client.MqttClientPersistence persistence, org.eclipse.paho.mqttv5.client.MqttPingSender pingSender, ScheduledExecutorService executorService) throws org.eclipse.paho.mqttv5.common.MqttException - Throws:
org.eclipse.paho.mqttv5.common.MqttException
-
buildConnectionOptions
public org.eclipse.paho.mqttv5.client.MqttConnectionOptions buildConnectionOptions() -
buildConnectionOptions
-
buildConnectionOptions
public org.eclipse.paho.mqttv5.client.MqttConnectionOptions buildConnectionOptions(String username, String password, SocketFactory socketFactory) -
shutdown
public void shutdown(org.eclipse.paho.mqttv5.client.MqttAsyncClient asyncClient) throws org.eclipse.paho.mqttv5.common.MqttException - Throws:
org.eclipse.paho.mqttv5.common.MqttException
-
getServerURI
-
getSslProtocol
-
getKmf
-
getTmf
-
isVerifyHostname
public boolean isVerifyHostname() -
getSocketFactory
-
getClientId
-
getUsername
-
getPassword
-
getDefaultQoS
public int getDefaultQoS()
-