Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When adding @Incoming and @Outgoing to the same method. It will not be registered in the SubscriberDecorator. #2912

Open
NicklasHNissen opened this issue Feb 3, 2025 · 1 comment

Comments

@NicklasHNissen
Copy link

NicklasHNissen commented Feb 3, 2025

In my project I have a setup that requires reading one message and then sending to another. If it fails I need to put the message on a DLQ or backout queue. But for some reason in the decorator that implements SubscriberDecorator the channel doesn't show up.

Take a look at the following.

    @Incoming(REQUEST_INCOMING_CHANNEL)
    @Outgoing(RESPONSE_OUTGOING_CHANNEL)
    public void handleSomeData(double price) {
        // process your price.
    }
@ApplicationScoped
public class ConsumedMessageDecorator implements PublisherDecorator {

    private final Map<String, AtomicLong> counters = new HashMap<>();

    @Override
    public Multi<? extends Message<?>> decorate(Multi<? extends Message<?>> publisher, String channelName,
            boolean isConnector) {
        if (channelName.contains(REQUEST_INCOMING_CHANNEL)) {
            //some code
        } else {
            return publisher;
        }
    }

    @Override
    public int getPriority() {
        return 10;
    }

    public long getMessageCount(String channel) {
        return counters.get(channel).get();
    }
}

If I have both @incoming and @Outgoing on the handleSomeData method. The channelName.contains will never be true.
But if I only have @incoming it does appear in the channelName.

This has to be a bug, but I haven't been able to figure out why.
I have currently done a workaround by using the MutinyEmitter and just sending the message directly to the Reponse queue in the handleSomeData method.

@ozangunalp
Copy link
Collaborator

Would you have a reproducer? Maybe a test you can write on your fork of this repo?
I don't see why you have this and I cannot reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants