Vert.x EventBus duplicates messages if consumer package is called "processors"
See original GitHub issueDescribe the bug I’m getting an extrange behaviour while i was renaming my app packages. When I changed the name of my Vert.x consumer class package, every time it receives a message, is received twice.
The original name was “com.traderquark.reactive.processor”, with everything working fine, and when i changed it to “com.traderquark.reactive.processors” the consumer receives 2 times the same message. If I rename it again to the original name, it receives again one message as expected.
Finally I don’t know if matters, but my consumer class has two @ConsumeEvent methods with different values on their channels and message classes; and this behaviours occur on both consumers.
Expected behavior The expected behaviour is to receive one message for each sending in the consumer independently of the name of the packages.
Actual behavior I receive 2 repeated messages in the consumer for each sending when my consumer package is called “com.traderquark.reactive.processors”.
To Reproduce My consumer class:
package com.traderquark.reactive.processor;
import com.traderquark.configuration.MarketTransactionConfig;
import com.traderquark.constants.Constants;
import com.traderquark.dto.reactive.MarketIndicatorTick;
import com.traderquark.dto.reactive.SMAInfoValue;
import com.traderquark.dto.reactive.StartResult;
import com.traderquark.dto.responses.GetChartLastRequestResponse;
import com.traderquark.dto.streamresponses.TickPricesResponse;
import com.traderquark.enums.MarketIndicators;
import io.quarkus.vertx.ConsumeEvent;
import io.vertx.core.eventbus.EventBus;
import org.jboss.logging.Logger;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.LinkedList;
import java.util.List;
@ApplicationScoped
public class MobileMediaProcessor {
private static final Logger LOGGER = Logger.getLogger(MobileMediaProcessor.class);
@Inject
EventBus bus;
@Inject
MarketTransactionConfig marketTransactionConfig;
private long currentMinute = 1L;
private final List<SMAInfoValue> closePrices = new LinkedList<>();
private SMAInfoValue currentPrice;
@ConsumeEvent(value = Constants.TICK_PRICE_EVENT_BUS_CHANNEL)
void consumeTickPrice(TickPricesResponse tickPricesResponse) {
LOGGER.debugf("Received tickPrice timestamp [%d] current minute [%d] received minute [%d]",
(long) tickPricesResponse.getData().getTimestamp(), currentMinute,
tickPricesResponse.getData().getTimestamp() / Constants.MILLISECONDS_IN_MINUTE);
//Some silly maths...
}
@ConsumeEvent(value = Constants.CHART_REQUEST_EVENT_BUS_CHANNEL)
void consumeChartRequest(GetChartLastRequestResponse chartRequest) {
LOGGER.infof("Calculating initial SMA with [%d] sessions", chartRequest.getReturnData().getRateInfos().size());
//Some other silly maths...
}
}
The constants:
public static final String TICK_PRICE_EVENT_BUS_CHANNEL = "tickPrice";
public static final String CHART_REQUEST_EVENT_BUS_CHANNEL = "chartRequest";
If my package is “com.traderquark.reactive.processor”
I receive only one message and I see only one log trace from my class “MobileMediaProcessor”:
And only changing it to “com.traderquark.reactive.processors”
I receive duplicated messages and we can see two log traces from my class “MobileMediaProcessor”:
And after that, everything is duplicated.
Configuration Nothing applicable here.
Environment (please complete the following information):
- Output of
uname -a
orver
:Linux localhost.localdomain 5.6.13-100.fc30.x86_64 #1 SMP Fri May 15 00:36:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Output of
java -version
:openjdk version "11.0.9" 2020-10-20 OpenJDK Runtime Environment GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06) OpenJDK 64-Bit Server VM GraalVM CE 20.3.0 (build 11.0.9+10-jvmci-20.3-b06, mixed mode, sharing)
- GraalVM version (if different from Java): Same.
- Quarkus version or git rev:
1.10.5.Final
- Build tool (ie. output of
mvnw --version
orgradlew --version
):Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /home/osboxes/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3 Java version: 11.0.9, vendor: GraalVM Community, runtime: /sde/graalvm/graalvm-ce-java11-20.3.0 Default locale: es_ES, platform encoding: UTF-8 OS name: "linux", version: "5.6.13-100.fc30.x86_64", arch: "amd64", family: "unix"
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
@gsmet @cescoffier You both are right. I have spent some time trying to force the failure but after erasing yesterday the content of the target folder I’m not able to make it fail again. Neither in the main project or in a small new for testing it, in dev mode and native.
Making searches with grep I only find the classes in the files “/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst” and “./target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst” but both of them are updated fine.
So as you said looks to be something that was stuck in my local that was fixed forcing the regeneration of the target folder.
Thank you all for your time and your help and sorry for the inconvenience, specially to @mkouba that had to test it.
You close the issue or I have to close it?
@mkouba ok, this afternoon i will make a small project to test it and see what’s happening.