types.go 6.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package redriver
  2. type MessageAttributes struct {
  3. ApproximateFirstReceiveTimestamp int32 `json:"approximate_first_receive_timestamp,omitempty"`
  4. ApproximateReceiveCount int32 `json:"approximate_receive_count,omitempty"`
  5. SenderId string `json:"sender_id,omitempty"` // SenderId may be an IAM user or role
  6. SentTimestamp int32 `json:"sent_timestamp,omitempty"`
  7. SequenceNumber int32 `json:"sequence_number,omitempty"`
  8. }
  9. type Message struct {
  10. Attributes *MessageAttributes `json:"attributes,omitempty"`
  11. Body string `json:"body,omitempty"` // Body is not url-encoded
  12. Md5OfBody string `json:"md5_of_body,omitempty"` // Md5OfBody hold an MD5 digest of the non-URL-encoded message body string.
  13. Md5OfMessageAttributes string `json:"md5_of_message_attributes,omitempty"` // Md5OfMessageAttributes holds an MD5 digest of the non-URL-encoded message attribute string. You can use this attribute to verify that Amazon SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5 digest. For information about MD5, see RFC1321 (https://www.ietf.org/rfc/rfc1321.txt).
  14. MessageId string `json:"message_id,omitempty"` // MessageId is opaque.
  15. ReceiptHandle string `json:"receipt_handle,omitempty"` // ReceiptHandle is an identifier associated with the act of receiving the message. A new receipt handle is returned every time you receive a message. When deleting a message, you provide the last received receipt handle to delete the message.
  16. }
  17. type NameRedriveBody struct {
  18. Id string `json:"id,omitempty"`
  19. ReceiptHandle string `json:"receipt_handle,omitempty"`
  20. }
  21. type QueueInfo struct {
  22. // Name is the queue name, for both human and machine use
  23. Name string `json:"name,omitempty"`
  24. Url string `json:"url,omitempty"`
  25. Attributes *QueueInfoAttributes `json:"attributes,omitempty"`
  26. }
  27. type QueueInfoAttributes struct {
  28. // ApproximateNumberOfMessages holds the approximate number of messages available for retrieval from the queue.
  29. ApproximateNumberOfMessages int32 `json:"approximate_number_of_messages,omitempty"`
  30. // ApproximateNumberOfMessagesDelayed holds he approximate number of messages in the queue that are delayed and not available for reading immediately. This can happen when the queue is configured as a delay queue or when a message has been sent with a delay parameter.
  31. ApproximateNumberOfMessagesDelayed int32 `json:"approximate_number_of_messages_delayed,omitempty"`
  32. // ApproximateNumberOfMessagesNotVisible holds the approximate number of messages that are in flight. Messages are considered to be in flight if they have been sent to a client but have not yet been deleted or have not yet reached the end of their visibility window.
  33. ApproximateNumberOfMessagesNotVisible int32 `json:"approximate_number_of_messages_not_visible,omitempty"`
  34. // CreatedTimestamp holds the time when the queue was created in seconds (epoch time).
  35. CreatedTimestamp int32 `json:"created_timestamp,omitempty"`
  36. // DelaySeconds holds the default delay on the queue in seconds.
  37. DelaySeconds int32 `json:"delay_seconds,omitempty"`
  38. // LastModifiedTimestamp holds the time when the queue was last changed in seconds (epoch time).
  39. LastModifiedTimestamp int32 `json:"last_modified_timestamp,omitempty"`
  40. // MaximumMessageSize holds the limit of how many bytes a message can contain before Amazon SQS rejects it.
  41. MaximumMessageSize int32 `json:"maximum_message_size,omitempty"`
  42. // MessageRetentionPeriod holds the length of time, in seconds, for which Amazon SQS retains a message. When you change a queue's attributes, the change can take up to 60 seconds for most of the attributes to propagate throughout the Amazon SQS system. Changes made to the MessageRetentionPeriod attribute can take up to 15 minutes and will impact existing messages in the queue potentially causing them to be expired and deleted if the MessageRetentionPeriod is reduced below the age of existing messages.
  43. MessageRetentionPeriod int32 `json:"message_retention_period,omitempty"`
  44. QueueARN string `json:"queue_arn,omitempty"`
  45. // ReceiveMessageWaitTimeSeconds holds the length of time, in seconds, for which the ReceiveMessage action waits for a message to arrive.
  46. ReceiveMessageWaitTimeSeconds int32 `json:"receive_message_wait_time_seconds,omitempty"`
  47. // VisibilityTimeout holds the number of seconds a message remains hidden after being received. Max 43200.
  48. VisibilityTimeout int32 `json:"visibility_timeout,omitempty"`
  49. RedrivePolicy *QueueInfoAttributesRedrivePolicy `json:"redrive_policy,omitempty"`
  50. RedriveAllowPolicy *QueueInfoAttributesRedriveAllowPolicy `json:"redrive_allow_policy,omitempty"`
  51. }
  52. // QueueInfoAttributesRedriveAllowPolicy describes the permissions for the dead-letter queue redrive permission and which source queues can specify dead-letter queues.
  53. type QueueInfoAttributesRedriveAllowPolicy struct {
  54. // RedrivePermission defines which source queues can specify the current queue as the dead-letter queue.
  55. RedrivePermission string `json:"redrivePermission,omitempty"`
  56. SourceQueueARNs []string `json:"sourceQueueArns,omitempty"`
  57. }
  58. // QueueInfoAttributesRedrivePolicy holds the parameters for the dead-letter queue functionality of the source queue
  59. type QueueInfoAttributesRedrivePolicy struct {
  60. // DeadLetterTargetARN holds the Amazon Resource Name (ARN) of the dead-letter queue to which Amazon SQS moves messages after the value of maxReceiveCount is exceeded.
  61. DeadLetterTargetARN string `json:"deadLetterTargetArn,omitempty"`
  62. // MaxReceiveCount holds the number of times a message is delivered to the source queue before being moved to the dead-letter queue. Default 10. When the ReceiveCount for a message exceeds the maxReceiveCount for a queue, Amazon SQS moves the message to the dead-letter-queue.
  63. MaxReceiveCount int32 `json:"maxReceiveCount,omitempty"`
  64. }
  65. // Error is a general error response format
  66. type Error struct {
  67. // Message is a free-form string describing the error.
  68. Message string `json:"message,omitempty"`
  69. }