@@ -175,17 +175,16 @@ $client = new SimpleClient('amqp:');
175175
176176// composer require enqueue/fs
177177$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) {
184179 echo $message->getBody().PHP_EOL;
185180
186181 // your event processor logic here
187182});
188183
184+ $client->setupBroker();
185+
186+ $client->sendEvent('a_foo_topic', 'message');
187+
189188// this is a blocking call, it'll consume message until it is interrupted
190189$client->consume();
191190```
@@ -207,18 +206,18 @@ $client = new SimpleClient('amqp:');
207206// composer require enqueue/fs
208207//$client = new SimpleClient('file://foo/bar');
209208
210- $client->setupBroker();
211-
212- $client->bind(Config::COMMAND_TOPIC, 'bar_command', function(PsrMessage $message) {
209+ $client->bindCommand('bar_command', function(PsrMessage $message) {
213210 // your bar command processor logic here
214211});
215212
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) {
217214 // your baz reply command processor logic here
218215
219216 return Result::reply($context->createMessage('theReplyBody'));
220217});
221218
219+ $client->setupBroker();
220+
222221// It is sent to one consumer.
223222$client->sendCommand('bar_command', 'aMessageData');
224223
0 commit comments