@@ -37,9 +37,33 @@ func DialTLS(url string, amqps *tls.Config, opts ...ConnectionOption) (*Connecti
37
37
// DialConfig wraps amqp.DialConfig function and adds reconnection ability.
38
38
// Never returns error.
39
39
func DialConfig (url string , config amqp.Config , opts ... ConnectionOption ) (* Connection , error ) {
40
+ config .Properties = setupDefaultConfigProperties (config .Properties )
40
41
return DialWithDialer (func () (* amqp.Connection , error ) { return amqp .DialConfig (url , config ) }, opts ... )
41
42
}
42
43
44
+ const (
45
+ defaultProduct = "https://github.com/devimteam/amqp"
46
+ defaultVersion = "v1.1.3"
47
+ defaultPlatform = "golang"
48
+ defaultInformation = "github.com/devimteam/amqp is a wrapper of https://github.com/streadway/amqp"
49
+ )
50
+
51
+ func setupDefaultConfigProperties (prop amqp.Table ) amqp.Table {
52
+ if _ , ok := prop ["product" ]; ! ok {
53
+ prop ["product" ] = defaultProduct
54
+ }
55
+ if _ , ok := prop ["version" ]; ! ok {
56
+ prop ["version" ] = defaultVersion
57
+ }
58
+ if _ , ok := prop ["platform" ]; ! ok {
59
+ prop ["platform" ] = defaultPlatform
60
+ }
61
+ if _ , ok := prop ["information" ]; ! ok {
62
+ prop ["information" ] = defaultInformation
63
+ }
64
+ return prop
65
+ }
66
+
43
67
// Open wraps amqp.Open function and adds reconnection ability.
44
68
// Never returns error.
45
69
func Open (conn io.ReadWriteCloser , config amqp.Config , opts ... ConnectionOption ) (* Connection , error ) {
0 commit comments