Skip to content

Commit 8faf6a1

Browse files
author
Maksym Kotliar
committed
[docs] Add docs about the bundle's profiler
1 parent 390b3e2 commit 8faf6a1

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs/bundle/debuging.md

+50
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
11
# Debugging
22

3+
## Profiler
4+
5+
It may be useful to see what messages were sent during a http request.
6+
The bundle provides a collector for Symfony [profiler](http://symfony.com/doc/current/profiler.html).
7+
The extension collects all sent messages
8+
9+
To enable profiler
10+
11+
```yaml
12+
# app/config/config_dev.yml
13+
14+
enqueue:
15+
client:
16+
traceable_producer: true
17+
```
18+
19+
Now suppose you have this code in an action:
20+
21+
```php
22+
<?php
23+
24+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
25+
use Symfony\Component\HttpFoundation\Request;
26+
use Enqueue\Client\Message;
27+
use Enqueue\Client\MessageProducerInterface;
28+
29+
class DefaultController extends Controller
30+
/**
31+
* @Route("/", name="homepage")
32+
*/
33+
public function indexAction(Request $request)
34+
{
35+
/** @var MessageProducerInterface $producer */
36+
$producer = $this->get('enqueue.message_producer');
37+
38+
$producer->send('foo_topic', 'Hello world');
39+
40+
$producer->send('bar_topic', ['bar' => 'val']);
41+
42+
$message = new Message();
43+
$message->setBody('baz');
44+
$producer->send('baz_topic', $message);
45+
46+
// ...
47+
}
48+
49+
```
50+
51+
For this action you may see something like this in the profiler:
52+
353
[back to index](../index.md)

0 commit comments

Comments
 (0)