ErrorDestination and Messages Redelivery - Weblogic

This is a discussion on ErrorDestination and Messages Redelivery - Weblogic ; WLS version is : WebLogic Server 8.1 SP1 I am having some trouble with the ErrorDestination setup and Redelivery of messages. My Qs were setup like this DestinationKeys="" ErrorDestination="failedCEjobsQueue" ExpirationPolicy="Redirect" JNDIName="queue/classification/CEJOBSQ" MessagesMaximum="-1" Name="ceJobsQueue" RedeliveryDelayOverride="1" RedeliveryLimit="1" Template=""/> JNDIName="queue/classification/FAILEDCEJOBSQ" Name="failedCEjobsQueue"/> And I ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: ErrorDestination and Messages Redelivery

  1. ErrorDestination and Messages Redelivery


    WLS version is : WebLogic Server 8.1 SP1

    I am having some trouble with the ErrorDestination setup and Redelivery of messages.

    My Qs were setup like this

    DestinationKeys="" ErrorDestination="failedCEjobsQueue"
    ExpirationPolicy="Redirect"
    JNDIName="queue/classification/CEJOBSQ" MessagesMaximum="-1"
    Name="ceJobsQueue" RedeliveryDelayOverride="1"
    RedeliveryLimit="1" Template=""/>

    JNDIName="queue/classification/FAILEDCEJOBSQ"
    Name="failedCEjobsQueue"/>


    And I have a async listener on ceJobsQueue and a MDB on failedCEjobsQueue.

    asnc listener was created as connection.createQueuesession(false, AUTO_ACK). Based
    on some condition I throw a RuntimeException in my onMessage. I was expecting
    that message will finally move to failedCEjobsQueue. Messages were never moved.

    But if the session is created as connection.createQueuesession(false, AUTO_ACK)
    the messages move to failedCEjobsQueue when I do session.rollback(). But after
    I rollback my async listener does not get any further messages. But If I restart
    the async listsner it gets the other messages.

    Is there anything wrong with my setup/logic? OR is there any way I can do this.







  2. Re: ErrorDestination and Messages Redelivery

    Hi,

    Throwing a runtime-exception from within an MDB has
    well-defined behavior. This forces the MDB
    to call recover/rollback, which in turn lets the
    JMS server know it must redeliver the message.

    The same is not true for throwing a runtime within the
    onMessage of a regular JMS client, as you assumed.
    The JMS specification is not strictly defined here, and so
    behavior between vendors may differ. WL's behavior is something
    like this:
    Retry the onMessage() once without recovering the message, then
    ignore the message if a runtime is thrown again, and instead
    call onMessage() with the next available message.
    I'm not sure if I have it exactly right, but I'm fairly
    sure I'm close.

    So, the solution is not to throw a Runtime exception to
    force a recover()! Instead, call session.recover()
    from within your onMessage().

    Tom

    P.S. As a best practice,
    I recommend wrapping all code in an onMessage() with
    a try/catch(RuntimeE). Something like:

    try { ... } catch (RuntimeException re) {
    logFailure(re);
    forceRecover();
    }


    circuit wrote:

    > WLS version is : WebLogic Server 8.1 SP1
    >
    > I am having some trouble with the ErrorDestination setup and Redelivery of messages.
    >
    > My Qs were setup like this
    >
    > > DestinationKeys="" ErrorDestination="failedCEjobsQueue"
    > ExpirationPolicy="Redirect"
    > JNDIName="queue/classification/CEJOBSQ" MessagesMaximum="-1"
    > Name="ceJobsQueue" RedeliveryDelayOverride="1"
    > RedeliveryLimit="1" Template=""/>
    >
    > > JNDIName="queue/classification/FAILEDCEJOBSQ"
    > Name="failedCEjobsQueue"/>
    >
    >
    > And I have a async listener on ceJobsQueue and a MDB on failedCEjobsQueue.
    >
    > asnc listener was created as connection.createQueuesession(false, AUTO_ACK). Based
    > on some condition I throw a RuntimeException in my onMessage. I was expecting
    > that message will finally move to failedCEjobsQueue. Messages were never moved.
    >
    > But if the session is created as connection.createQueuesession(false, AUTO_ACK)
    > the messages move to failedCEjobsQueue when I do session.rollback(). But after
    > I rollback my async listener does not get any further messages. But If I restart
    > the async listsner it gets the other messages.
    >
    > Is there anything wrong with my setup/logic? OR is there any way I can do this.
    >
    >
    >
    >
    >
    >



  3. Re: ErrorDestination and Messages Redelivery



    circuit wrote:

    > But if the session is created as connection.createQueuesession(false, AUTO_ACK)
    > the messages move to failedCEjobsQueue when I do session.rollback(). But after
    > I rollback my async listener does not get any further messages. But If I restart
    > the async listsner it gets the other messages.


    This may be a known bug - contact customer support. The async
    consumer rollback
    succeeds, but the JMS server fails to push more messages. But I think
    the bug requires several rollbacks to activate, and may require
    that they occur one directly after the other.


  4. Re: ErrorDestination and Messages Redelivery

    And I assume you meant:
    connection.createQueueSession(true, ...)

    Tom Barnes wrote:

    >
    >
    > circuit wrote:
    >
    >> But if the session is created as connection.createQueuesession(false,
    >> AUTO_ACK)
    >> the messages move to failedCEjobsQueue when I do session.rollback().
    >> But after
    >> I rollback my async listener does not get any further messages. But If
    >> I restart
    >> the async listsner it gets the other messages.

    >
    >
    > This may be a known bug - contact customer support. The async
    > consumer rollback
    > succeeds, but the JMS server fails to push more messages. But I think
    > the bug requires several rollbacks to activate, and may require
    > that they occur one directly after the other.
    >



  5. Re: ErrorDestination and Messages Redelivery


    I have mistyped in my original message. It was connection.createQueueSession(true,
    ...)
    otherwise I would not be able to rollback/commit.

    I will try the recover() and post the results.

    Tom Barnes wrote:
    >And I assume you meant:
    > connection.createQueueSession(true, ...)
    >
    >Tom Barnes wrote:
    >
    >>
    >>
    >> circuit wrote:
    >>
    >>> But if the session is created as connection.createQueuesession(false,

    >
    >>> AUTO_ACK)
    >>> the messages move to failedCEjobsQueue when I do session.rollback().

    >
    >>> But after
    >>> I rollback my async listener does not get any further messages. But

    >If
    >>> I restart
    >>> the async listsner it gets the other messages.

    >>
    >>
    >> This may be a known bug - contact customer support. The async
    >> consumer rollback
    >> succeeds, but the JMS server fails to push more messages. But I think
    >> the bug requires several rollbacks to activate, and may require
    >> that they occur one directly after the other.
    >>

    >



  6. Re: ErrorDestination and Messages Redelivery


    I have my onMessage method as suggested lik

    public void onMessage() {
    try {
    } catch (Throwable t) {
    session_.recover();
    }

    My queue has m1,m2,m3,m4,m5,m6 messages. Based on some condition I am throwing
    a exception for message m3, and it is caught and the session.recover() is called.
    And when m3 is redelivered the same exception happens and session.recover() is
    called again and after this no messages are delivered.

    This is the sequence of messages
    m1,m2,m3(Exception is raised), m4, m3(Exception is raised) and m4,m5 and m6 messages
    are not delivered. If I restart mmy Async Listener m4,m5 and m6 messages are delivered.

    I have tried the queue sessions with AUTO_ACK and CLIENT_ACK modes.

    Any ideas??






  7. Re: ErrorDestination and Messages Redelivery

    I'm surprised that this isn't working, and only
    have random ideas left: Register a connection
    exception listener, as well as a session exception listener,
    and see if JMS is pushing any exceptions at the
    app. Make sure session_.recover() itself is not
    itself throwing a runtime exception. Make sure
    that the app is not somehow multi-threading
    the session. Try 8.1SP2. Contact customer support.

    circuit wrote:

    > I have my onMessage method as suggested lik
    >
    > public void onMessage() {
    > try {
    > } catch (Throwable t) {
    > session_.recover();
    > }
    >
    > My queue has m1,m2,m3,m4,m5,m6 messages. Based on some condition I am throwing
    > a exception for message m3, and it is caught and the session.recover() is called.
    > And when m3 is redelivered the same exception happens and session.recover() is
    > called again and after this no messages are delivered.
    >
    > This is the sequence of messages
    > m1,m2,m3(Exception is raised), m4, m3(Exception is raised) and m4,m5 and m6 messages
    > are not delivered. If I restart mmy Async Listener m4,m5 and m6 messages are delivered.
    >
    > I have tried the queue sessions with AUTO_ACK and CLIENT_ACK modes.
    >
    > Any ideas??
    >
    >
    >
    >
    >



+ Reply to Thread