@@ -5,12 +5,12 @@ It creates a collection (a queue or topic) there. Pushes messages to the tail of
55The transport works with [ phpredis] ( https://github.com/phpredis/phpredis ) php extension or [ predis] ( https://github.com/nrk/predis ) library.
66Make sure you installed either of them
77
8- ** Limitations** It works only in auto ack mode hence If consumer crashes the message is lost.
9-
108* [ Installation] ( #installation )
119* [ Create context] ( #create-context )
1210* [ Send message to topic] ( #send-message-to-topic )
1311* [ Send message to queue] ( #send-message-to-queue )
12+ * [ Send expiration message] ( #send-expiration-message )
13+ * [ Send delayed message] ( #send-delayed-message )
1414* [ Consume message] ( #consume-message )
1515* [ Delete queue (purge messages)] ( #delete-queue-purge-messages )
1616* [ Delete topic (purge messages)] ( #delete-topic-purge-messages )
@@ -56,7 +56,7 @@ $factory = new RedisConnectionFactory([
5656]);
5757
5858// same as above but given as DSN string
59- $factory = new RedisConnectionFactory('redis://example.com:1000?vendor=phpredis ');
59+ $factory = new RedisConnectionFactory('redis+phpredis ://example.com:1000');
6060
6161$psrContext = $factory->createContext();
6262
@@ -68,7 +68,7 @@ $redis = new \Enqueue\Redis\PhpRedis([ /** redis connection options */ ]);
6868$redis->connect();
6969
7070// Secure\TLS connection. Works only with predis library. Note second "S" in scheme.
71- $factory = new RedisConnectionFactory('rediss://user:pass@host/0?vendor=predis ');
71+ $factory = new RedisConnectionFactory('rediss+predis ://user:pass@host/0');
7272
7373$factory = new RedisConnectionFactory($redis);
7474```
@@ -82,7 +82,7 @@ use Enqueue\Redis\RedisConnectionFactory;
8282$connectionFactory = new RedisConnectionFactory([
8383 'host' => 'localhost',
8484 'port' => 6379,
85- 'vendor ' => 'predis',
85+ 'scheme_extensions ' => 'predis',
8686]);
8787
8888$psrContext = $connectionFactory->createContext();
@@ -102,7 +102,7 @@ $options = [];
102102
103103$redis = new PRedis(new \PRedis\Client($config, $options));
104104
105- $factory = new RedisConnectionFactory(['vendor' => 'custom', 'redis' => $redis] );
105+ $factory = new RedisConnectionFactory($redis);
106106```
107107
108108## Send message to topic
@@ -129,6 +129,38 @@ $message = $psrContext->createMessage('Hello world!');
129129$psrContext->createProducer()->send($fooQueue, $message);
130130```
131131
132+ ## Send expiration message
133+
134+ ``` php
135+ <?php
136+ /** @var \Enqueue\Redis\RedisContext $psrContext */
137+ /** @var \Enqueue\Redis\RedisDestination $fooQueue */
138+
139+ $message = $psrContext->createMessage('Hello world!');
140+
141+ $psrContext->createProducer()
142+ ->setTimeToLive(60000) // 60 sec
143+ //
144+ ->send($fooQueue, $message)
145+ ;
146+ ```
147+
148+ ## Send delayed message
149+
150+ ``` php
151+ <?php
152+ /** @var \Enqueue\Redis\RedisContext $psrContext */
153+ /** @var \Enqueue\Redis\RedisDestination $fooQueue */
154+
155+ $message = $psrContext->createMessage('Hello world!');
156+
157+ $psrContext->createProducer()
158+ ->setDeliveryDelay(5000) // 5 sec
159+
160+ ->send($fooQueue, $message)
161+ ;
162+ ````
163+
132164## Consume message:
133165
134166```php
@@ -141,6 +173,9 @@ $consumer = $psrContext->createConsumer($fooQueue);
141173$message = $consumer->receive();
142174
143175// process a message
176+
177+ $consumer->acknowledge($message);
178+ //$consumer->reject($message);
144179```
145180
146181## Delete queue (purge messages):
0 commit comments