Skip to content

Commit

Permalink
Fixed the service id for Transport
Browse files Browse the repository at this point in the history
  • Loading branch information
samnela committed May 26, 2019
1 parent 5a0a399 commit baf3135
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/bundle/message_producer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ Enqueue is an MIT-licensed open source project with its ongoing development made

# Message producer

You can choose how to send messages either using a transport directly or with the client.
You can choose how to send messages either using a transport directly or with the client.
Transport gives you the access to all transport specific features so you can tune things where the client provides you with easy to use abstraction.

## Transport

```php
<?php

/** @var Symfony\Component\DependencyInjection\ContainerInterface $container */

/** @var Interop\Queue\Context $context */
$context = $container->get('enqueue.transport.context');
$context = $container->get('enqueue.transport.[transport_name].context');

$context->createProducer()->send(
$context->createQueue('a_queue'),
Expand All @@ -30,15 +30,15 @@ $context->createProducer()->send(

## Client

The client is shipped with two types of producers. The first one sends messages immediately
The client is shipped with two types of producers. The first one sends messages immediately
where another one (it is called spool producer) collects them in memory and sends them `onTerminate` event (the response is already sent).

The producer has two types on send methods:
The producer has two types on send methods:

* `sendEvent` - Message is sent to topic and many consumers can subscribe to it. It is "fire and forget" strategy. The event could be sent to "message bus" to other applications.
* `sendCommand` - Message is to ONE exact consumer. It could be used as "fire and forget" or as RPC. The command message is always sent in scope of current application.
### Send event

### Send event

```php
<?php
Expand All @@ -61,11 +61,11 @@ $spoolProducer = $container->get(SpoolProducer::class);
// message is being sent on console.terminate or kernel.terminate event
$spoolProducer->sendEvent('a_topic', 'Hello there!');

// you could send queued messages manually by calling flush method
// you could send queued messages manually by calling flush method
$spoolProducer->flush();
```

### Send command
### Send command

```php
<?php
Expand All @@ -90,7 +90,7 @@ $spoolProducer = $container->get(SpoolProducer::class);
// message is being sent on console.terminate or kernel.terminate event
$spoolProducer->sendCommand('a_processor_name', 'Hello there!');

// you could send queued messages manually by calling flush method
// you could send queued messages manually by calling flush method
$spoolProducer->flush();
```

Expand Down

0 comments on commit baf3135

Please sign in to comment.