Skip to content

[Messenger] Kafka Transport Bridge #51070

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

Open
wants to merge 21 commits into
base: 7.4
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
Fixed psalm and integration tests
  • Loading branch information
andythorne committed Aug 14, 2023
commit db5023391bd60f8b29b7c9a417bc69ca86ed6553
11 changes: 11 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,21 @@ jobs:
env:
php-version: '8.1'
steps:
- name: Install system dependencies
run: |
echo "::group::apt-get update"
sudo apt-get update
echo "::endgroup::"

echo "::group::install tools & libraries"
sudo apt-get install librdkafka-dev
echo "::endgroup::"

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: "rdkafka"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

psalm has stubs for this extension, it should not be required to install it: https://github.com/vimeo/psalm/blob/6.x/stubs/extensions/rdkafka.phpstub

ini-values: "memory_limit=-1"
coverage: none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory;
use Symfony\Component\Messenger\Bridge\Beanstalkd\Transport\BeanstalkdTransportFactory;
use Symfony\Component\Messenger\Bridge\Kafka\Transport\KafkaFactory;
use Symfony\Component\Messenger\Bridge\Kafka\Transport\KafkaTransportFactory;
use Symfony\Component\Messenger\Bridge\Redis\Transport\RedisTransportFactory;
use Symfony\Component\Messenger\EventListener\AddErrorDetailsStampListener;
use Symfony\Component\Messenger\EventListener\DispatchPcntlSignalListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ private function __construct(
$this->kafkaFactory = $kafkaFactory ?? new KafkaFactory($logger);
}

/** @psalm-param array<string, bool|float|int|string|array<string>> $options */
public static function fromDsn(string $dsn, array $options, LoggerInterface $logger, KafkaFactory $kafkaFactory): self
{
$options = self::setupOptions($dsn, $options);
Expand Down Expand Up @@ -109,7 +108,6 @@ private static function setupOptions(string $dsn, array $options): array
];
}

/** @psalm-param array<string, bool|float|int|string|array<string>> $options */
private static function setupConsumerOptions(string $brokerList, array $configOptions): array
{
if (0 === \count($configOptions)) {
Expand Down Expand Up @@ -152,7 +150,6 @@ private static function setupConsumerOptions(string $brokerList, array $configOp
return $options;
}

/** @psalm-param array<string, bool|float|int|string|array<string>> $options */
private static function setupProducerOptions(string $brokerList, array $configOptions): array
{
if (0 === \count($configOptions)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,11 @@ public function __construct(
}
}

/**
* @psalm-param array<string, bool|float|int|string|array<string>> $options
*/
public function createTransport(#[\SensitiveParameter] string $dsn, array $options, SerializerInterface $serializer): TransportInterface
{
return new KafkaTransport(Connection::fromDsn($dsn, $options, $this->logger, $this->kafkaFactory), $serializer);
}

/**
* @psalm-param array<string, bool|float|int|string|array<string>> $options
*/
public function supports(#[\SensitiveParameter] string $dsn, array $options): bool
{
return str_starts_with($dsn, 'kafka://');
Expand Down