Class TopicBinding<T extends Trait>
Smithy models can contain a number of MQTT topics that are formed by
the publish
and subscribe
traits. Each of these
traits resolves to a single MQTT topic.
This class abstracts away the process of computing the payload of an MQTT operation. Each topic binding provides the following information:
- The operation in the model that created the binding.
- The MQTT topic.
- The payload shape that forms the payload of the topic.
- The optionally present input structure of the operation, which provides information like topic label bindings.
@smithy.mqtt#publish topics
Operations marked with@smithy.mqtt#publish
resolve to a single topic that
is defined by topic property of the trait.
subscribe topics
Operations marked withsubscribe
resolve to a single topic
that is defined by the topic property of the trait.
Payload resolution
The payload binding of a topic binding can be resolved to either no payload (e.g., publish operations with no input shape), a structure payload, or a member of a structure. The target of a specific event shape member can be used as a payload insubscribe
operations where an event member is marked with the eventPayload
trait.-
Method Summary
Modifier and TypeMethodDescriptionboolean
conflictsWith
(TopicBinding<?> other) Returns true if the topic binding conflicts with another.boolean
getInput()
Deprecated.Use getInputShape instead.Gets the input shape related to this operation.Gets the trait that formed the binding of the operation to MQTT for this topic.Gets the operation shape related to the topic bindings.getOperationMqttTrait
(Shape operation) Finds the MQTT binding trait associated with an operation.Gets the payload shape of the topic.getTopic()
Gets the resolved topic of the binding.int
hashCode()
toString()
-
Method Details
-
getOperationMqttTrait
Finds the MQTT binding trait associated with an operation.- Parameters:
operation
- Operation to check.- Returns:
- Returns the optionally found MQTT binding trait.
-
getMqttTrait
Gets the trait that formed the binding of the operation to MQTT for this topic.The provided trait will be either an instance of
PublishTrait
orSubscribeTrait
.- Returns:
- Returns the MQTT trait binding.
-
getOperation
Gets the operation shape related to the topic bindings.- Returns:
- Returns the operation that has topic bindings.
-
getTopic
Gets the resolved topic of the binding.- Returns:
- Returns the resolved topic.
-
getInput
Deprecated.Use getInputShape instead.Gets the input shape related to this operation.- Returns:
- Returns the optional input shape.
-
getInputShape
Gets the input shape related to this operation.- Returns:
- Returns the input shape.
-
getPayloadShape
Gets the payload shape of the topic.The payload shape is either a structure for a single-event event stream, or a union for a multi-event event stream.
- Returns:
- Returns the optional payload target.
-
conflictsWith
Returns true if the topic binding conflicts with another.A topic binding is considered conflicting if both bindings have conflicting topics determined through
Topic.conflictsWith(software.amazon.smithy.mqtt.traits.Topic)
and the topic bindings utilize a different payload. If both topics do not have a payload then they are not conflicting. If both topics have a payload, but they target the same shape, then they are not conflicting.- Parameters:
other
- Other topic binding to compare against.- Returns:
- Returns true if the topic bindings conflict.
-
equals
-
hashCode
public int hashCode() -
toString
-