Skip to content

[Messenger] Add AMQP exchange binding to another exchange #34737

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

Closed
Changes from 1 commit
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
Next Next commit
Add AMQP exchange binding to another exchange
  • Loading branch information
danielkorytek committed Dec 20, 2019
commit c49bfaf36689c040d1c2ef86ae1c132e755190e2
13 changes: 13 additions & 0 deletions src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public function __construct(array $connectionOptions, array $exchangeOptions, ar
* * type: Type of exchange (Default: fanout)
* * default_publish_routing_key: Routing key to use when publishing, if none is specified on the message
* * flags: Exchange flags (Default: AMQP_DURABLE)
* * bindings[name]: An array of exchanges to bind, keyed by the name
* * binding_keys: The binding keys (if any) to bind to this exchange
* * binding_arguments: Arguments to be used while binding the exchange
* * arguments: Extra arguments
* * delay:
* * queue_name_pattern: Pattern to use to create the queues (Default: "delay_%exchange_name%_%routing_key%_%delay%")
Expand Down Expand Up @@ -423,6 +426,16 @@ public function exchange(): \AMQPExchange
$this->amqpExchange->setType($this->exchangeOptions['type'] ?? AMQP_EX_TYPE_FANOUT);
$this->amqpExchange->setFlags($this->exchangeOptions['flags'] ?? AMQP_DURABLE);

foreach ($this->exchangeOptions['bindings'] ?? [null] as $bindingExchangeName => $bindingExchangeOption) {
$this->amqpExchange->declareExchange();

$bindingArguments = $bindingExchangeOption['binding_arguments'] ?? [];

foreach ($bindingExchangeOption['binding_keys'] ?? [''] as $bindingKey) {
$this->amqpExchange->bind($bindingExchangeName, $bindingKey, $bindingArguments);
}
}

if (isset($this->exchangeOptions['arguments'])) {
$this->amqpExchange->setArguments($this->exchangeOptions['arguments']);
}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy