title: How to Subscribe Multiple topic and Multiple MqttCallback Using PAHO on Java
body: <pre><code>static String[] meandgroup = new String[]{"timentask/c/u000000000005", "timentask/c/u0000000GRP85", "timentask/c/u000000GRP107", "timentask/c/u0000000GRP84", "timentask/c/u000000GRP100"};
      public static List&lt;MqttClient&gt; mqttConnect(Object topicId) {
          try {
              mqttClient = new ArrayList&lt;MqttClient&gt;();
              for (int i = 0; i &lt; meandgroup.length; i++) {
                  //if (mqttClient.get(i) == null || !mqttClient.get(i).isConnected()){
                  if (!globalData.GlobalDataSetGet.MQTT_SERVER_HOST_NAME.equals("") &amp;&amp; !globalData.GlobalDataSetGet.MQTT_SERVER_USER_NAME.equals("")) {
                      String topicName = meandgroup[i];
                      mqttClient.add(MqttMgr.subscriber(globalData.GlobalDataSetGet.MQTT_SERVER_HOST_NAME,
                              globalData.GlobalDataSetGet.MQTT_SERVER_PORT_NUMBER, globalData.GlobalDataSetGet.MQTT_SERVER_USER_NAME,
                              globalData.GlobalDataSetGet.MQTT_SERVER_USER_PASSWORD, Constants.MQTT_CONNECTION_KEEP_ALIVE_SECS, topicName, "client" + globalData.GlobalDataSetGet.getUserIdValue, new ChatPaneWrite()));
                  }
              }
          } catch (MqttException e) {
              e.printStackTrace();
          } catch (Exception e) {
              e.printStackTrace();
          }
          return mqttClient;
      }
  </code></pre>