Skip to content

Extending tracing scope for @RabbitListener #1287

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor

private final Object lifecycleMonitor = new Object();

private final ContainerDelegate delegate = this::actualInvokeListener;
private final ContainerDelegate delegate = this::actualExecuteListener;

protected final Object consumersMonitor = new Object(); //NOSONAR

Expand Down Expand Up @@ -1457,8 +1457,12 @@ protected void invokeErrorHandler(Throwable ex) {
* @see #invokeListener
* @see #handleListenerException
*/
@SuppressWarnings(UNCHECKED)
protected void executeListener(Channel channel, Object data) {
this.proxy.executeListener(channel, data);
}

@SuppressWarnings(UNCHECKED)
private void actualExecuteListener(Channel channel, Object data) {
if (!isRunning()) {
if (logger.isWarnEnabled()) {
logger.warn(
Expand Down Expand Up @@ -1535,17 +1539,13 @@ private void doExecuteListener(Channel channel, Object data) {
}
}

protected void invokeListener(Channel channel, Object data) {
this.proxy.invokeListener(channel, data);
}

/**
* Invoke the specified listener: either as standard MessageListener or (preferably) as SessionAwareMessageListener.
* @param channel the Rabbit Channel to operate on
* @param data the received Rabbit Message or List of Message.
* @see #setMessageListener(MessageListener)
*/
protected void actualInvokeListener(Channel channel, Object data) {
protected void invokeListener(Channel channel, Object data) {
Object listener = getMessageListener();
if (listener instanceof ChannelAwareMessageListener) {
doInvokeListener((ChannelAwareMessageListener) listener, channel, data);
Expand Down Expand Up @@ -1986,9 +1986,7 @@ && getBatchingStrategy().canDebatch(message.getMessageProperties())) {

@FunctionalInterface
private interface ContainerDelegate {

void invokeListener(Channel channel, Object data);

void executeListener(Channel channel, Object data);
}

/**
Expand Down