@@ -40,6 +40,21 @@ public function binding($vhost, $exchange, $queue)
40
40
return $ this ->client ->send (array ('/api/bindings/{vhost}/e/{exchange}/q/{queue} ' , array ('vhost ' => $ vhost , 'exchange ' => $ exchange , 'queue ' => $ queue )));
41
41
}
42
42
43
+ /**
44
+ * A list of all bindings between two exchanges. Remember, two exchanges can be bound together many times with
45
+ * different parameters!
46
+ *
47
+ * @param string $vhost
48
+ * @param string $source
49
+ * @param string $destination
50
+ *
51
+ * @return array
52
+ */
53
+ public function exchangeBinding ($ vhost , $ source , $ destination )
54
+ {
55
+ return $ this ->client ->send (array ('/api/bindings/{vhost}/e/{source}/e/{destination} ' , array ('vhost ' => $ vhost , 'source ' => $ source , 'destination ' => $ destination )));
56
+ }
57
+
43
58
/**
44
59
* To create a new binding, POST to this URI. You will need a body looking something like this:
45
60
*
@@ -73,6 +88,39 @@ public function create($vhost, $exchange, $queue, $routingKey = null, array $arg
73
88
return $ this ->client ->send (array ('/api/bindings/{vhost}/e/{exchange}/q/{queue} ' , array ('vhost ' => $ vhost , 'exchange ' => $ exchange , 'queue ' => $ queue )), 'POST ' , null , $ parameters );
74
89
}
75
90
91
+ /**
92
+ * To create a new exchange to exchange binding, POST to this URI. You will need a body looking something like this:
93
+ *
94
+ * {
95
+ * "routing_key": "my_routing_key",
96
+ * "arguments": []
97
+ * }
98
+ *
99
+ * All keys are optional. The response will contain a Location header telling you the URI of your new binding.
100
+ *
101
+ * @param string $vhost
102
+ * @param string $source
103
+ * @param string $destination
104
+ * @param string|null $routingKey
105
+ * @param array|null $arguments
106
+ * @return array
107
+ */
108
+ public function createExchange ($ vhost , $ source , $ destination , $ routingKey = null , array $ arguments = null )
109
+ {
110
+ $ parameters = array ();
111
+
112
+ if ($ routingKey ) {
113
+ $ parameters ['routing_key ' ] = $ routingKey ;
114
+ } else {
115
+ $ parameters ['routing_key ' ] = '' ;
116
+ }
117
+ if ($ arguments ) {
118
+ $ parameters ['arguments ' ] = $ arguments ;
119
+ }
120
+
121
+ return $ this ->client ->send (array ('/api/bindings/{vhost}/e/{source}/e/{destination} ' , array ('vhost ' => $ vhost , 'source ' => $ source , 'destination ' => $ destination )), 'POST ' , null , $ parameters );
122
+ }
123
+
76
124
/**
77
125
* An individual binding between an exchange and a queue. The props part of the URI is a "name" for the binding
78
126
* composed of its routing key and a hash of its arguments.
@@ -89,7 +137,22 @@ public function get($vhost, $exchange, $queue, $props)
89
137
}
90
138
91
139
/**
92
- * Remove an individual binding.
140
+ * An individual binding between two exchanges. The props part of the URI is a "name" for the binding
141
+ * composed of its routing key and a hash of its arguments.
142
+ *
143
+ * @param string $vhost
144
+ * @param string $source
145
+ * @param string $destination
146
+ * @param string $props
147
+ * @return array
148
+ */
149
+ public function getExchange ($ vhost , $ source , $ destination , $ props )
150
+ {
151
+ return $ this ->client ->send (array ('/api/bindings/{vhost}/e/{source}/e/{destination}/{props} ' , array ('vhost ' => $ vhost , 'source ' => $ source , 'destination ' => $ destination , 'props ' => $ props )));
152
+ }
153
+
154
+ /**
155
+ * Remove an individual binding between an exchange and a queue.
93
156
*
94
157
* @param string $vhost
95
158
* @param string $exchange
@@ -101,4 +164,18 @@ public function delete($vhost, $exchange, $queue, $props)
101
164
{
102
165
return $ this ->client ->send (array ('/api/bindings/{vhost}/e/{exchange}/q/{queue}/{props} ' , array ('vhost ' => $ vhost , 'exchange ' => $ exchange , 'queue ' => $ queue , 'props ' => $ props )), 'DELETE ' );
103
166
}
167
+
168
+ /**
169
+ * Remove an individual binding between two exchanges.
170
+ *
171
+ * @param string $vhost
172
+ * @param string $source
173
+ * @param string $destination
174
+ * @param string $props
175
+ * @return array
176
+ */
177
+ public function deleteExchange ($ vhost , $ source , $ destination , $ props )
178
+ {
179
+ return $ this ->client ->send (array ('/api/bindings/{vhost}/e/{source}/e/{destination}/{props} ' , array ('vhost ' => $ vhost , 'source ' => $ source , 'destination ' => $ destination , 'props ' => $ props )), 'DELETE ' );
180
+ }
104
181
}
0 commit comments