MqttConfig.java 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. package com.ruoyi.device.config;
  2. import org.springframework.boot.context.properties.ConfigurationProperties;
  3. import org.springframework.context.annotation.Configuration;
  4. import java.util.ArrayList;
  5. import java.util.List;
  6. /**
  7. * MQTT配置信息
  8. *
  9. * @author lwm
  10. */
  11. @Configuration
  12. @ConfigurationProperties(prefix = "emqx")
  13. public class MqttConfig
  14. {
  15. /**
  16. * emqx服务器地址
  17. */
  18. private String broker;
  19. /**
  20. * 用户名
  21. */
  22. private String userName;
  23. /**
  24. * 密码
  25. */
  26. private String password;
  27. /**
  28. * 设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,这里设置为true表示每次连接到服务器都以新的身份连接
  29. */
  30. private Boolean cleanSession = true;
  31. /**
  32. * 是否断线重连
  33. */
  34. private Boolean reconnect = true;
  35. /**
  36. * 连接超时时间
  37. */
  38. private Integer timeout = 20;
  39. /**
  40. * 心跳间隔
  41. */
  42. private Integer keepAlive = 10;
  43. /**
  44. * 接口调用登陆名
  45. */
  46. private String apiUserName;
  47. /**
  48. * 接口调用登陆密码
  49. */
  50. private String apiPassword;
  51. /**
  52. * 接口调用地址
  53. */
  54. private String apiPath;
  55. /**
  56. * topic对应消息监听器
  57. */
  58. private List<MessageRouter> messageRouters = new ArrayList<>();
  59. public String getBroker()
  60. {
  61. return broker;
  62. }
  63. public void setBroker(String broker)
  64. {
  65. this.broker = broker;
  66. }
  67. public String getUserName()
  68. {
  69. return userName;
  70. }
  71. public void setUserName(String userName)
  72. {
  73. this.userName = userName;
  74. }
  75. public String getPassword()
  76. {
  77. return password;
  78. }
  79. public void setPassword(String password)
  80. {
  81. this.password = password;
  82. }
  83. public Boolean getCleanSession()
  84. {
  85. return cleanSession;
  86. }
  87. public void setCleanSession(Boolean cleanSession)
  88. {
  89. this.cleanSession = cleanSession;
  90. }
  91. public Boolean getReconnect()
  92. {
  93. return reconnect;
  94. }
  95. public void setReconnect(Boolean reconnect)
  96. {
  97. this.reconnect = reconnect;
  98. }
  99. public Integer getTimeout()
  100. {
  101. return timeout;
  102. }
  103. public void setTimeout(Integer timeout)
  104. {
  105. this.timeout = timeout;
  106. }
  107. public Integer getKeepAlive()
  108. {
  109. return keepAlive;
  110. }
  111. public void setKeepAlive(Integer keepAlive)
  112. {
  113. this.keepAlive = keepAlive;
  114. }
  115. public String getApiUserName()
  116. {
  117. return apiUserName;
  118. }
  119. public void setApiUserName(String apiUserName)
  120. {
  121. this.apiUserName = apiUserName;
  122. }
  123. public String getApiPassword()
  124. {
  125. return apiPassword;
  126. }
  127. public void setApiPassword(String apiPassword)
  128. {
  129. this.apiPassword = apiPassword;
  130. }
  131. public String getApiPath()
  132. {
  133. return apiPath;
  134. }
  135. public void setApiPath(String apiPath)
  136. {
  137. this.apiPath = apiPath;
  138. }
  139. public List<MessageRouter> getMessageRouters()
  140. {
  141. return messageRouters;
  142. }
  143. public void setMessageRouters(List<MessageRouter> messageRouters)
  144. {
  145. this.messageRouters = messageRouters;
  146. }
  147. }