Announcement Announcement Module
No announcement yet.
Compute the value for jms:outbound-gateway receive-timeout during runtime Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compute the value for jms:outbound-gateway receive-timeout during runtime

    Hi everyone,

    is there any way to compute the receive-timeout during runtime on each call of sendAndReceive (e.g. through getting the value from some other bean's property each time)?

    As far as I see in org.springframework.integration.jms.JmsOutboundGat eway there is no such way but I can imagine that I am not the only one with the requirement to make timeouts configurable (and in such a way that they can be changed without restart/reloading the spring context). If you are not planning such an extension, it would be nice if you could define a getter for the property and use the getter in the sendAndReceive method so that one could easily subclass the JmsOutboundGateway and override the getter.


  • #2
    This is an interesting idea. One problem is that we are planning to move the sendAndReceive functionality down into the core framework's JmsTemplate (see: The JmsTemplate has a single 'receiveTimeout' property, and it would be a mess to add a timeout parameter to each and every send/receive method on JmsTemplate (there are a lot). So, the only way I could imagine solving this issue at that level is with a TimeoutStrategy of some sort, but that also may be overkill.

    Can you briefly explain the factors involved in determining the timeout value at runtime for your particular use-case?



    • #3
      Hi Mark,

      fortunately, the timeouts in my case are not in any way dependent on the messages. I rather have a singleton in my spring context which holds the configuration and which can be updated by the user via JMX. What I have been doing in other cases (where I set the timeout programatically) is to inject this configuration singleton into the respective service and get the timeout value (or any other configuration property for that matter) from it each time I need the value - something like this:

      private MyComponentConfiguration configuration;
      messageChannelTemplate.setReceiveTimeout(configura tion.getSomeConfiruableTimeout());

      I suppose a strategy would be the most flexible way (even more if it gets access to the message itself) that would also solve my issues.

      Best regards,


      • #4
        If the JmsOutboundGateway is refactored to delegate to a JmsTemplate (assuming that happens after the aformentioned Spring core issue is resolved), then could you just expose the template itself to JMX? Then, you could set the receiveTimeout on that directly.