File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -45,13 +45,21 @@ func (c *Client) Declare(d []Declaration) {
45
45
c .l .Lock ()
46
46
defer c .l .Unlock ()
47
47
c .declarations = append (c .declarations , d ... )
48
+ if ch , err := c .channel (); err == nil {
49
+ for _ , declare := range d {
50
+ declare (ch )
51
+ }
52
+ }
48
53
}
49
54
50
55
// Consume used to declare consumers
51
56
func (c * Client ) Consume (cons * Consumer ) {
52
57
c .l .Lock ()
53
58
defer c .l .Unlock ()
54
59
c .consumers [cons ] = struct {}{}
60
+ if ch , err := c .channel (); err == nil {
61
+ go cons .serve (c , ch )
62
+ }
55
63
}
56
64
57
65
func (c * Client ) deleteConsumer (cons * Consumer ) {
@@ -65,6 +73,9 @@ func (c *Client) Publish(pub *Publisher) {
65
73
c .l .Lock ()
66
74
defer c .l .Unlock ()
67
75
c .publishers [pub ] = struct {}{}
76
+ if ch , err := c .channel (); err == nil {
77
+ go pub .serve (c , ch )
78
+ }
68
79
}
69
80
70
81
func (c * Client ) deletePublisher (pub * Publisher ) {
You can’t perform that action at this time.
0 commit comments