Announcement Announcement Module
Collapse
No announcement yet.
auto acknowledge while using message driven channel adapter and service activator Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • auto acknowledge while using message driven channel adapter and service activator

    I am playing around with spring integration to see if this can be used in one of our projects.

    My requirement is simple.
    1) My application sends a message to an activeMQ on an event in the application.
    2) There is a message driven channel adapter that listens for messages on this queue and calls a method in the service activator.
    3) The service activator makes a web service API call to an outbound system.

    There might be a situation when the external outbound system may be down and we would like to return the message to the queue so that it can be re-tried later.

    I see that the message driven channel adapter automatically acknowledges the message.
    Is there a way to handle my use case?

  • #2
    You don't need a service activator to call the web service, you can use ws:outbound-gateway.

    In your use case if you set a transaction manager on the message driven channel adapter's container and all the steps happen within the same transaction then on failure to make the web service call the transaction will be rolled back and the message put back on the queue. Provided you're using JmsTransactionManager transaction manager that is.

    Using the event driven approach though the message will be retried immediately. Is that what you want to happen?

    Comment


    • #3
      Thanks.

      I would not like the call to be tried immediately.

      Currently we are using an internal implementation that has some rules built in for retries. Do we have something that can be re-used here?

      I have also read through the reference guide but there are not much low level details. Is the reference guide the only document that is available as of now?

      Comment


      • #4
        The JavaDoc can be pretty useful and Mark and Iwein are really helpful.

        I think the problem with these retry strategies is that they ususally depend on the use case. Am I right in thinking that with yours, if the website is down you want to block the whole queue for a period of time before retrying?

        Comment


        • #5
          That is right. I would like to block the whole queue for a certain amount of time.

          I tried putting up the JmsTransactionManager in my channel adapter and I found that the default configuration tries sending the message 6 times before giving up and marking the message as received.

          One brute force mechanism may be not to configure any concurrency on the channel adapter and make the serviceActivator (currently I am using a serviceActivator to do the processing which I plan to change later on as suggested by using the ws-outbound-gateway) sleep for a predefined amount of time.

          This way my application will not pick any new messages for "x" amount of time.
          It would be great if I could be able to declare such policies in the configuration.

          Comment


          • #6
            You might be able to use the new (in 1.0.3) delayer component:
            http://static.springsource.org/sprin...e.html#delayer

            Comment


            • #7
              Thanks Mark. I will try that out.

              Comment


              • #8
                Originally posted by rranjan View Post
                I have also read through the reference guide but there are not much low level details. Is the reference guide the only document that is available as of now?
                JIRA issues with questions that are not answered in the documentation are really helpful. We've got a Documentation component in JIRA where you can log these issues against.

                Comment

                Working...
                X