Skip to content

Commit

Permalink
Merge pull request #224 from vgarvardt/feat/hook-job-undone
Browse files Browse the repository at this point in the history
feat: hooksJobUndone to let user handle critical job done failure
  • Loading branch information
vgarvardt authored Oct 2, 2023
2 parents 658d2d0 + 30ae0da commit d460ce3
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 105 deletions.
2 changes: 1 addition & 1 deletion _example/outbox-worker-kafka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ implementation that uses `gue` for messages store/relay processes.

In order to run this example you'll need to have the following tools preinstalled in your system:

- Golang 1.18+
- Golang 1.19+
- Docker with compose command - run `docker compose version` to ensure it works
- [Task runner](https://taskfile.dev/installation/)

Expand Down
5 changes: 3 additions & 2 deletions _example/outbox-worker-kafka/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package main

import (
"encoding/json"
"errors"
"fmt"
"log"
"time"

"github.com/AlecAivazis/survey/v2"
"github.com/AlecAivazis/survey/v2/terminal"
"github.com/Shopify/sarama"
"github.com/IBM/sarama"
"github.com/google/uuid"
"github.com/spf13/cobra"
"github.com/vgarvardt/gue/v5"
Expand Down Expand Up @@ -48,7 +49,7 @@ func newClientCommand() *cobra.Command {
&num,
survey.WithValidator(survey.Required),
); err != nil {
if err == terminal.InterruptErr {
if errors.Is(err, terminal.InterruptErr) {
log.Printf("Received terminal interrupt, exiting app\n")
return nil
}
Expand Down
6 changes: 3 additions & 3 deletions _example/outbox-worker-kafka/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strings"
"syscall"

"github.com/Shopify/sarama"
"github.com/IBM/sarama"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/vgarvardt/gue/v5"
"github.com/vgarvardt/gue/v5/adapter"
Expand Down Expand Up @@ -121,8 +121,8 @@ func createTestTopic() error {
NumPartitions: 5,
ReplicationFactor: 1,
}, false); err != nil {
topicErr, ok := err.(*sarama.TopicError)
if !ok || topicErr.Err != sarama.ErrTopicAlreadyExists {
var topicErr *sarama.TopicError
if !errors.As(err, &topicErr) || topicErr.Err != sarama.ErrTopicAlreadyExists {
return fmt.Errorf("could not create test topic: %w", err)
}
}
Expand Down
55 changes: 27 additions & 28 deletions _example/outbox-worker-kafka/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,50 @@ module github.com/vgarvardt/gue/v5/example/outbox-worker-kafka
go 1.19

require (
github.com/AlecAivazis/survey/v2 v2.3.6
github.com/Shopify/sarama v1.37.2
github.com/google/uuid v1.3.0
github.com/jackc/pgx/v5 v5.2.0
github.com/spf13/cobra v1.6.0
github.com/vgarvardt/gue/v5 v5.0.0
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/IBM/sarama v1.41.1
github.com/google/uuid v1.3.1
github.com/jackc/pgx/v5 v5.4.3
github.com/spf13/cobra v1.7.0
github.com/vgarvardt/gue/v5 v5.5.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/eapache/go-resiliency v1.3.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
github.com/eapache/go-resiliency v1.4.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/puddle/v2 v2.1.2 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/oklog/ulid/v2 v2.1.0 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vgarvardt/backoff v1.0.0 // indirect
go.opentelemetry.io/otel v1.11.2 // indirect
go.opentelemetry.io/otel/metric v0.34.0 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.0.0-20220923202941-7f9b1623fab7 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
go.opentelemetry.io/otel v1.17.0 // indirect
go.opentelemetry.io/otel/metric v1.17.0 // indirect
go.opentelemetry.io/otel/trace v1.17.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
)
Loading

0 comments on commit d460ce3

Please sign in to comment.