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) {
4545 c .l .Lock ()
4646 defer c .l .Unlock ()
4747 c .declarations = append (c .declarations , d ... )
48+ if ch , err := c .channel (); err == nil {
49+ for _ , declare := range d {
50+ declare (ch )
51+ }
52+ }
4853}
4954
5055// Consume used to declare consumers
5156func (c * Client ) Consume (cons * Consumer ) {
5257 c .l .Lock ()
5358 defer c .l .Unlock ()
5459 c .consumers [cons ] = struct {}{}
60+ if ch , err := c .channel (); err == nil {
61+ go cons .serve (c , ch )
62+ }
5563}
5664
5765func (c * Client ) deleteConsumer (cons * Consumer ) {
@@ -65,6 +73,9 @@ func (c *Client) Publish(pub *Publisher) {
6573 c .l .Lock ()
6674 defer c .l .Unlock ()
6775 c .publishers [pub ] = struct {}{}
76+ if ch , err := c .channel (); err == nil {
77+ go pub .serve (c , ch )
78+ }
6879}
6980
7081func (c * Client ) deletePublisher (pub * Publisher ) {
You can’t perform that action at this time.
0 commit comments