Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-bee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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-bee
Commits
c36845bb
Verified
Commit
c36845bb
authored
Jan 15, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
README modified, haskell-bee-pgmq README added
parent
841b32fb
Pipeline
#7219
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
README.md
README.md
+6
-2
README.md
haskell-bee-pgmq/README.md
+26
-0
No files found.
README.md
View file @
c36845bb
...
@@ -24,15 +24,18 @@ The library so far contains 3 implementations for brokers:
...
@@ -24,15 +24,18 @@ The library so far contains 3 implementations for brokers:
(c.f. https://redis.io/glossary/redis-queue/)
(c.f. https://redis.io/glossary/redis-queue/)
-
[
**STM**
](
./haskell-bee-stm
)
- which uses the
`STM`
, could be useful for testing
-
[
**STM**
](
./haskell-bee-stm
)
- which uses the
`STM`
, could be useful for testing
`pgmq`
broker so far is assumed to be most stable and complete,
`redis`
and
`STM`
are considered experimental.
The broker definition uses some more advanced GHC type extensions
The broker definition uses some more advanced GHC type extensions
(in particular,
[
type families
](
https://wiki.haskell.org/GHC/Type_families
)
)
(in particular,
[
type families
](
https://wiki.haskell.org/GHC/Type_families
)
)
at the benefit of having one clear interface for what we expect from the broker.
at the benefit of having one clear interface for what we expect from the broker.
### Worker
### Worker
The worker (defined in
[
`./src/Async/Worker.hs`
]
) is completely described by it's
`State`
.
The worker (defined in
[
`./src/Async/Worker.hs`
]
(
./src/Async/Worker.hs
)
) is completely described by it's
`State`
.
This
contains information such as:
`State`
contains information such as:
-
broker instance
-
broker instance
-
queue name (one worker is assumed to be assigned to a single queue. If you want more queues, just spawn more workers)
-
queue name (one worker is assumed to be assigned to a single queue. If you want more queues, just spawn more workers)
-
actions to be performed on incoming data
-
actions to be performed on incoming data
...
@@ -43,6 +46,7 @@ This contains information such as:
...
@@ -43,6 +46,7 @@ This contains information such as:
-
after timeout occurred
-
after timeout occurred
-
after job error
-
after job error
This project doesn't provide worker management utilities.
## Testing
## Testing
...
...
haskell-bee-pgmq/README.md
0 → 100644
View file @
c36845bb
# haskell-bee-pgmq
`pgmq`
broker implementation for
`haskell-bee`
.
## Database initialization
Notice that upon broker initialization, this calls
`PGMQ.initialize`
which tries very hard to create the pgmq schema for you.
If you also want to pre-create the database itself, with some given
user, you can try something like this:
```
haskell
import
Shelly
qualified
as
SH
createDBIfNotExists
::
Text
->
Text
->
IO
()
createDBIfNotExists
connStr
dbName
=
do
-- For the \gexec trick, see:
-- https://stackoverflow.com/questions/18389124/simulate-create-database-if-not-exists-for-postgresql
(
_res
,
_ec
)
<-
SH
.
shelly
$
SH
.
silently
$
SH
.
escaping
False
$
do
let
sql
=
"
\"
SELECT 'CREATE DATABASE "
<>
dbName
<>
"' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '"
<>
dbName
<>
"')
\\
gexec
\"
"
result
<-
SH
.
run
"echo"
[
sql
,
"|"
,
"psql"
,
"-d"
,
"
\"
"
<>
connStr
<>
"
\"
"
]
(
result
,)
<$>
SH
.
lastExitCode
return
()
```
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