question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vert.x EventBus duplicates messages if consumer package is called "processors"

See original GitHub issue

Describe 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” imagen

I receive only one message and I see only one log trace from my class “MobileMediaProcessor”: imagen

And only changing it to “com.traderquark.reactive.processors” imagen

I receive duplicated messages and we can see two log traces from my class “MobileMediaProcessor”: imagen

And after that, everything is duplicated.

Configuration Nothing applicable here.

Environment (please complete the following information):

  • Output of uname -a or ver: 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 or gradlew --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:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AngelPerzcommented, Jan 18, 2021

@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?

1reaction
AngelPerzcommented, Jan 18, 2021

@mkouba ok, this afternoon i will make a small project to test it and see what’s happening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you handle duplicate events using the eventbus ...
x's eventbus we will need to handle duplications as vert.x eventbus publish command (in contrast to kafka) wont be able to configure consumer-groups....
Read more >
How to test async vertx eventbus handlers without sending reply
I have two microservices written with java vertx. They communicate via eventbus. First one sends a message and second receives the message.
Read more >
MessageConsumer (Vert.x Stack - Docs 4.3.5 API)
An event bus consumer object representing a stream of message to an EventBus address that can be read from. The EventBus.consumer(String) or EventBus....
Read more >
Eclipse Vert.x 4.1 Migration Guide - Red Hat Customer Portal
This guide describes the updates in Eclipse Vert.x 4 release. Use the information to upgrade your Eclipse Vert.x 3.x applications to Eclipse Vert.x...
Read more >
Idempotent Consumer - Apache Camel
The Idempotent Consumer essentially acts like a Message Filter to filter out duplicates. Camel will add the message id eagerly to the repository...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found