File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
mqtt-proxy/src/main/java/io/streamnative/pulsar/handlers/mqtt/proxy/impl Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 1616import static io .streamnative .pulsar .handlers .mqtt .common .utils .MqttMessageUtils .createMqtt5ConnectMessage ;
1717import static io .streamnative .pulsar .handlers .mqtt .common .utils .MqttMessageUtils .createMqttPublishMessage ;
1818import static io .streamnative .pulsar .handlers .mqtt .common .utils .MqttMessageUtils .createMqttSubscribeMessage ;
19+ import static io .streamnative .pulsar .handlers .mqtt .common .utils .MqttMessageUtils .pingResp ;
1920import com .google .common .collect .Lists ;
2021import io .netty .channel .ChannelHandlerContext ;
2122import io .netty .handler .codec .mqtt .MqttConnectMessage ;
6263import lombok .Getter ;
6364import lombok .extern .slf4j .Slf4j ;
6465import org .apache .commons .collections4 .CollectionUtils ;
66+ import org .apache .commons .collections4 .MapUtils ;
6567import org .apache .commons .lang3 .StringUtils ;
6668import org .apache .pulsar .broker .PulsarService ;
6769import org .apache .pulsar .broker .authentication .AuthenticationDataSource ;
@@ -243,6 +245,10 @@ public void processPubAck(MqttAdapterMessage adapter) {
243245 @ Override
244246 public void processPingReq (final MqttAdapterMessage msg ) {
245247 String clientId = connection .getClientId ();
248+ if (MapUtils .isEmpty (topicBrokers )) {
249+ connection .send (pingResp ());
250+ return ;
251+ }
246252 topicBrokers .values ().forEach (adapterChannel -> {
247253 adapterChannel .thenAccept (channel -> {
248254 msg .setClientId (clientId );
You can’t perform that action at this time.
0 commit comments