Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the service id for Transport #868

Merged
merged 1 commit into from
May 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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