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

Feature Request: Conditional reading for PGMQ #288

Open
yayahc opened this issue Aug 6, 2024 · 2 comments
Open

Feature Request: Conditional reading for PGMQ #288

yayahc opened this issue Aug 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@yayahc
Copy link
Contributor

yayahc commented Aug 6, 2024

I request an enhancement for the PGMQ extension to support conditional message retrieval. This would allow pulling based on specific attributes directly within the pgmq_read function.

eg: Pull messages with a specific type:
SELECT * FROM pgmq_read('my_queue', 30, 1, '{"type": "A"}');

Thank you for considering this feature request.

@ChuckHend
Copy link
Contributor

Hello @yayahc. To clarify, do you mean that {"type": "A"} would be part of the message, correct? not introducing a new "type" attribute to each message record. E.g. for example, two messages in queue like below, filter for any messages that have the type key with value equal to A:

 msg_id | read_ct |          enqueued_at          |              vt               |             message             
--------+---------+-------------------------------+-------------------------------+---------------------------------
      1 |       0 | 2024-08-06 13:35:08.771765+00 | 2024-08-06 13:35:08.774281+00 | {"type": "A", "hello": "world"}
      2 |       0 | 2024-08-06 13:35:30.572968+00 | 2024-08-06 13:35:30.574291+00 | {"type": "B", "hello": "earth"}

SELECT * FROM pgmq.read('my_queue', 30, 1, '{"type": "A"}'); would return just msg_id = 1.

I think this would be a great feature. There have been some offline discussions about having a feature like this for pgmq.delete() and pgmq.archive() in addition to pgmq.read().

@theory , I wonder if any of the jsonpath projects might come in useful here.

@ChuckHend ChuckHend added the enhancement New feature or request label Aug 6, 2024
@yayahc
Copy link
Contributor Author

yayahc commented Aug 6, 2024

@ChuckHend exactly, it will be awesome to have this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants