You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the configuration above works for SNS and EventBridge, it is unfortunately not as simple for SQS. The SQS client is created inside a Symfony Messenger class (`AmazonSqsTransportFactory`) in a non-extensible way. To work around that, you can create a custom transport factory that overrides the native one from Symfony Messenger and make it use the `TracedAsyncAwsHttpClient` from Bref. Here is an example of class you can create in your Symfony application:
162
+
163
+
```php
164
+
<?php declare(strict_types=1);
165
+
166
+
namespace App;
167
+
168
+
use Bref\Apm\XRay\AsyncAws\TracedAsyncAwsHttpClient;
169
+
use Psr\Log\LoggerInterface;
170
+
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransport;
171
+
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\Connection;
172
+
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
173
+
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
174
+
use Symfony\Component\Messenger\Transport\TransportInterface;
175
+
176
+
class AmazonSqsTransportFactory implements TransportFactoryInterface
177
+
{
178
+
public function __construct(
179
+
private ?LoggerInterface $logger = null,
180
+
) {
181
+
}
182
+
183
+
public function createTransport(#[\SensitiveParameter] string $dsn, array $options, SerializerInterface $serializer): TransportInterface
184
+
{
185
+
unset($options['transport_name']);
186
+
187
+
return new AmazonSqsTransport(Connection::fromDsn($dsn, $options, new TracedAsyncAwsHttpClient, $this->logger), $serializer);
188
+
}
189
+
190
+
public function supports(#[\SensitiveParameter] string $dsn, array $options): bool
0 commit comments