Skip to content

Commit 6eed583

Browse files
committed
Start preparing navigation structure
1 parent 5a0a399 commit 6eed583

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+664
-415
lines changed

docs/async_event_dispatcher/quick_tour.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
@@ -9,9 +13,9 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
913

1014
# Async event dispatcher (Symfony)
1115

12-
The doc shows how you can setup async event dispatching in plain PHP.
16+
The doc shows how you can setup async event dispatching in plain PHP.
1317
If you are looking for the ways to use it in Symfony application [read this post instead](../bundle/async_events.md)
14-
18+
1519
* [Installation](#installation)
1620
* [Configuration](#configuration)
1721
* [Dispatch event](#dispatch-event)
@@ -47,7 +51,7 @@ $context = (new FsConnectionFactory('file://'.__DIR__.'/queues'))->createContext
4751
$eventQueue = $context->createQueue('symfony_events');
4852

4953
$registry = new SimpleRegistry(
50-
['the_event' => 'default'],
54+
['the_event' => 'default'],
5155
['default' => new PhpSerializerEventTransformer($context)]
5256
);
5357

docs/bundle/async_commands.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
@@ -63,9 +67,9 @@ $promise = $producer->sendCommand(Commands::RUN_COMMAND, new RunCommand('debug:c
6367

6468
// do other stuff.
6569

66-
if ($replyMessage = $promise->receive(5000)) {
70+
if ($replyMessage = $promise->receive(5000)) {
6771
$result = CommandResult::jsonUnserialize($replyMessage->getBody());
68-
72+
6973
echo $result->getOutput();
7074
}
7175
```

docs/bundle/async_events.md

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
@@ -9,9 +13,9 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
913

1014
# Async events
1115

12-
The EnqueueBundle allows you to dispatch events asynchronously.
13-
Behind the scene it replaces your listener with one that sends a message to MQ.
14-
The message contains the event object.
16+
The EnqueueBundle allows you to dispatch events asynchronously.
17+
Behind the scene it replaces your listener with one that sends a message to MQ.
18+
The message contains the event object.
1519
The consumer, once it receives the message, restores the event and dispatches it to only async listeners.
1620

1721
Async listeners benefits:
@@ -57,14 +61,14 @@ or to `kernel.event_subscriber`:
5761
```yaml
5862
# app/config/config.yml
5963
60-
services:
64+
services:
6165
test_async_subscriber:
6266
class: 'AcmeBundle\Listener\TestAsyncSubscriber'
6367
tags:
6468
- { name: 'kernel.event_subscriber', async: true }
6569
```
6670

67-
That's basically it. The rest of the doc describes advanced features.
71+
That's basically it. The rest of the doc describes advanced features.
6872

6973
## Advanced Usage.
7074

@@ -87,8 +91,8 @@ services:
8791

8892
The bundle uses [php serializer](https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/enqueue-bundle/Events/PhpSerializerEventTransformer.php) transformer by default to pass events through MQ.
8993
You can write a transformer for each event type by implementing the `Enqueue\AsyncEventDispatcher\EventTransformer` interface.
90-
Consider the next example. It shows how to send an event that contains Doctrine entity as a subject
91-
94+
Consider the next example. It shows how to send an event that contains Doctrine entity as a subject
95+
9296
```php
9397
<?php
9498
namespace AcmeBundle\Listener;
@@ -116,22 +120,22 @@ class FooEventTransformer implements EventTransformer
116120
117121
/**
118122
* {@inheritdoc}
119-
*
123+
*
120124
* @param GenericEvent $event
121125
*/
122126
public function toMessage($eventName, Event $event = null)
123127
{
124128
$entity = $event->getSubject();
125129
$entityClass = get_class($entity);
126-
130+
127131
$manager = $this->doctrine->getManagerForClass($entityClass);
128132
$meta = $manager->getClassMetadata($entityClass);
129133
130134
$id = $meta->getIdentifierValues($entity);
131-
135+
132136
$message = new Message();
133137
$message->setBody([
134-
'entityClass' => $entityClass,
138+
'entityClass' => $entityClass,
135139
'entityId' => $id,
136140
'arguments' => $event->getArguments()
137141
]);
@@ -145,14 +149,14 @@ class FooEventTransformer implements EventTransformer
145149
public function toEvent($eventName, QueueMessage $message)
146150
{
147151
$data = JSON::decode($message->getBody());
148-
152+
149153
$entityClass = $data['entityClass'];
150-
154+
151155
$manager = $this->doctrine->getManagerForClass($entityClass);
152156
if (false == $entity = $manager->find($entityClass, $data['entityId'])) {
153157
return Result::reject('The entity could not be found.');
154158
}
155-
159+
156160
return new GenericEvent($entity, $data['arguments']);
157161
}
158162
}
@@ -171,7 +175,7 @@ services:
171175
- {name: 'enqueue.event_transformer', eventName: 'foo' }
172176
```
173177

174-
The `eventName` attribute accepts a regexp. You can do next `eventName: '/foo\..*?/'`.
178+
The `eventName` attribute accepts a regexp. You can do next `eventName: '/foo\..*?/'`.
175179
It uses this transformer for all event with the name beginning with `foo.`
176180

177181
[back to index](../index.md)

docs/bundle/cli_commands.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
@@ -9,7 +13,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
913

1014
# Cli commands
1115

12-
The EnqueueBundle provides several commands.
16+
The EnqueueBundle provides several commands.
1317
The most useful one `enqueue:consume` connects to the broker and process the messages.
1418
Other commands could be useful during debugging (like `enqueue:topics`) or deployment (like `enqueue:setup-broker`).
1519

@@ -134,7 +138,7 @@ Help:
134138
```
135139

136140
## enqueue:transport:consume
137-
141+
138142
```
139143
./bin/console enqueue:transport:consume --help
140144
Usage:

docs/bundle/config_reference.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:

docs/bundle/consumption_extension.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
@@ -23,7 +27,7 @@ use Enqueue\Consumption\Context\PostMessageReceived;
2327
class CountProcessedMessagesExtension implements PostMessageReceivedExtensionInterface
2428
{
2529
private $processedMessages = 0;
26-
30+
2731
public function onPostMessageReceived(PostMessageReceived $context): void
2832
{
2933
$this->processedMessages += 1;

docs/bundle/debugging.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
@@ -11,7 +15,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
1115

1216
## Profiler
1317

14-
It may be useful to see what messages were sent during a http request.
18+
It may be useful to see what messages were sent during a http request.
1519
The bundle provides a collector for Symfony [profiler](http://symfony.com/doc/current/profiler.html).
1620
The extension collects all sent messages
1721

@@ -36,17 +40,17 @@ use Symfony\Component\HttpFoundation\Request;
3640
use Enqueue\Client\Message;
3741
use Enqueue\Client\ProducerInterface;
3842

39-
class DefaultController extends Controller
43+
class DefaultController extends Controller
4044
/**
4145
* @Route("/", name="homepage")
4246
*/
4347
public function indexAction(Request $request)
4448
{
4549
/** @var ProducerInterface $producer */
46-
$producer = $this->get('enqueue.producer');
47-
50+
$producer = $this->get('enqueue.producer');
51+
4852
$producer->sendEvent('foo_topic', 'Hello world');
49-
53+
5054
$producer->sendEvent('bar_topic', ['bar' => 'val']);
5155

5256
$message = new Message();
@@ -59,10 +63,10 @@ class DefaultController extends Controller
5963
```
6064

6165
For this action you may see something like this in the profiler:
62-
66+
6367
![Symfony profiler](../images/symfony_profiler.png)
64-
65-
## Queues and topics available
68+
69+
## Queues and topics available
6670

6771
There are two console commands `./bin/console enqueue:queues` and `./bin/console enqueue:topics`.
6872
They are here to help you to learn more about existing topics and queues.
@@ -71,11 +75,11 @@ Here's the result:
7175

7276
![Cli debug commands](../images/cli_debug_commands.png)
7377

74-
## Consume command verbosity
78+
## Consume command verbosity
7579

76-
By default the commands `enqueue:consume` or `enqueue:transport:consume` does not output anything.
80+
By default the commands `enqueue:consume` or `enqueue:transport:consume` does not output anything.
7781
You can add `-vvv` to see more information.
78-
82+
7983
![Consume command verbosity](../images/consume_command_verbosity.png)
8084

8185
[back to index](../index.md)

docs/bundle/functional_testing.md

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
layout: default
3+
nav_exclude: true
4+
---
15
<h2 align="center">Supporting Enqueue</h2>
26

37
Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
@@ -10,17 +14,17 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
1014
# Functional testing
1115

1216
In this chapter we give some advices on how to test message queue related logic.
13-
17+
1418
* [NULL transport](#null-transport)
1519
* [Traceable message producer](#traceable-message-producer)
1620

1721
## NULL transport
1822

19-
While testing the application you don't usually need to send real message to real broker.
20-
Or even have a dependency on a MQ broker.
21-
Here's the purpose of the NULL transport.
22-
It simple do nothing when you ask it to send a message.
23-
Pretty useful in tests.
23+
While testing the application you don't usually need to send real message to real broker.
24+
Or even have a dependency on a MQ broker.
25+
Here's the purpose of the NULL transport.
26+
It simple do nothing when you ask it to send a message.
27+
Pretty useful in tests.
2428
Here's how you can configure it.
2529

2630
```yaml
@@ -35,7 +39,7 @@ enqueue:
3539
## Traceable message producer
3640
3741
Imagine you have a service `my_service` with a method `someMethod()` that internally sends a message and you have to find out was the message sent or not.
38-
There is a solution for that. You have to enable traceable message producer in test environment.
42+
There is a solution for that. You have to enable traceable message producer in test environment.
3943

4044
```yaml
4145
# app/config/config_test.yml
@@ -57,28 +61,28 @@ class FooTest extends WebTestCase
5761
{
5862
/** @var \Symfony\Bundle\FrameworkBundle\Client */
5963
private $client;
60-
64+
6165
public function setUp()
6266
{
63-
$this->client = static::createClient();
67+
$this->client = static::createClient();
6468
}
65-
69+
6670
public function testMessageSentToFooTopic()
6771
{
6872
// Use your own business logic here:
6973
$service = $this->client->getContainer()->get('my_service');
70-
74+
7175
// someMethod() is part of your business logic and is calling somewhere $producer->send('fooTopic', 'messageBody');
7276
$service->someMethod();
73-
77+
7478
$traces = $this->getProducer()->getTopicTraces('fooTopic');
75-
79+
7680
$this->assertCount(1, $traces);
7781
$this->assertEquals('messageBody', $traces[0]['message']);
7882
}
79-
83+
8084
/**
81-
* @return TraceableProducer
85+
* @return TraceableProducer
8286
*/
8387
private function getProducer()
8488
{

0 commit comments

Comments
 (0)