Results 1 to 8 of 8

Thread: auto acknowledge while using message driven channel adapter and service activator

  1. #1
    Join Date
    Aug 2009
    Location
    Santa Clara, CA
    Posts
    4

    Default 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. #2
    Join Date
    Nov 2008
    Location
    Swansea, Wales
    Posts
    202

    Default

    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?

  3. #3
    Join Date
    Aug 2009
    Location
    Santa Clara, CA
    Posts
    4

    Default

    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?

  4. #4
    Join Date
    Nov 2008
    Location
    Swansea, Wales
    Posts
    202

    Default

    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?

  5. #5
    Join Date
    Aug 2009
    Location
    Santa Clara, CA
    Posts
    4

    Default

    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.

  6. #6
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,840

    Default

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

  7. #7
    Join Date
    Aug 2009
    Location
    Santa Clara, CA
    Posts
    4

    Default

    Thanks Mark. I will try that out.

  8. #8
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    Quote 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •