Skip to content

Commit

Permalink
Supply library-defined props with NewConnectionProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
slagiewka committed Jan 19, 2023
1 parent dd91ad5 commit 452d08d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,15 @@ type Config struct {
Dial func(network, addr string) (net.Conn, error)
}

// NewConnectionProperties initialises an amqp.Table struct to empty value. This
// amqp.Table can be used as Properties in amqp.Config to set the connection
// name, using amqp.DialConfig()
// NewConnectionProperties creates an amqp.Table to be used as amqp.Config.Properties.
//
// Defaults to library-defined values. For empty properties, use make(amqp.Table) instead.
func NewConnectionProperties() Table {
return make(Table)
return Table{
"product": defaultProduct,
"version": buildVersion,
"platform": platform,
}
}

// Connection manages the serialization and deserialization of frames from IO
Expand Down Expand Up @@ -875,11 +879,7 @@ func (c *Connection) openStart(config Config) error {

func (c *Connection) openTune(config Config, auth Authentication) error {
if len(config.Properties) == 0 {
config.Properties = Table{
"product": defaultProduct,
"version": buildVersion,
"platform": platform,
}
config.Properties = NewConnectionProperties()
}

config.Properties["capabilities"] = Table{
Expand Down

0 comments on commit 452d08d

Please sign in to comment.