Skip to content

Commit

Permalink
Add --tcp-nodelay option used in AMQP-1.0
Browse files Browse the repository at this point in the history
Requires modified go-amqp
  • Loading branch information
mkuratczyk committed Jan 10, 2025
1 parent f9e6557 commit 091d258
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ func RootCmd() *cobra.Command {
"Binding key for queue declarations")
rootCmd.PersistentFlags().StringVar(&cfg.Exchange, "exchange", "",
"Exchange for binding declarations")
rootCmd.PersistentFlags().BoolVar(&cfg.TCPNoDelay, "tcp-nodelay", true,
"TCP_NODELAY (Nagle's algorithm)")

// messages
rootCmd.PersistentFlags().IntVarP(&cfg.Size, "size", "s", 12, "Message payload size in bytes")
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/rabbitmq/omq

go 1.23.0

replace github.com/Azure/go-amqp => github.com/mkuratczyk/go-amqp v0.0.0-20250107231955-7ba9aa503a31

require (
github.com/Azure/go-amqp v1.4.0-beta.1
github.com/VictoriaMetrics/metrics v1.35.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/Azure/go-amqp v1.4.0-beta.1 h1:BjZM/308FpfsQjX0gXtYK8Vx+WgQ1eng3oVQDEeXMmA=
github.com/Azure/go-amqp v1.4.0-beta.1/go.mod h1:vZAogwdrkbyK3Mla8m/CxSc/aKdnTZ4IbPxl51Y5WZE=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/VictoriaMetrics/metrics v1.35.1 h1:o84wtBKQbzLdDy14XeskkCZih6anG+veZ1SwJHFGwrU=
github.com/VictoriaMetrics/metrics v1.35.1/go.mod h1:r7hveu6xMdUACXvB8TYdAj8WEsKzWB0EkpJN+RDtOf8=
Expand Down Expand Up @@ -158,6 +156,8 @@ github.com/michaelklishin/rabbit-hole v1.5.0 h1:Bex27BiFDsijCM9D0ezSHqyy0kehpYHu
github.com/michaelklishin/rabbit-hole v1.5.0/go.mod h1:vvI1uOitYZi0O5HEGXhaWC1XT80Gy+HvFheJ+5Krlhk=
github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
github.com/mkuratczyk/go-amqp v0.0.0-20250107231955-7ba9aa503a31 h1:UJnjCtPHTTbHCJ8Ccwif5ndt7jG3uU6vRbrchnOoMLE=
github.com/mkuratczyk/go-amqp v0.0.0-20250107231955-7ba9aa503a31/go.mod h1:vZAogwdrkbyK3Mla8m/CxSc/aKdnTZ4IbPxl51Y5WZE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
Expand Down
1 change: 1 addition & 0 deletions pkg/amqp10/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func (c *Amqp10Consumer) Connect() {
TLSConfig: &tls.Config{
ServerName: hostname,
},
TCPNoDelay: &c.Config.TCPNoDelay,
})
if err != nil {
select {
Expand Down
1 change: 1 addition & 0 deletions pkg/amqp10/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func (p *Amqp10Publisher) Connect() {
TLSConfig: &tls.Config{
ServerName: hostname,
},
TCPNoDelay: &p.Config.TCPNoDelay,
})

if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ type Config struct {
LogOutOfOrder bool
PrintAllMetrics bool
ConsumerStartupDelay time.Duration
TCPNoDelay bool
}

func NewConfig() Config {
Expand Down

0 comments on commit 091d258

Please sign in to comment.