-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(doc): Transform Processor CDI Decorator into manual decorators
We noticed flackiness with QuarkusTest and usage of `Processor` decorators. It is generating randomly ClassNotFoundException. It is happening only with Quarkus 3.8 LTS, recent versions like 3.15 or older like 3.2 do not present the issue. The solution found is a fallback of sorts, by removing the usage of @decorator in the processor decorators. Instead they are transformed in old-school, composition-design-pattern-inspired beans with a lombok delegate. The generic type signature is removed so they can be transformed in Dependent beans. Why's that? 1. A class with generics cannot be a bean, according to compilation errors, and 2. processors returned by the supplier need to be new instances everytime. Priorities are kept, and used to resolve in order the beans, for a manual encapsulation achieved with a for loop on the list of beans. And with that, the flackiness is gone. Of course, those changes will not be propagated to main and the future 3.15 branch, where this flackiness is not an issue, AND the usage of CDI's Decorator can be kept. The documentation is updated accordingly. Fixes #117
- Loading branch information
1 parent
50cb5f9
commit 70f11a9
Showing
30 changed files
with
968 additions
and
181 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...quarkiverse/kafkastreamsprocessor/api/decorator/processor/AbstractProcessorDecorator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/*- | ||
* #%L | ||
* Quarkus Kafka Streams Processor | ||
* %% | ||
* Copyright (C) 2024 Amadeus s.a.s. | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
package io.quarkiverse.kafkastreamsprocessor.api.decorator.processor; | ||
|
||
import org.apache.kafka.streams.processor.api.Processor; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.experimental.Delegate; | ||
|
||
/** | ||
* Base class for all processor decorators. | ||
* <p> | ||
* If a decorator does not implement this abstract class, it will not be found by the | ||
* <code>KafkaClientSuppliedDecorator</code> for composition. | ||
* </p> | ||
* <p> | ||
* We remove the generic declaration from {@link Processor} because ArC complains about generics on class declaration of | ||
* a bean. | ||
* </p> | ||
* <p> | ||
* Class introduced in 2.0, for compatibility with Quarkus 3.8 random failure to start when using custom processor | ||
* decorators. | ||
* </p> | ||
* | ||
* @deprecated It will be removed in 3.0, with the integration of Quarkus 3.15 where we will be able to go back to pure | ||
* CDI decorators. | ||
*/ | ||
@Deprecated(forRemoval = true, since = "2.0") | ||
public abstract class AbstractProcessorDecorator implements Processor { | ||
/** | ||
* The decorated processor, holding either the next decorator layer or the final processor. | ||
*/ | ||
@Delegate | ||
@Getter | ||
@Setter | ||
private Processor delegate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.