Skip to content

feat: Make serializer configurable via YAML configuration #1390

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 2 commits into
base: master
Choose a base branch
from

Conversation

lenchester
Copy link

@lenchester lenchester commented May 20, 2025

This change enables users to specify custom serializers with configuration
options in their Enqueue bundle YAML configuration, improving flexibility
when working with different message formats.

  • Add support for configuring serializers through YAML in RdKafkaContext
  • Allow serializer specification as a class name, array with options, or instance

- Add support for configuring serializers through YAML in RdKafkaContext
- Allow serializer specification as a class name, array with options, or instance
- Ensures robustness by providing a default serializer
- Refactoring
@lenchester lenchester requested a review from Steveb-p May 26, 2025 08:19
Comment on lines +182 to +185
/**
* @return void
* JsonSerializer should be the default fallback if no serializer is specified
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to re-specify the return type, since it's already present in the PHP declaration.

As for the description, I'm not sure it's worthwile - but nothing against it either.

Suggested change
/**
* @return void
* JsonSerializer should be the default fallback if no serializer is specified
*/
/**
* JsonSerializer is the default fallback, if no serializer is specified.
*/

@@ -36,6 +36,34 @@ public function testShouldSetJsonSerializerInConstructor()
$this->assertInstanceOf(JsonSerializer::class, $context->getSerializer());
}

public function testShouldUseStringSerializerClassFromConfig()
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding unit test that checks assertSame instance when serializer object is passed. If you are able you might want to check constructor options with method call assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants