Package org.eclipse.hono.adapter.mqtt
Interface Subscription
-
- All Known Implementing Classes:
AbstractSubscription,CommandSubscription,ErrorSubscription
public interface SubscriptionMQTT subscription of a device.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSubscription.KeyThe key to identify a subscription.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsDeviceId()Checks if the topic contains a device identifier.booleancontainsTenantId()Checks if the topic contains a tenant identifier.StringgetAuthenticatedDeviceId()Gets the device id from authentication.StringgetDeviceId()Gets the device id from topic or authentication.StringgetEndpoint()Gets the endpoint of the subscription.Subscription.KeygetKey()Gets the key to identify a subscription in the list of (same-type) subscriptions of an MQTT Endpoint.io.netty.handler.codec.mqtt.MqttQoSgetQos()Gets the QoS of the subscription.StringgetTenant()Gets the tenant from topic or authentication.StringgetTopic()Gets the subscription topic.booleanisAuthenticated()Gets the authentication status, which indicates the need to publish on tenant/device-id for unauthenticated devices.booleanisGatewaySubscriptionForSpecificDevice()Checks whether this subscription represents the case of a gateway subscribing for a specific device that it acts on behalf of.voidlogSubscribeFailure(io.opentracing.Span span, Throwable error)Logs a failed subscription attempt to the given span.voidlogSubscribeSuccess(io.opentracing.Span span)Logs a successful subscription attempt to the given span.voidlogUnsubscribe(io.opentracing.Span span)Logs the unsubscription to the given span.
-
-
-
Method Detail
-
getKey
Subscription.Key getKey()
Gets the key to identify a subscription in the list of (same-type) subscriptions of an MQTT Endpoint.- Returns:
- The key.
-
getTenant
String getTenant()
Gets the tenant from topic or authentication.- Returns:
- The tenant (never
null).
-
getDeviceId
String getDeviceId()
Gets the device id from topic or authentication.- Returns:
- The device id (never
null).
-
getAuthenticatedDeviceId
String getAuthenticatedDeviceId()
Gets the device id from authentication.- Returns:
- The device id or
null.
-
getEndpoint
String getEndpoint()
Gets the endpoint of the subscription.- Returns:
- The endpoint.
-
getQos
io.netty.handler.codec.mqtt.MqttQoS getQos()
Gets the QoS of the subscription.- Returns:
- The QoS value.
-
getTopic
String getTopic()
Gets the subscription topic.- Returns:
- The topic.
-
isAuthenticated
boolean isAuthenticated()
Gets the authentication status, which indicates the need to publish on tenant/device-id for unauthenticated devices.- Returns:
trueif created with an authenticated device.
-
isGatewaySubscriptionForSpecificDevice
boolean isGatewaySubscriptionForSpecificDevice()
Checks whether this subscription represents the case of a gateway subscribing for a specific device that it acts on behalf of.- Returns:
trueif a gateway is subscribing for a specific device.
-
containsTenantId
boolean containsTenantId()
Checks if the topic contains a tenant identifier.- Returns:
trueif the topic contains a tenant id.
-
containsDeviceId
boolean containsDeviceId()
Checks if the topic contains a device identifier.- Returns:
trueif the topic contains a device id.
-
logSubscribeSuccess
void logSubscribeSuccess(io.opentracing.Span span)
Logs a successful subscription attempt to the given span.- Parameters:
span- The span to log to.- Throws:
NullPointerException- if span isnull.
-
logSubscribeFailure
void logSubscribeFailure(io.opentracing.Span span, Throwable error)Logs a failed subscription attempt to the given span.- Parameters:
span- The span to log to.error- The error to log.- Throws:
NullPointerException- if span or error isnull.
-
logUnsubscribe
void logUnsubscribe(io.opentracing.Span span)
Logs the unsubscription to the given span.- Parameters:
span- The span to log to.- Throws:
NullPointerException- if span isnull.
-
-