Skip to content
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

[KOGITO-5094] Allowing byte[] as serializer/deserializer for Quarkus #1823

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

fjtirado
Copy link
Contributor

@fjtirado fjtirado commented Dec 27, 2021

This JIRA is a first step to achieve integration with Apache Avro.
I have created two follow up JIRAS: one to replace DataEvent by CloudEvent https://issues.redhat.com/browse/KOGITO-6476 and another one to provide an example of overriding default marshaller to interact with Avro https://issues.redhat.com/browse/KOGITO-6521
The overall idea in this one is to infer the right marshaller from the channel property.
If StringSerializer or ByteSeralizer we use a default marshaller that converts the Json to byte[]/string (this keeps backward compatibility)
If different serializer we assume the serializer deals properly with the event object and we use a marshaller that keep the object intact
In addition to that, this PR fixes following issues:

  • A missing managed dependency for testing
  • EventConverterProducer and EventMarshallerProducer are not longer generated (and are now declared as DefaultBeans). This will allow users to extend them and also to "specialize" them, providing their own marshallers/unmarshallers for custom data types
  • A problem with future version of Quarkus. We are not longing mengling with Smallrye internals, but treating default channels as regular channels:
    • MediatorConfig and ChannelRegistar are not longer used to provide a default emitter. Now all meaningful emitters are generated from configuration. For covering such cases where an Emitter and Receiver is being inject into a class but no configuration is provided to create the proper channel (for example in QuarkusEventDrivenDecission and knative example), a default dummy bean is produced.
    • Before these changes, emitter/receiver for quarkus were generated as part of processes codegen, now they are generated by the addon processor. This requires changes in the existing main buildsteps in order to allow an addon to modify a generated class. The main buildstep in KogitoAssetProcessor was split in two, one that generates the sources and another that generate the classes

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

Can one of the admins verify this patch?

3 similar comments
@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

Can one of the admins verify this patch?

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

Can one of the admins verify this patch?

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

Can one of the admins verify this patch?

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaplanner-quickstarts check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) kogito-runtimes check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) kogito-apps check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaweb-employee-rostering check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaweb-vehicle-routing check has failed. Please check the logs.

@fjtirado fjtirado changed the title [KOGITO-5094] Allowing byte[] deserializer [KOGITO-5094] Allowing byte[] as serializer/deserializer for Quarkus Dec 27, 2021
@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaplanner-quickstarts check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) kogito-apps check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaweb-employee-rostering check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaplanner check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaweb-vehicle-routing check has failed. Please check the logs.

@fjtirado fjtirado marked this pull request as ready for review December 27, 2021 17:00
@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) kogito-runtimes check has failed. Please check the logs.

@@ -31,7 +35,7 @@
ObjectMapper mapper;

@Bean
public EventMarshaller eventMarshaller(){
return new DefaultEventMarshaller(mapper);
public EventMarshaller<String> stringEventMarshaller(){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For Spring, we keep just string event marshaller at the moment

@@ -32,7 +34,17 @@
ObjectMapper mapper;

@Produces
public EventMarshaller eventMarshaller(){
return new DefaultEventMarshaller(mapper);
public EventMarshaller<String> stringEventMarshaller(){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quarkus will inject the proper marshaller depending on the generated emitter type

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaweb-vehicle-routing check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaplanner-quickstarts check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Dec 27, 2021

The (build) optaplanner check has failed. Please check the logs.

@fjtirado fjtirado requested a review from tkobayas January 10, 2022 11:47
@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-runtimes check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-runtimes check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-runtimes check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-apps check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-runtimes check has failed. Please check the logs.

@fjtirado fjtirado force-pushed the KOGITO-5094 branch 2 times, most recently from 4b437e8 to 18e1cc7 Compare January 10, 2022 18:21
@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-apps check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 10, 2022

The (build) kogito-examples check has failed. Please check the logs.

@danielezonca
Copy link
Contributor

@fjtirado
I see you are still pushing new code chances to the PR, is it ready for review or still WIP?
Build is green so if you are fixing some issue I would suggest to also add some additional test to prevent regression in the future

@fjtirado
Copy link
Contributor Author

ild is green so if you are fixing some issue I would suggest to also add some additional test to prevent regression in the future

Build is green now, after my lastest change, merging.

@fjtirado fjtirado merged commit 3864d34 into apache:main Jan 11, 2022
@kie-ci
Copy link
Contributor

kie-ci commented Jan 11, 2022

The (build) optaweb-vehicle-routing check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 11, 2022

The (build) optaweb-employee-rostering check has failed. Please check the logs.

@sonarcloud
Copy link

sonarcloud bot commented Jan 11, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@kie-ci
Copy link
Contributor

kie-ci commented Jan 11, 2022

The (build) kogito-examples check has failed. Please check the logs.

@kie-ci
Copy link
Contributor

kie-ci commented Jan 11, 2022

The (build) kogito-apps check has failed. Please check the logs.

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.

7 participants