mirror of
https://github.com/acaloiaro/neoq
synced 2026-07-21 18:29:08 +00:00
Fix examples and remove 'sslmode' from default connect string
This commit is contained in:
parent
9dff9f241c
commit
fcc9f0ea24
4 changed files with 5 additions and 5 deletions
|
|
@ -42,7 +42,7 @@ Queue Handlers are simple Go functions that accept a `Context` parameter.
|
|||
**Example**: Add a listener on the `hello_world` queue
|
||||
|
||||
```go
|
||||
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq?sslmode=disable"))
|
||||
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq"))
|
||||
nq.Listen("hello_world", neoq.NewHandler(func(ctx context.Context) (err error) {
|
||||
j, err := neoq.JobFromContext(ctx)
|
||||
log.Println("got job id:", j.ID, "messsage:", j.Payload["message"])
|
||||
|
|
@ -55,7 +55,7 @@ nq.Listen("hello_world", neoq.NewHandler(func(ctx context.Context) (err error) {
|
|||
**Example**: Add a "Hello World" job to the `hello_world` queue
|
||||
|
||||
```go
|
||||
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq?sslmode=disable"))
|
||||
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@localhost:5432/neoq"))
|
||||
jid, _ := nq.Enqueue(neoq.Job{
|
||||
Queue: "hello_world",
|
||||
Payload: map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ func main() {
|
|||
var err error
|
||||
const queue = "foobar"
|
||||
//
|
||||
nq, _ := neoq.New("postgres://postgres:postgres@127.0.0.1:5432/neoq?sslmode=disable")
|
||||
nq, _ := neoq.New(neoq.ConnectionString("postgres://postgres:postgres@127.0.0.1:5432/neoq"))
|
||||
|
||||
handler := neoq.NewHandler(func(ctx context.Context) (err error) {
|
||||
var j *neoq.Job
|
||||
|
|
|
|||
2
neoq.go
2
neoq.go
|
|
@ -32,7 +32,7 @@ const (
|
|||
JobStatusNew = "new"
|
||||
JobStatusProcessed = "processed"
|
||||
JobStatusFailed = "failed"
|
||||
DefaultPgConnectionString = "postgres://postgres:postgres@127.0.0.1:5432/neoq?sslmode=disable"
|
||||
DefaultPgConnectionString = "postgres://postgres:postgres@127.0.0.1:5432/neoq"
|
||||
DefaultTransactionTimeout = 60000 //ms
|
||||
DefaultHandlerDeadline = 30000 //ms
|
||||
DuplicateJobID = -1
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
func TestWorkerListenConn(t *testing.T) {
|
||||
const queue = "foobar"
|
||||
pgBackend, err := NewPgBackend("postgres://postgres:postgres@127.0.0.1:5432/neoq?sslmode=disable")
|
||||
pgBackend, err := NewPgBackend("postgres://postgres:postgres@127.0.0.1:5432/neoq")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue