This commit is contained in:
2021-09-04 01:55:34 +03:00
committed by GitHub
parent e9dce19e25
commit ca2c2ee633
9 changed files with 344 additions and 15 deletions

View File

@ -31,7 +31,7 @@ Features
- [x] PUB
- [x] SUB
- [X] Feature Negotiation
- [ ] Discovery
- [X] Discovery
- [ ] Backoff
- [X] TLS
- [ ] Deflate
@ -80,6 +80,27 @@ $consumer = Consumer::create(
);
```
### Lookup
```php
use Nsq\Lookup;
use Nsq\Message;
$lookup = new Lookup('http://nsqlookupd0:4161');
$lookup = new Lookup(['http://nsqlookupd0:4161', 'http://nsqlookupd1:4161', 'http://nsqlookupd2:4161']);
$callable = static function (Message $message): Generator {
yield $message->touch(); // Reset the timeout for an in-flight message
yield $message->requeue(timeout: 5000); // Re-queue a message (indicate failure to process)
yield $message->finish(); // Finish a message (indicate successful processing)
};
$lookup->subscribe(topic: 'topic', channel: 'channel', onMessage: $callable);
$lookup->subscribe(topic: 'anotherTopic', channel: 'channel', onMessage: $callable);
$lookup->run();
```
### Integrations
- [Symfony](https://github.com/nsqphp/NsqBundle)