Skip to content

Commit

Permalink
Vert.x: use method invokers for event bus consumers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicek committed Jun 6, 2024
1 parent 2c246a9 commit 0a65c8f
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 311 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,33 +1,76 @@
package io.quarkus.vertx.deployment;

import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.MethodInfo;

import io.quarkus.arc.processor.BeanInfo;
import io.quarkus.arc.processor.InvokerInfo;
import io.quarkus.builder.item.MultiBuildItem;

public final class EventConsumerBusinessMethodItem extends MultiBuildItem {

private final BeanInfo bean;
private final AnnotationInstance consumeEvent;
private final MethodInfo method;
private final boolean blockingAnnotation;
private final boolean runOnVirtualThreadAnnotation;
private final boolean splitHeadersBodyParams;
private final InvokerInfo invoker;

public EventConsumerBusinessMethodItem(BeanInfo bean, MethodInfo method, AnnotationInstance consumeEvent) {
public EventConsumerBusinessMethodItem(BeanInfo bean, AnnotationInstance consumeEvent, boolean blockingAnnotation,
boolean runOnVirtualThreadAnnotation, boolean splitHeadersBodyParams, InvokerInfo invoker) {
this.bean = bean;
this.method = method;
this.consumeEvent = consumeEvent;
this.blockingAnnotation = blockingAnnotation;
this.runOnVirtualThreadAnnotation = runOnVirtualThreadAnnotation;
this.splitHeadersBodyParams = splitHeadersBodyParams;
this.invoker = invoker;
}

/**
* Returns the bean that declares this event consumer method.
*/
public BeanInfo getBean() {
return bean;
}

public MethodInfo getMethod() {
return method;
}

/**
* Returns the {@link io.quarkus.vertx.ConsumeEvent} annotation declared
* on this event consumer method.
*/
public AnnotationInstance getConsumeEvent() {
return consumeEvent;
}

/**
* Returns whether this event consumer method declares
* the {@link io.smallrye.common.annotation.Blocking} annotation.
*/
public boolean isBlockingAnnotation() {
return blockingAnnotation;
}

/**
* Returns whether this event consumer method declares
* the {@link io.smallrye.common.annotation.RunOnVirtualThread} annotation.
*/
public boolean isRunOnVirtualThreadAnnotation() {
return runOnVirtualThreadAnnotation;
}

/**
* Returns whether this event consumer method declares 2 parameters,
* where the first is the event headers and the second is the event body.
* In this case, the {@link io.quarkus.vertx.runtime.EventConsumerInvoker}
* has to split the headers and body parameters explicitly.
*/
public boolean isSplitHeadersBodyParams() {
return splitHeadersBodyParams;
}

/**
* Returns the {@linkplain InvokerInfo invoker} for this event consumer method.
*/
public InvokerInfo getInvoker() {
return invoker;
}

}
Loading

0 comments on commit 0a65c8f

Please sign in to comment.