class SubscriptionService implements MqttClientEventHandler {

    public void subscribe(final MessageMetadata messageMetadata) {
        final MqttDevice device = this.getOrCreateDevice(messageMetadata);
        final MqttClientAdapter mqttClientAdapter = this.mqttClientAdapterFactory.create(device, messageMetadata, this);
        mqttClientAdapter.connect();
    }

    public  SubscriptionService(final MqttDeviceRepository mqttDeviceRepository,
            final MqttClientAdapterFactory mqttClientAdapterFactory,
            final OutboundOsgpCoreResponseMessageSender outboundOsgpCoreResponseMessageSender,
            @Value("#{new Integer('${mqtt.broker.defaultPort}')}") final int defaultPort,
            @Value("${mqtt.broker.defaultTopics}") final String defaultTopics,
            @Value("${mqtt.broker.defaultQos}") final String defaultQos);

}