-
Notifications
You must be signed in to change notification settings - Fork 145
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
By default, the virtual host configured in the uri is used #238
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,13 @@ package main | |
import ( | ||
"context" | ||
"flag" | ||
amqp "github.com/rabbitmq/amqp091-go" | ||
"log" | ||
"os" | ||
"os/signal" | ||
"syscall" | ||
"time" | ||
|
||
amqp "github.com/rabbitmq/amqp091-go" | ||
) | ||
|
||
var ( | ||
|
@@ -58,7 +59,6 @@ func setupCloseHandler(exitCh chan struct{}) { | |
|
||
func publish(ctx context.Context, publishOkCh <-chan struct{}, confirmsCh chan<- *amqp.DeferredConfirmation, confirmsDoneCh <-chan struct{}, exitCh chan struct{}) { | ||
config := amqp.Config{ | ||
Vhost: "/", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does other example code use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My suggestion is that the configured uri vhost should be used first. In other cases, you can configure it yourself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I understand the benefit of this. IMO, having There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The reason why I modified it like this is because after I set the Vhost in the uri, I ran the code and reported an error. After comparison, I found that this was not the vhost I set. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this is just my personal understanding. If you think the original way is better, I think my submission can be canceled. At the same time, I am also happy to communicate with you, thank you. |
||
Properties: amqp.NewConnectionProperties(), | ||
} | ||
config.Properties.SetClientConnectionName("producer-with-confirms") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this change due to your preference, or to a tool auto-formatting the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by go fmt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there other example code that should be formatted as part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go fmt ./...
doesn't make this change for me 😕 Are you runninggo fmt
with any special flag?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right, I think my submitted code was automatically formatted by the development tool (goland); I hope you ignore the submission about here. Thanks