Skip to content

Commit b4eb809

Browse files
Add two more operations to QueueOps
1 parent f8961df commit b4eb809

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
* `QueueOps#x_arguments` is a new method that returns the optional arguments of an object (`XArguments`)
88
* `QueueOps#has_queue_ttl_arg` is a new method that returns true if optional arguments of an object include a queue TTL argument (`"x-expires"`)
9-
* `QueueOps#has_message_ttl_arg` is a new method that returns true if optional arguments of an object include a message TTL argument (`"x-message-ttl"`)
9+
* `QueueOps#has_message_ttl_arg`: returns true if optional arguments of an object include a message TTL argument (`"x-message-ttl"`)
10+
* `QueueOps#has_length_limit_in_messages`: returns true if optional arguments of an object include a queue length limit in messages (`"x-max-length"`)
11+
* `QueueOps#has_length_limit_in_bytes`: returns true if optional arguments of an object include a queue length limit in bytes (`"x-max-length-bytes"`)
1012

1113

1214

src/responses.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ impl XArguments {
7171
];
7272
pub const X_EXPIRES_KEY: &'static str = "x-expires";
7373
pub const X_MESSAGE_TTL_KEY: &'static str = "x-message-ttl";
74+
pub const X_MAX_LENGTH_KEY: &'static str = "x-max-length";
75+
pub const X_MAX_LENGTH_BYTES_KEY: &'static str = "x-max-length-bytes";
7476

7577
pub fn get(&self, key: &str) -> Option<&serde_json::Value> {
7678
self.0.get(key)
@@ -790,6 +792,14 @@ pub trait QueueOps {
790792
self.x_arguments()
791793
.contains_key(XArguments::X_MESSAGE_TTL_KEY)
792794
}
795+
796+
fn has_length_limit_in_messages(&self) -> bool {
797+
self.x_arguments().contains_key(XArguments::X_MAX_LENGTH_KEY)
798+
}
799+
800+
fn has_length_limit_in_bytes(&self) -> bool {
801+
self.x_arguments().contains_key(XArguments::X_MAX_LENGTH_BYTES_KEY)
802+
}
793803
}
794804

795805
#[derive(Debug, Deserialize, Clone)]

0 commit comments

Comments
 (0)