Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-pgmq
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-pgmq
Commits
1dd92f0a
Verified
Commit
1dd92f0a
authored
Oct 23, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readMessageById
This is to just read the message from queue, by given id
parent
b45423de
Pipeline
#6886
passed with stages
in 5 minutes and 32 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
Simple.hs
src/Database/PGMQ/Simple.hs
+10
-0
No files found.
src/Database/PGMQ/Simple.hs
View file @
1dd92f0a
...
...
@@ -27,6 +27,7 @@ module Database.PGMQ.Simple
,
purgeQueue
,
readMessage
,
readMessageFromArchive
,
readMessageById
,
readMessages
,
readMessageWithPoll
,
readMessagesWithPoll
...
...
@@ -199,6 +200,15 @@ readMessageFromArchive conn queue msgId = do
[
sql
|
SELECT msg_id, read_ct, enqueued_at, archived_at, vt, message FROM ? WHERE msg_id = ?
|]
(
PSQL
.
QualifiedIdentifier
(
Just
"pgmq"
)
$
T
.
pack
archiveTable
,
msgId
)
>>=
return
.
headMay
-- | Read a message from queue with given ID (for querying purposes, doesn't pop message from queue)
readMessageById
::
(
SerializableMessage
a
)
=>
PSQL
.
Connection
->
Queue
->
MessageId
->
IO
(
Maybe
(
Message
a
))
readMessageById
conn
queue
msgId
=
do
let
queueTable
=
"q_"
<>
queue
PSQL
.
query
conn
[
sql
|
SELECT msg_id, read_ct, enqueued_at, NULL, vt, message FROM ? WHERE msg_id = ?
|]
(
PSQL
.
QualifiedIdentifier
(
Just
"pgmq"
)
$
T
.
pack
queueTable
,
msgId
)
>>=
return
.
headMay
{-| Reads given number of messages from given queue
https://tembo.io/pgmq/api/sql/functions/#read -}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment