Refactoring: Move delay parameter as last in Producer::dpub
This commit is contained in:
@ -44,7 +44,7 @@ Usage
|
||||
### Publish
|
||||
|
||||
```php
|
||||
use Nsq\Producer;
|
||||
use Nsq\Producer;use function Amp\Promise\timeout;
|
||||
|
||||
$producer = new Producer(address: 'tcp://nsqd:4150');
|
||||
|
||||
@ -58,7 +58,7 @@ $producer->mpub('topic', [
|
||||
]);
|
||||
|
||||
// Publish a deferred message to a topic
|
||||
$producer->dpub('topic', 5000, 'Deferred message');
|
||||
$producer->dpub('topic', 'Deferred message', delay: 5000);
|
||||
```
|
||||
|
||||
### Subscription
|
||||
|
@ -37,8 +37,8 @@ final class Producer extends Connection
|
||||
/**
|
||||
* @psalm-suppress PossiblyFalseOperand
|
||||
*/
|
||||
public function dpub(string $topic, int $deferTime, string $body): void
|
||||
public function dpub(string $topic, string $body, int $delay): void
|
||||
{
|
||||
$this->command('DPUB', [$topic, $deferTime], $body)->response()->okOrFail();
|
||||
$this->command('DPUB', [$topic, $delay], $body)->response()->okOrFail();
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ final class NsqTest extends TestCase
|
||||
self::assertSame('Second mpub message.', $message->body);
|
||||
$message->finish();
|
||||
|
||||
$producer->dpub(__FUNCTION__, 2000, 'Deferred message.');
|
||||
$producer->dpub(__FUNCTION__, 'Deferred message.', 2000);
|
||||
|
||||
$generator->next();
|
||||
/** @var null|Message $message */
|
||||
|
Reference in New Issue
Block a user