-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Conversation
|
||
class BigMessage(RawMessage): | ||
""" | ||
The BigMessage class provides arbitrarily large message payloads |
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.
Should we say "up to 5Gb" (the S3 limit) here? It's unlikely someone will do it, but they should be aware & it'll give people a sense of scale.
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.
Yep.
LGTM otherwise. |
Excellent... I'm going to look into how to integrate this into Kombu/Celery ASAP. I'll do a more thorough review a little later today just so you have another set of eyes on this change. |
Other than the comment above this looks good 👍 |
return key.get_contents_as_string() | ||
|
||
def delete(self): | ||
RawMessage.delete(self) |
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.
Shouldn't you try to delete the S3 file first? If the RawMessage.delete(self) raises any exception, then the file is left over dangling in S3 land forever.
…e to decode s3_url.
Latest changes look good. 🚢-it |
Initial version of BigMessage.
This is an initial attempt at a big message, basically an SQS message that stores it's payload in S3 and therefore allows for arbitrarily large payloads.
An example:
You need to pass in a
file-like
object as thebody
of the message. You also have to pass in ans3_url
to specify where the message should be stored. Thes3_url
should be of the form:If no
key
is specified, akey
will be created using UUID's and the body of the message will be stored in the specified bucket using the UUID as a key. The contents of thefile-like
object are uploaded to that key in S3 and a reference to the new object is stored in the message body. If abucket
andkey
are specified, it is interpreted as specifying an existing object in S3 and no object is uploaded. The BigMessage will simply refer to the existing object in the body of the message.When a
BigMessage
object is deleted, it will attempt to delete the object in S3.Feedback on the overall operability of this implementation would be appreciated as well as feedback on the code itself.