Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb31661

Browse files
committed
Build the receiver and sender within the factory
1 parent 8a8c32a commit bb31661

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@
373373
<xsd:sequence>
374374
<xsd:element name="option" type="messenger_adapter_option" minOccurs="0" maxOccurs="unbounded" />
375375
</xsd:sequence>
376-
377376
<xsd:attribute name="name" type="xsd:string" />
378377
<xsd:attribute name="dsn" type="xsd:string" />
379378
</xsd:complexType>

src/Symfony/Component/Messenger/Adapter/PhpAmqp/AmqpAdapter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@
2222
*/
2323
class AmqpAdapter implements AdapterInterface
2424
{
25-
private $encoder;
26-
private $decoder;
25+
private $receiver;
26+
private $sender;
2727
private $connection;
2828

29-
public function __construct(EncoderInterface $encoder, DecoderInterface $decoder, Connection $connection)
29+
public function __construct(ReceiverInterface $receiver, SenderInterface $sender, Connection $connection)
3030
{
31-
$this->encoder = $encoder;
32-
$this->decoder = $decoder;
31+
$this->receiver = $receiver;
32+
$this->sender = $sender;
3333
$this->connection = $connection;
3434
}
3535

3636
public function receiver(): ReceiverInterface
3737
{
38-
return new AmqpReceiver($this->decoder, $this->connection);
38+
return $this->receiver;
3939
}
4040

4141
public function sender(): SenderInterface
4242
{
43-
return new AmqpSender($this->encoder, $this->connection);
43+
return $this->sender;
4444
}
4545

4646
public function connection(): Connection

src/Symfony/Component/Messenger/Adapter/PhpAmqp/AmqpAdapterFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ public function __construct(EncoderInterface $encoder, DecoderInterface $decoder
3434

3535
public function create(string $dsn, array $options): AdapterInterface
3636
{
37-
return new AmqpAdapter($this->encoder, $this->decoder, Connection::fromDsn($dsn, $options, $this->debug));
37+
return new AmqpAdapter(
38+
new AmqpReceiver($this->decoder, $this->connection),
39+
new AmqpSender($this->encoder, $this->connection),
40+
Connection::fromDsn($dsn, $options, $this->debug)
41+
);
3842
}
3943

4044
public function supports(string $dsn, array $options): bool

0 commit comments

Comments
 (0)