Open melloware opened 1 year ago
The problem with the reactive part is that the AntivirusEngine
signature is not ready to implement the feature.
There is not an easy way to implement it without a breaking change.
Reactive signature example with Mutiny:
package io.quarkiverse.antivirus.runtime;
import java.io.InputStream;
import io.smallrye.mutiny.Uni;
/**
* Service provider interface for virus scanning that might be used in file upload component for example when dealing with
* untrusted files.
*/
public interface AntivirusEngine {
/**
* Indicate whether this {@link AntivirusEngineReactive} is enabled or not.
*
* @return <code>true</code> if enabled, <code>false</code> otherwise
*/
boolean isEnabled();
/**
* Perform virus scan and throw exception if a virus has been detected.
*
* @param filename the name of the file to scan
* @param inputStream the inputStream containing the file contents
* @return the {@link AntivirusScanResult} containing the results
*/
Uni<AntivirusScanResult> scan(final String filename, final InputStream inputStream);
}
To implement a reactive engine, the easy way is maybe to use Vertx with Mutiny. But we can also use Vertx or native JAVA API with CompletionStage.
@ggrebert PR is welcome. This is still a BETA library only at 0.0.4 so I am not worried about breaking changes.
I am not as familiar with Reactive but an example in the docs and an Integration test would be great for someone to add as a good first issue.
https://quarkus.io/guides/resteasy-reactive#multipart