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

New package for rabbitmq #364

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

New package for rabbitmq #364

wants to merge 16 commits into from

Conversation

jensloe-nhn
Copy link
Collaborator

@jensloe-nhn jensloe-nhn commented Mar 12, 2025

Usage examples:

c, err := rabbitmq.NewConsumer(myHandler, rabbitmq.WithAuthenticator(myAuthenticator), rabbitmq.WithLogger(myLogger))
if err != nil {
  log.Fatal(err)
}
defer func() {
  _ = c.Shutdown(context.Background)
}()

c.Consume(context.Background)

@jensloe-nhn jensloe-nhn marked this pull request as ready for review March 20, 2025 09:22
Copy link
Collaborator

@havardelnan havardelnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move it to pkg/clients

Copy link
Collaborator

@havardelnan havardelnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe return a cancel function so we can defere cancelfunc() or add a cacel method that can be called from defere

defere c.Cancel()

@jensloe-nhn
Copy link
Collaborator Author

Maybe move it to pkg/clients

Package is now moved to pkg/clients/rabbitmq

@jensloe-nhn
Copy link
Collaborator Author

Maybe return a cancel function so we can defere cancelfunc() or add a cacel method that can be called from defere

defere c.Cancel()

The underlying connection interface has a Shutdown method that can be deferred and should handle context cancel. Would this cancel method be on the consumer/producer?

@havardelnan
Copy link
Collaborator

Maybe return a cancel function so we can defere cancelfunc() or add a cacel method that can be called from defere

defere c.Cancel()

The underlying connection interface has a Shutdown method that can be deferred and should handle context cancel. Would this cancel method be on the consumer/producer?

Fair, could do i guess

defere c.Shutdown(context.Background)

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

Successfully merging this pull request may close these issues.

2 participants