Skip to content

Commit 387b1da

Browse files
committed
[doc] add dsn_to_context usage example
1 parent 2673504 commit 387b1da

12 files changed

Lines changed: 43 additions & 3 deletions

File tree

‎docs/transport/amqp.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ $connectionFactory = new AmqpConnectionFactory();
3333

3434
// same as above
3535
$factory = new AmqpConnectionFactory('amqp:');
36-
$factory = new AmqpConnectionFactory('amqp+ext:');
3736

3837
// same as above
3938
$factory = new AmqpConnectionFactory([]);
@@ -52,6 +51,10 @@ $factory = new AmqpConnectionFactory([
5251
$factory = new AmqpConnectionFactory('amqp://user:pass@example.com:10000/%2f');
5352

5453
$psrContext = $factory->createContext();
54+
55+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
56+
$psrContext = \Enqueue\dsn_to_context('amqp:');
57+
$psrContext = \Enqueue\dsn_to_context('amqp+ext:');
5558
```
5659

5760
## Declare topic.

‎docs/transport/amqp_bunny.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ $factory = new AmqpConnectionFactory();
3333

3434
// same as above
3535
$factory = new AmqpConnectionFactory('amqp:');
36-
$factory = new AmqpConnectionFactory('amqp+bunny:');
3736

3837
// same as above
3938
$factory = new AmqpConnectionFactory([]);
@@ -52,6 +51,10 @@ $factory = new AmqpConnectionFactory([
5251
$factory = new AmqpConnectionFactory('amqp://user:pass@example.com:10000/%2f');
5352

5453
$psrContext = $factory->createContext();
54+
55+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
56+
$psrContext = \Enqueue\dsn_to_context('amqp:');
57+
$psrContext = \Enqueue\dsn_to_context('amqp+bunny:');
5558
```
5659

5760
## Declare topic.

‎docs/transport/amqp_lib.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ $factory = new AmqpConnectionFactory();
3333

3434
// same as above
3535
$factory = new AmqpConnectionFactory('amqp:');
36-
$factory = new AmqpConnectionFactory('amqp+lib:');
3736

3837
// same as above
3938
$factory = new AmqpConnectionFactory([]);
@@ -52,6 +51,10 @@ $factory = new AmqpConnectionFactory([
5251
$factory = new AmqpConnectionFactory('amqp://user:pass@example.com:10000/%2f');
5352

5453
$psrContext = $factory->createContext();
54+
55+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
56+
$psrContext = \Enqueue\dsn_to_context('amqp:');
57+
$psrContext = \Enqueue\dsn_to_context('amqp+lib:');
5558
```
5659

5760
## Declare topic.

‎docs/transport/dbal.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ $factory = new ManagerRegistryConnectionFactory($registry, [
4848
]);
4949

5050
$psrContext = $factory->createContext();
51+
52+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
53+
$psrContext = \Enqueue\dsn_to_context('mysql:');
5154
```
5255

5356
## Init database

‎docs/transport/filesystem.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ $connectionFactory = new FsConnectionFactory([
4747
]);
4848

4949
$psrContext = $connectionFactory->createContext();
50+
51+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
52+
$psrContext = \Enqueue\dsn_to_context('file:');
5053
```
5154

5255
## Send message to topic

‎docs/transport/gearman.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ $factory = new GearmanConnectionFactory([
3636
'host' => 'example',
3737
'port' => 5555
3838
]);
39+
40+
$psrContext = $factory->createContext();
41+
42+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
43+
$psrContext = \Enqueue\dsn_to_context('gearman:');
3944
```
4045

4146
## Send message to topic

‎docs/transport/gps.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ $connectionFactory = new GpsConnectionFactory();
3131
$connectionFactory = new GpsConnectionFactory('gps:');
3232

3333
$psrContext = $connectionFactory->createContext();
34+
35+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
36+
$psrContext = \Enqueue\dsn_to_context('gps:');
3437
```
3538

3639
## Send message to topic

‎docs/transport/kafka.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ $connectionFactory = new RdKafkaConnectionFactory([
4343
]);
4444

4545
$psrContext = $connectionFactory->createContext();
46+
47+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
48+
$psrContext = \Enqueue\dsn_to_context('kafka:');
4649
```
4750

4851
## Send message to topic

‎docs/transport/pheanstalk.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ $factory = new PheanstalkConnectionFactory([
3636
'host' => 'example',
3737
'port' => 5555
3838
]);
39+
40+
$psrContext = $factory->createContext();
41+
42+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
43+
$psrContext = \Enqueue\dsn_to_context('beanstalk:');
3944
```
4045

4146
## Send message to topic

‎docs/transport/redis.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ $factory = new RedisConnectionFactory([
5858
$factory = new RedisConnectionFactory('redis://example.com:1000?vendor=phpredis');
5959

6060
$psrContext = $factory->createContext();
61+
62+
// if you have enqueue/enqueue library installed you can use a function from there to create the context
63+
$psrContext = \Enqueue\dsn_to_context('redis:');
6164
```
6265

6366
* With predis library:

0 commit comments

Comments
 (0)