0

Getting produced no reply for request Message from element "int:delayer" implemented inside chain ("int:chain").

Inside delayer expression and default-delay evaluated successfully after that getting below error due to which retry is not working in case of any failure.

from source: ''int:delayer' with id='delayRetry''' produced no reply for request Message

Tried setting value for requires-reply='false' for the calling parent component. but still getting same issue

Code Snippet:

<int:header-enricher>
    <int:header name="delay" expression="headers.containsKey('SomeVariable')?0:(headers['adviceDelay']?:1000)*1.2"
        type="java.lang.Integer" overwrite="true" />
</int:header-enricher>
<int:delayer id=delayRetry " expression="headers['delay']" default-delay="100" ignore-expression-failures="false"
    message-store="adviceRetryMessageStore" scheduler="delayerTaskScheduler">
    <int:transactionaltransaction-manager = jdbcTransactionManager " />
</int:delayer>
<int:routerexpression = "headers.someChannel" />

Here we are setting delay value based on condition defined in expression headers.containsKey('SomeVariable')

  • If this condition satisfies then, adding 0 delay in retry. In this case retry is working fine and flow routed back to headers.someChannel for retry.
  • But in another scenario when header not contains SomeVariable, so setting delay of 1200. In this case code enters in error flow and retry is not working.
Yogi
  • 11
  • 2

1 Answers1

0

Hm. That is correct. The delayer logic is like this:

protected Object handleRequestMessage(Message<?> requestMessage) {
    boolean delayed = requestMessage.getPayload() instanceof DelayedMessageWrapper;

    if (!delayed) {
        long delay = determineDelayForMessage(requestMessage);
        if (delay > 0) {
            releaseMessageAfterDelay(requestMessage, delay);
            return null;
        }
    }

    // no delay
    return delayed
            ? ((DelayedMessageWrapper) requestMessage.getPayload()).getOriginal()
            : requestMessage;
}

So, if we delay message, we return null. The super class AbstractReplyProducingMessageHandler has this logic:

protected final void handleMessageInternal(Message<?> message) {
    Object result;
    if (this.advisedRequestHandler == null) {
        result = handleRequestMessage(message);
    }
    else {
        result = doInvokeAdvisedRequestHandler(message);
    }
    if (result != null) {
        sendOutputs(result, message);
    }
    else if (this.requiresReply && !isAsync()) {
        throw new ReplyRequiredException(message, "No reply produced by handler '" +
                getComponentName() + "', and its 'requiresReply' property is set to true.");
    }
    else if (!isAsync()) {
        logger.debug(LogMessage.format("handler '%s' produced no reply for request Message: %s", this, message));
    }
}

so, it does emit that debug message when we no reply to produce. Well, it is there somewhere after delay.

I think it will be safe to mark a DelayHandler as an async component to avoid that debug message. Please, raise a GH issue and we will see what we can do to fix such a confusion. Meanwhile you can just don't use a DEBUG login level for framework categories.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • Thanks @Artem Bilan for your respone. So in my case issue is not only debug statement but retry is not happening after failure. I observed that if we have a delay of 0 then retry working fine but if we apply any delay in that case retry doesn't happen. – Yogi Jan 17 '23 at 11:42
  • That's correct. Because retry is wrapping the current `try..catch`, but with delay we place a message into a queue for processing on fully other thread. See `` to apply a retry advice on a `DelayHandler.ReleaseMessageHandler` - the point where a message is processed after delay. – Artem Bilan Jan 17 '23 at 13:56
  • Thanks Artem Bilan, Same works with lower version of spring integration but not with the version we upgraded to(5.2.3.RELEASE). We started getting this issue after upgrade.----------- ---------------We have upgraded to 5.2.20.RELEASE and 5.2.3.RELEASE – Yogi Jan 18 '23 at 05:31
  • 5.2.x is AOL: https://spring.io/projects/spring-integration#support. What issue do you have anyway? – Artem Bilan Jan 18 '23 at 14:35
  • Thanks @ArtemBilan Below is the code snippet for my use case: ` ` – Yogi Jan 19 '23 at 09:48
  • This is the XML snippet that we are using. Here we are setting delay value based on condition defined in expression `headers.containsKey('SomeVariable')` * If this condition satisfies then not adding delay in retry. In this case retry is wroking fine and flow routed to `headers.someChannel`. * But in another secnario when header not contains SomeVariable setting, so setting delay of 1200. In this case code enters in error flow and retry is not working. The above flow enclosed in `` – Yogi Jan 19 '23 at 09:53
  • Consider to edit your question with properly formatted code snippets: it is fully unreadable in comments. More over this sounds like a new SO thread: not related to the original `no reply for request Message` concern. – Artem Bilan Jan 19 '23 at 15:38
  • I have updated the formatted code snippet in question section. Actually the code is terminating with `no reply for request Message` (in case we have delay in retry), So we are analysing where exactly our flow looking for reply message. And as mentioned we started getting this after spring-integration upgrade, prior to that retry is working fine with delay. – Yogi Jan 19 '23 at 17:42
  • One more time `no reply for request Message` is just a debug logging. Can we ignore it for now? And we indeed have no reply on a producing thread because we are delaying message in an async manner. What is that error flow in your case? How is it related to this debug message which we have already agree that it is not causing any problems since we just don't have a sync reply in case we delay. – Artem Bilan Jan 19 '23 at 18:09