{"record":{"id":"77e1d0d03c652320","repo":"quarkusio/quarkus","slug":"an-event-consumer-business-method-must-accept-exac","errorCode":null,"errorMessage":"An event consumer business method must accept exactly one parameter: %s [method: %s, bean:%s]","messagePattern":"An event consumer business method must accept exactly one parameter: (.+?) \\[method: (.+?), bean:(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java","lineNumber":184,"sourceCode":"                    int parametersCount = method.parametersCount();\n                    if (KotlinUtils.isKotlinSuspendMethod(method)) {\n                        parametersCount--;\n                    }\n\n                    List<Type> params = method.parameterTypes();\n                    if (parametersCount == 2) {\n                        if (!isMessageHeaders(params.get(0).name())) {\n                            // If there are two parameters, the first must be message headers.\n                            throw new IllegalStateException(String.format(\n                                    \"An event consumer business method with two parameters must have MultiMap as the first parameter: %s [method: %s, bean:%s]\",\n                                    params, method, bean));\n                        } else if (isMessage(params.get(1).name())) {\n                            throw new IllegalStateException(String.format(\n                                    \"An event consumer business method with two parameters must not accept io.vertx.core.eventbus.Message or io.vertx.mutiny.core.eventbus.Message: %s [method: %s, bean:%s]\",\n                                    params, method, bean));\n                        }\n                    } else if (parametersCount != 1) {\n                        throw new IllegalStateException(String.format(\n                                \"An event consumer business method must accept exactly one parameter: %s [method: %s, bean:%s]\",\n                                params, method, bean));\n                    }\n                    if (method.returnType().kind() != Kind.VOID && VertxConstants.isMessage(params.get(0).name())\n                            && !KotlinUtils.isKotlinSuspendMethod(method)) {\n                        throw new IllegalStateException(String.format(\n                                \"An event consumer business method that accepts io.vertx.core.eventbus.Message or io.vertx.mutiny.core.eventbus.Message must return void [method: %s, bean:%s]\",\n                                method, bean));\n                    }\n                    if (method.hasAnnotation(RunOnVirtualThread.class) && consumeEvent.value(\"ordered\") != null\n                            && consumeEvent.value(\"ordered\").asBoolean()) {\n                        throw new IllegalStateException(String.format(\n                                \"An event consumer business method that cannot use @RunOnVirtualThread and set the ordered attribute to true [method: %s, bean:%s]\",\n                                method, bean));\n                    }\n\n                    InvokerBuilder builder = invokerFactory.createInvoker(bean, method)\n                            .withInstanceLookup();","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java#L166-L202","documentation":"During Quarkus deployment, the Vert.x extension validates every @ConsumeEvent business method on CDI beans. A consumer method must take exactly one parameter (payload, Message, or Message+MultiMap headers as a special two-parameter case); anything else is rejected at build time so the failure surfaces before the application runs.","triggerScenarios":"Declaring a method annotated @ConsumeEvent with zero parameters, three or more parameters, or two parameters whose first is not MultiMap (the two-parameter check throws a sibling error, and 0/3+ params hit this one after parametersCount adjustments for Kotlin suspend methods).","commonSituations":"Refactoring a consumer signature and forgetting the event payload; copying a Spring @EventListener-style method into Quarkus; adding a second helper parameter like a principal or injected config; Kotlin suspend fun miscount because the continuation is subtracted.","solutions":["Change the method to accept exactly one parameter (the event payload, or io.vertx.core.eventbus.Message / io.vertx.mutiny.core.eventbus.Message)","If you need delivery headers, use exactly two parameters with io.vertx.core.MultiMap as the first and the payload as the second","Remove stray parameters; inject other dependencies via fields/constructor instead of method parameters","If the payload type is wrong, declare the expected payload type and Quarkus decodes the message body for you"],"exampleFix":"// before\n@ConsumeEvent(\"greeting\")\nvoid consume(String payload, String locale) { ... }\n\n// after\n@ConsumeEvent(\"greeting\")\nvoid consume(Greeting greeting) { ... } // or two params: (MultiMap headers, String payload)","handlingStrategy":"validation","validationCode":"int count = method.getParameterCount();\nboolean suspend = isKotlinSuspend(method);\nif (suspend) count--;\nif (!(count == 1 || (count == 2 && method.getParameterTypes()[0] == MultiMap.class))) {\n    throw new IllegalStateException(\"@ConsumeEvent method must take 1 param (or 2 with MultiMap headers first): \" + method);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always give @ConsumeEvent methods exactly one payload parameter","Use (MultiMap headers, T payload) when you need headers — exactly two params","Inject collaborators via fields/constructor, not consumer method parameters","Rebuild early: the error is a build-time failure, so any compile+build cycle catches it"],"tags":["quarkus","vertx","eventbus","build-time-validation","cdi"],"backgroundTag":"invalid-event-consumer-signature","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}