Skip to content

Commit ac70565

Browse files
authored
Merge pull request #869 from Steveb-p/gh-pages-nav
Github pages navigation structure
2 parents 88f9ed9 + ace203c commit ac70565

Some content is hidden

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

56 files changed

+708
-405
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

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
parent: "Symfony bundle"
4+
title: Async commands
5+
---
16
<h2 align="center">Supporting Enqueue</h2>
27

38
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 +68,9 @@ $promise = $producer->sendCommand(Commands::RUN_COMMAND, new RunCommand('debug:c
6368

6469
// do other stuff.
6570

66-
if ($replyMessage = $promise->receive(5000)) {
71+
if ($replyMessage = $promise->receive(5000)) {
6772
$result = CommandResult::jsonUnserialize($replyMessage->getBody());
68-
73+
6974
echo $result->getOutput();
7075
}
7176
```

docs/bundle/async_events.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
parent: "Symfony bundle"
4+
title: Async events
5+
---
16
<h2 align="center">Supporting Enqueue</h2>
27

38
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 +14,9 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
914

1015
# Async events
1116

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.
17+
The EnqueueBundle allows you to dispatch events asynchronously.
18+
Behind the scene it replaces your listener with one that sends a message to MQ.
19+
The message contains the event object.
1520
The consumer, once it receives the message, restores the event and dispatches it to only async listeners.
1621

1722
Async listeners benefits:
@@ -57,14 +62,14 @@ or to `kernel.event_subscriber`:
5762
```yaml
5863
# app/config/config.yml
5964
60-
services:
65+
services:
6166
test_async_subscriber:
6267
class: 'AcmeBundle\Listener\TestAsyncSubscriber'
6368
tags:
6469
- { name: 'kernel.event_subscriber', async: true }
6570
```
6671

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

6974
## Advanced Usage.
7075

@@ -87,8 +92,8 @@ services:
8792

8893
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.
8994
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-
95+
Consider the next example. It shows how to send an event that contains Doctrine entity as a subject
96+
9297
```php
9398
<?php
9499
namespace AcmeBundle\Listener;
@@ -116,22 +121,22 @@ class FooEventTransformer implements EventTransformer
116121
117122
/**
118123
* {@inheritdoc}
119-
*
124+
*
120125
* @param GenericEvent $event
121126
*/
122127
public function toMessage($eventName, Event $event = null)
123128
{
124129
$entity = $event->getSubject();
125130
$entityClass = get_class($entity);
126-
131+
127132
$manager = $this->doctrine->getManagerForClass($entityClass);
128133
$meta = $manager->getClassMetadata($entityClass);
129134
130135
$id = $meta->getIdentifierValues($entity);
131-
136+
132137
$message = new Message();
133138
$message->setBody([
134-
'entityClass' => $entityClass,
139+
'entityClass' => $entityClass,
135140
'entityId' => $id,
136141
'arguments' => $event->getArguments()
137142
]);
@@ -145,14 +150,14 @@ class FooEventTransformer implements EventTransformer
145150
public function toEvent($eventName, QueueMessage $message)
146151
{
147152
$data = JSON::decode($message->getBody());
148-
153+
149154
$entityClass = $data['entityClass'];
150-
155+
151156
$manager = $this->doctrine->getManagerForClass($entityClass);
152157
if (false == $entity = $manager->find($entityClass, $data['entityId'])) {
153158
return Result::reject('The entity could not be found.');
154159
}
155-
160+
156161
return new GenericEvent($entity, $data['arguments']);
157162
}
158163
}
@@ -171,7 +176,7 @@ services:
171176
- {name: 'enqueue.event_transformer', eventName: 'foo' }
172177
```
173178

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

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

docs/bundle/cli_commands.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
parent: "Symfony bundle"
4+
title: CLI commands
5+
---
16
<h2 align="center">Supporting Enqueue</h2>
27

38
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 +14,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
914

1015
# Cli commands
1116

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

@@ -134,7 +139,7 @@ Help:
134139
```
135140

136141
## enqueue:transport:consume
137-
142+
138143
```
139144
./bin/console enqueue:transport:consume --help
140145
Usage:

docs/bundle/config_reference.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
parent: "Symfony bundle"
4+
title: Config reference
5+
---
16
<h2 align="center">Supporting Enqueue</h2>
27

38
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

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
parent: "Symfony bundle"
4+
title: Consumption extension
5+
---
16
<h2 align="center">Supporting Enqueue</h2>
27

38
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 +28,7 @@ use Enqueue\Consumption\Context\PostMessageReceived;
2328
class CountProcessedMessagesExtension implements PostMessageReceivedExtensionInterface
2429
{
2530
private $processedMessages = 0;
26-
31+
2732
public function onPostMessageReceived(PostMessageReceived $context): void
2833
{
2934
$this->processedMessages += 1;

docs/bundle/debugging.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
parent: "Symfony bundle"
4+
title: Debugging
5+
---
16
<h2 align="center">Supporting Enqueue</h2>
27

38
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 +16,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
1116

1217
## Profiler
1318

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

@@ -36,17 +41,17 @@ use Symfony\Component\HttpFoundation\Request;
3641
use Enqueue\Client\Message;
3742
use Enqueue\Client\ProducerInterface;
3843

39-
class DefaultController extends Controller
44+
class DefaultController extends Controller
4045
/**
4146
* @Route("/", name="homepage")
4247
*/
4348
public function indexAction(Request $request)
4449
{
4550
/** @var ProducerInterface $producer */
46-
$producer = $this->get('enqueue.producer');
47-
51+
$producer = $this->get('enqueue.producer');
52+
4853
$producer->sendEvent('foo_topic', 'Hello world');
49-
54+
5055
$producer->sendEvent('bar_topic', ['bar' => 'val']);
5156

5257
$message = new Message();
@@ -59,10 +64,10 @@ class DefaultController extends Controller
5964
```
6065

6166
For this action you may see something like this in the profiler:
62-
67+
6368
![Symfony profiler](../images/symfony_profiler.png)
64-
65-
## Queues and topics available
69+
70+
## Queues and topics available
6671

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

7277
![Cli debug commands](../images/cli_debug_commands.png)
7378

74-
## Consume command verbosity
79+
## Consume command verbosity
7580

76-
By default the commands `enqueue:consume` or `enqueue:transport:consume` does not output anything.
81+
By default the commands `enqueue:consume` or `enqueue:transport:consume` does not output anything.
7782
You can add `-vvv` to see more information.
78-
83+
7984
![Consume command verbosity](../images/consume_command_verbosity.png)
8085

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

docs/bundle/functional_testing.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
layout: default
3+
parent: "Symfony bundle"
4+
title: Functional testing
5+
---
16
<h2 align="center">Supporting Enqueue</h2>
27

38
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 +15,17 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
1015
# Functional testing
1116

1217
In this chapter we give some advices on how to test message queue related logic.
13-
18+
1419
* [NULL transport](#null-transport)
1520
* [Traceable message producer](#traceable-message-producer)
1621

1722
## NULL transport
1823

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.
24+
While testing the application you don't usually need to send real message to real broker.
25+
Or even have a dependency on a MQ broker.
26+
Here's the purpose of the NULL transport.
27+
It simple do nothing when you ask it to send a message.
28+
Pretty useful in tests.
2429
Here's how you can configure it.
2530

2631
```yaml
@@ -35,7 +40,7 @@ enqueue:
3540
## Traceable message producer
3641
3742
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.
43+
There is a solution for that. You have to enable traceable message producer in test environment.
3944

4045
```yaml
4146
# app/config/config_test.yml
@@ -57,28 +62,28 @@ class FooTest extends WebTestCase
5762
{
5863
/** @var \Symfony\Bundle\FrameworkBundle\Client */
5964
private $client;
60-
65+
6166
public function setUp()
6267
{
63-
$this->client = static::createClient();
68+
$this->client = static::createClient();
6469
}
65-
70+
6671
public function testMessageSentToFooTopic()
6772
{
6873
// Use your own business logic here:
6974
$service = $this->client->getContainer()->get('my_service');
70-
75+
7176
// someMethod() is part of your business logic and is calling somewhere $producer->send('fooTopic', 'messageBody');
7277
$service->someMethod();
73-
78+
7479
$traces = $this->getProducer()->getTopicTraces('fooTopic');
75-
80+
7681
$this->assertCount(1, $traces);
7782
$this->assertEquals('messageBody', $traces[0]['message']);
7883
}
79-
84+
8085
/**
81-
* @return TraceableProducer
86+
* @return TraceableProducer
8287
*/
8388
private function getProducer()
8489
{

docs/bundle/index.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
layout: default
3+
title: "Symfony bundle"
4+
nav_order: 8
5+
has_children: true
6+
permalink: /symfony
7+
---
8+
9+
{:toc}

0 commit comments

Comments
 (0)