@@ -175,17 +175,16 @@ $client = new SimpleClient('amqp:');
175
175
176
176
// composer require enqueue/fs
177
177
$client = new SimpleClient('file://foo/bar');
178
-
179
- $client->setupBroker();
180
-
181
- $client->sendEvent('a_foo_topic', 'message');
182
-
183
- $client->bind('a_foo_topic', 'fooProcessor', function(PsrMessage $message) {
178
+ $client->bindTopic('a_foo_topic', function(PsrMessage $message) {
184
179
echo $message->getBody().PHP_EOL;
185
180
186
181
// your event processor logic here
187
182
});
188
183
184
+ $client->setupBroker();
185
+
186
+ $client->sendEvent('a_foo_topic', 'message');
187
+
189
188
// this is a blocking call, it'll consume message until it is interrupted
190
189
$client->consume();
191
190
```
@@ -207,18 +206,18 @@ $client = new SimpleClient('amqp:');
207
206
// composer require enqueue/fs
208
207
//$client = new SimpleClient('file://foo/bar');
209
208
210
- $client->setupBroker();
211
-
212
- $client->bind(Config::COMMAND_TOPIC, 'bar_command', function(PsrMessage $message) {
209
+ $client->bindCommand('bar_command', function(PsrMessage $message) {
213
210
// your bar command processor logic here
214
211
});
215
212
216
- $client->bind(Config::COMMAND_TOPIC, 'baz_reply_command', function(PsrMessage $message, PsrContext $context) {
213
+ $client->bindCommand( 'baz_reply_command', function(PsrMessage $message, PsrContext $context) {
217
214
// your baz reply command processor logic here
218
215
219
216
return Result::reply($context->createMessage('theReplyBody'));
220
217
});
221
218
219
+ $client->setupBroker();
220
+
222
221
// It is sent to one consumer.
223
222
$client->sendCommand('bar_command', 'aMessageData');
224
223
0 commit comments