-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
18 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
horreum-backend/src/main/java/io/hyperfoil/tools/horreum/converter/JsonToEventConverter.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,23 @@ | ||
package io.hyperfoil.tools.horreum.converter; | ||
|
||
import io.smallrye.reactive.messaging.MessageConverter; | ||
import io.smallrye.reactive.messaging.amqp.IncomingAmqpMetadata; | ||
import io.vertx.core.json.JsonObject; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.eclipse.microprofile.reactive.messaging.Message; | ||
|
||
import java.lang.reflect.Type; | ||
@ApplicationScoped | ||
public class JsonToEventConverter implements MessageConverter { | ||
@Override | ||
public boolean canConvert(Message<?> in, Type target) { | ||
return in.getMetadata(IncomingAmqpMetadata.class) | ||
.map(meta -> meta.getContentType().equals("application/json") && target instanceof Class) | ||
.orElse(false); | ||
} | ||
|
||
@Override | ||
public Message<?> convert(Message<?> in, Type target) { | ||
return in.withPayload(((JsonObject) in.getPayload()).mapTo((Class<?>) target)); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/HorreumThreadProvider.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,28 @@ | ||
package io.hyperfoil.tools.horreum.svc; | ||
|
||
import io.quarkus.runtime.Startup; | ||
import jakarta.inject.Named; | ||
import jakarta.inject.Singleton; | ||
import jakarta.ws.rs.Produces; | ||
import org.eclipse.microprofile.context.ManagedExecutor; | ||
|
||
@Singleton | ||
@Startup | ||
public class HorreumThreadProvider { | ||
//should make these configurable | ||
private final static int POOL_SIZE = 10; | ||
private final static int POOL_QUEUE_SIZE = 100; | ||
|
||
@Startup | ||
@Singleton | ||
@Produces | ||
@Named("datasetServiceExecutor") | ||
ManagedExecutor managedCustomExecutor() { | ||
System.out.println("HorreumServiceExecutor created (should only happen once)!."); | ||
|
||
return ManagedExecutor.builder() | ||
.maxAsync(POOL_SIZE) | ||
.maxQueued(POOL_QUEUE_SIZE) | ||
.build(); | ||
} | ||
} |
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