Re-update to 3.30.5
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 8m10s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 8m10s
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package fr.titionfire.ffsaf.domain.service;
|
||||
|
||||
import io.quarkiverse.antivirus.runtime.Antivirus;
|
||||
import io.quarkiverse.antivirus.runtime.AntivirusScanResult;
|
||||
import io.smallrye.mutiny.Uni;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
@ApplicationScoped
|
||||
public class VirusScannerService {
|
||||
|
||||
@Inject
|
||||
Antivirus antivirus;
|
||||
|
||||
public Uni<List<AntivirusScanResult>> scanFileReactive(String fileName, InputStream inputStream) {
|
||||
System.out.println("Starting reactive virus scan for file: " + fileName);
|
||||
|
||||
// Wrap the blocking antivirus scan in a reactive context
|
||||
// This moves the blocking operation to a worker thread
|
||||
return Uni.createFrom().item(() -> {
|
||||
System.out.println("Scanning file on worker thread: " + fileName);
|
||||
return antivirus.scan(fileName, inputStream);
|
||||
}).runSubscriptionOn(io.smallrye.mutiny.infrastructure.Infrastructure.getDefaultWorkerPool());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user