-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
feat: session expiry interval to mqtt5 bindings #157
feat: session expiry interval to mqtt5 bindings #157
Conversation
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
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.
LGTM but you'll have to update the binding version and upgrade it to 0.2.0.
@fmvilas updated the binding version. Can you please re-review? |
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.
LGTM 👍 Let's wait for others to review too.
Pinging @KhudaDad414 @derberg @dalelane @smoya @char0n
} | ||
}, | ||
"properties": { | ||
|
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.
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.
@rcoppen is better placed to comment on this than me, as my MQTT knowledge is pretty rusty... but I'll ask some ignorant questions anyway :-)
Is session expiry an attribute of the server? I thought it was something the client could choose, with different clients connecting to the same server allowed to choose their own (and different) expiries?
I agree with @dalelane, is the intention to define a server configuration that always enforces a single Session Expiry for every client connection? |
As @dalelane pointed out, the session expiry is sent by the client in the CONNECT packet, although I believe it can technically be overridden by the broker in the CONNACK. @fmvilas is there a current distinction in the bindings between client-side connection properties and server-side configuration? IMO it would be more logical to define this as something set by a client rather than an 'enforced' value. |
I agree @dalelane and @rcoppen. Session expiration is only a client decision. I tried to think on some way of adding this to the binding, like setting some "max" session TTL, but still it doesn't fit IMHO. |
Looking at the |
Good catch!
I wouldn't either set a default, since then the same issue you described earlier could happen. But that's for another Issue/PR. Are you happy opening a new issue with this @rcoppen ? I can do otherwise. |
@smoya np, will open an issue for |
Yeah, these things need to be clarified. Y'all are making a good point that this is something the client should decide, maybe even on runtime. I think it could be a good idea to follow the direction of Kafka and WS bindings, and allow either a scalar value or a Schema Object value. The Schema Object should give the client enough flexibility to calculate things on runtime but still make sure it follows a specific pattern or limits. The scalar value would be great for those cases in which we want to enforce a specific value. For instance, when generating code. |
I agree with @fmvilas. I have made the required changes. |
mqtt5/json_schemas/server.json
Outdated
"$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/schema" | ||
} | ||
], | ||
"description": "Session Expiry Interval in seconds." |
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. Something to tweak for the Schema Object case.
@KhudaDad414 can you have a look as well, please? 🙏 |
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.
LGTM!
🏓 @derberg |
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.
LGTM. I've suggested couple of changes, due to #143
mqtt5/README.md
Outdated
|
||
Field Name | Type | Description | ||
---|:---:|--- | ||
<a name="serverBindingObjectSessionExpiryInterval"></a>`sessionExpiryInterval` | [Schema Object][schemaObject] \| integer | Session Expiry Interval in seconds or a Schema Object containing the definition of the interval. |
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.
<a name="serverBindingObjectSessionExpiryInterval"></a>`sessionExpiryInterval` | [Schema Object][schemaObject] \| integer | Session Expiry Interval in seconds or a Schema Object containing the definition of the interval. | |
<a name="serverBindingObjectSessionExpiryInterval"></a>`sessionExpiryInterval` | [Schema Object][schemaObject] \| [Reference Object](referenceObject) \| integer | Session Expiry Interval in seconds or a Schema Object containing the definition of the interval. |
mqtt5/README.md
Outdated
This object MUST NOT contain any properties. Its name is reserved for future use. | ||
|
||
[schemaObject]: https://www.asyncapi.com/docs/specifications/2.4.0/#schemaObject |
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.
[schemaObject]: https://www.asyncapi.com/docs/specifications/2.4.0/#schemaObject | |
[schemaObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#schemaObject | |
[referenceObject]: https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#referenceObject |
mqtt5/json_schemas/server.json
Outdated
"minimum": 0 | ||
}, | ||
{ | ||
"$ref": "https://raw.githubusercontent.com/asyncapi/spec-json-schemas/v2.14.0/schemas/2.4.0.json#/definitions/schema" |
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.
Can we replace the $ref
with following two objects?
{
"$ref": "https://asyncapi.com/definitions/2.4.0/schema.json"
},
{
"$ref": "https://asyncapi.com/definitions/2.4.0/Reference.json"
}
a3911c6
I have made the changes @char0n |
@KhudaDad414 would you mind reapproving if you agree with the changes? |
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.
LGTM!
/rtm |
Description
Adds
sessionExpiryInterval
to MQTT5 server bindings, which is required for asyncapi/glee#323