Skip to content
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

pgmq metadata #78

Merged
merged 19 commits into from
Feb 4, 2023
Merged

pgmq metadata #78

merged 19 commits into from
Feb 4, 2023

Conversation

ChuckHend
Copy link
Collaborator

@ChuckHend ChuckHend commented Feb 3, 2023

  • adds two fields to each queue's table;
    • enqueued_at - time the message hit the queue
    • read_ct number of times the message has been read. if its >1 it usually means there's a problem somewhere in the application
  • changed queue.enqueue() to queue.send(). This is easier to type and more in line with SQS and other messaging systems.
  • added pgmq_metadata table. this contains one record for every queue and will be what we can query for list_queues(). Currently only contains the name of the queues but will have other information later, like time created.
  • added the pgmq_<queue_name>_archive table. It won't be in use in this PR, but we will be adding queue.archive() which will be the alternative to queue.delete_message(). Instead of deleting the message completely, it will move it to the archive table.

Comment on lines +134 to +139
let mut tx = self.connection.begin().await?;
let setup = query::init_queue(queue_name);
for q in setup {
sqlx::query(&q).execute(&mut tx).await?;
}
tx.commit().await?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating a queue now does a bunch of things, all are no-ops if the data already exists. metadata table, queue table, queue archive table, create index, insert metadata to queue metadata table

@ChuckHend ChuckHend marked this pull request as ready for review February 4, 2023 14:15
@ChuckHend ChuckHend merged commit fb8631c into main Feb 4, 2023
@ChuckHend ChuckHend deleted the ahendel/pgmqTableFields branch February 4, 2023 14:24
@ChuckHend ChuckHend mentioned this pull request Feb 8, 2023
sjmiller609 pushed a commit that referenced this pull request Dec 5, 2023
* install ca-certificates with the Docker image

* also remove package cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants