-
Notifications
You must be signed in to change notification settings - Fork 23
Request-Response Streaming Operation #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… into rr_streaming
… into rr_streaming
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
|
|
||
| /// The topic associated with this PUBLISH packet. | ||
| let topic: String | ||
| /// (Optional) User Properties, if there is no user property, the array is empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: Should we allow this to be nil by making it optional ( [UserProperty]? ) ? Other optional properties are treated as optional so it feels a little off for this "Optional" to not be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the concern here. However, since Swift requires explicit validation before using optional values, using an empty array to represent "optional user properties" would simplify the code by avoiding the nil checks/unwrap.
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| /// Submit a request responds operation, throws CRTError if the operation failed | ||
| /// Submits a generic request to the request-response client, throws CRTError if the operation failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: "Submits a generic request to the request-response client" -> "Initiates a request-response operation"
bretambrose
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please no "ResponseResponse". If I did it in the C API it was a mistake there too, but let's not propagate it.
… into rr_streaming
… into rr_streaming
… into rr_streaming
… into rr_streaming
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
| final public class ResponsePath: CStruct, @unchecked Sendable { | ||
| /// MQTT topic that a response may arrive on. | ||
| let topic: String | ||
| /// JSON path for finding correlation tokens within payloads that arrive on this path's topic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels misleading because it's labeled here and elsewhere as "JsonPath" but it's actually just the unique string used to correlate. Unsure what we should do from a naming the member perspective but I don't think we should say it's a "JSON path" in the description we provide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling it a "path" still feels accurate to me. Currently, the correlation token is just a top-level string, so the "path" is simply "clientToken" like in this example:
Response{
"clientToken": "<token>"
}
But our current design leaves room for future responses where the token could be nested. For example, in the following case, the path might be something like "level1.level2.clientToken".
Response{
"level1": {
"level2" : {
"clientToken": "<token>"
}
}
}
| /// | ||
| /// - Parameters: | ||
| /// - topic: MQTT topic that a response may arrive on. | ||
| /// - correlationTokenJsonPath: JSON path for finding correlation tokens within payloads that arrive on this path's topic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
Source/AwsCommonRuntimeKit/mqtt/MqttRequestResponseClient.swift
Outdated
Show resolved
Hide resolved
sbSteveK
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review trivial suggestions then ship
Issue #, if available:
Description of changes:
The pr depends on bug fixes of awslabs/aws-c-io#725 to make sure the streaming operation would terminated properly while the client is shutdown.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.