1111 * See the License for the specific language governing permissions and
1212 * limitations under the License.
1313 */
14- package io .streamnative .pulsar .handlers .mqtt ;
15-
16- import io .streamnative .pulsar .handlers .mqtt .support .MQTTMetricsCollector ;
17- import io .streamnative .pulsar .handlers .mqtt .support .MQTTMetricsProvider ;
18- import io .streamnative .pulsar .handlers .mqtt .support .QosPublishHandlersImpl ;
19- import io .streamnative .pulsar .handlers .mqtt .support .RetainedMessageHandler ;
20- import io .streamnative .pulsar .handlers .mqtt .support .WillMessageHandler ;
21- import io .streamnative .pulsar .handlers .mqtt .support .event .DisableEventCenter ;
22- import io .streamnative .pulsar .handlers .mqtt .support .event .PulsarEventCenter ;
23- import io .streamnative .pulsar .handlers .mqtt .support .event .PulsarEventCenterImpl ;
24- import io .streamnative .pulsar .handlers .mqtt .support .psk .PSKConfiguration ;
25- import io .streamnative .pulsar .handlers .mqtt .support .systemtopic .SystemEventService ;
14+ package io .streamnative .pulsar .handlers .mqtt .broker ;
15+
16+ import io .streamnative .pulsar .handlers .mqtt .broker .impl .MQTTNamespaceBundleOwnershipListener ;
17+ import io .streamnative .pulsar .handlers .mqtt .broker .impl .MQTTSubscriptionManager ;
18+ import io .streamnative .pulsar .handlers .mqtt .broker .metric .MQTTMetricsCollector ;
19+ import io .streamnative .pulsar .handlers .mqtt .broker .metric .MQTTMetricsProvider ;
20+ import io .streamnative .pulsar .handlers .mqtt .broker .mqtt5 .WillMessageHandler ;
21+ import io .streamnative .pulsar .handlers .mqtt .broker .qos .QosPublishHandlers ;
22+ import io .streamnative .pulsar .handlers .mqtt .broker .qos .QosPublishHandlersImpl ;
23+ import io .streamnative .pulsar .handlers .mqtt .common .MQTTConnectionManager ;
24+ import io .streamnative .pulsar .handlers .mqtt .common .authentication .MQTTAuthenticationService ;
25+ import io .streamnative .pulsar .handlers .mqtt .common .event .DisableEventCenter ;
26+ import io .streamnative .pulsar .handlers .mqtt .common .event .PulsarEventCenter ;
27+ import io .streamnative .pulsar .handlers .mqtt .common .event .PulsarEventCenterImpl ;
28+ import io .streamnative .pulsar .handlers .mqtt .common .mqtt5 .RetainedMessageHandler ;
29+ import io .streamnative .pulsar .handlers .mqtt .common .psk .PSKConfiguration ;
30+ import io .streamnative .pulsar .handlers .mqtt .common .systemtopic .DisabledSystemEventService ;
31+ import io .streamnative .pulsar .handlers .mqtt .common .systemtopic .SystemEventService ;
2632import lombok .Getter ;
27- import lombok .Setter ;
2833import lombok .extern .slf4j .Slf4j ;
2934import org .apache .pulsar .broker .PulsarService ;
3035import org .apache .pulsar .broker .authorization .AuthorizationService ;
@@ -82,8 +87,7 @@ public class MQTTService {
8287 private final QosPublishHandlers qosPublishHandlers ;
8388
8489 @ Getter
85- @ Setter
86- private SystemEventService eventService ;
90+ private final SystemEventService eventService ;
8791
8892 public MQTTService (BrokerService brokerService , MQTTServerConfiguration serverConfiguration ) {
8993 this .brokerService = brokerService ;
@@ -107,21 +111,15 @@ public MQTTService(BrokerService brokerService, MQTTServerConfiguration serverCo
107111 this .eventCenter = new PulsarEventCenterImpl (brokerService ,
108112 serverConfiguration .getEventCenterCallbackPoolThreadNum ());
109113 }
110- this .retainedMessageHandler = new RetainedMessageHandler (this );
114+ this .eventService = new DisabledSystemEventService ();
115+ this .retainedMessageHandler = new RetainedMessageHandler (eventService );
111116 this .qosPublishHandlers = new QosPublishHandlersImpl (this );
112117 this .willMessageHandler = new WillMessageHandler (this );
113118 }
114119
115- public boolean isSystemTopicEnabled () {
116- return eventService != null ;
117- }
118-
119120 public void close () {
120121 this .connectionManager .close ();
121122 this .eventCenter .shutdown ();
122- if (eventService != null ) {
123- eventService .close ();
124- }
125123 this .willMessageHandler .close ();
126124 }
127125}
0 commit comments