How to notify the exceptions in JMS sychronous request-response processing? - Weblogic

This is a discussion on How to notify the exceptions in JMS sychronous request-response processing? - Weblogic ; Hi All, Pl. help me with ur expertise in the foll. scenario we are facing. Scenario: I have a requirement where I need to notify the exceptions to my client while the client request's are processed asynchronously and my client ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: How to notify the exceptions in JMS sychronous request-response processing?

  1. How to notify the exceptions in JMS sychronous request-response processing?


    Hi All,

    Pl. help me with ur expertise in the foll. scenario we are facing.

    Scenario:
    I have a requirement where I need to notify the exceptions to my client while
    the client request's are processed asynchronously and my client is waiting in
    synchronous for the response.

    The client is sending a message to one queue (QueueA) and waiting for response
    in another queue (QueueB). The message from "QueueA" is picked up by a MDB listening
    to "QueueA" and it throws an exception while processing some "business logic".

    In this case how do I notify to my client who is waiting in another queue. i.e.
    "QueueB" that there is an exception occurred while processing the business logic.

    I am using JMSCorrelationID to uniquely identify a response for a request sent
    by the client.

    What are the possible options to handle exceptions in JMS for an implementation
    like the one mentioned above.

    Any comments/feedback/pointers will be REALLY REALLY appreciated.

    Tks and regds
    C R Baradwaj

  2. Re: How to notify the exceptions in JMS sychronous request-responseprocessing?

    One approach is to send an "error" message to QB that uses
    the JMSCorrelationID the consumer is expecting. This will
    wake up the consumer, and the consumer can react to
    the error as needed.

    Another is to use two asynchronous listeners, one on the
    response queue, and one on a temporary (client created)
    queue. On error detection the MDB can send error messages
    to the temporary queue.

    You may want to skim the book "Professional JMS" - as I
    recall, it contains a section on queueing design patterns.

    Tom

    Raghuram Bharadwaj C wrote:

    > Hi All,
    >
    > Pl. help me with ur expertise in the foll. scenario we are facing.
    >
    > Scenario:
    > I have a requirement where I need to notify the exceptions to my client while
    > the client request's are processed asynchronously and my client is waiting in
    > synchronous for the response.
    >
    > The client is sending a message to one queue (QueueA) and waiting for response
    > in another queue (QueueB). The message from "QueueA" is picked up by a MDB listening
    > to "QueueA" and it throws an exception while processing some "business logic".
    >
    > In this case how do I notify to my client who is waiting in another queue. i.e.
    > "QueueB" that there is an exception occurred while processing the business logic.
    >
    > I am using JMSCorrelationID to uniquely identify a response for a request sent
    > by the client.
    >
    > What are the possible options to handle exceptions in JMS for an implementation
    > like the one mentioned above.
    >
    > Any comments/feedback/pointers will be REALLY REALLY appreciated.
    >
    > Tks and regds
    > C R Baradwaj



  3. Re: How to notify the exceptions in JMS sychronous request-response


    Thanks tom for your support!

    Let me explain more about the problem.

    Scenario
    ========
    Lets take a simplest case where the client is sending a message to "QueueA" and
    he is now waiting for a response in the "ResponseQ"

    The MDB listening to "QueueA" wakes up and split the message(s) into three and
    passing it to the next layer of datasource specific queue(s). The queue(s) are
    "QueueB", "QueueC" and "QueueD".

    The MDB listening to the datasource specific queue(s) picks up the datasource
    request sends it to the datasource and gets the response back from the datasource.
    The MDB also updates a table in the database with the response. The MDB also check(s)
    after updating the database to see all response(s) from all the datasource(s)
    are reached. If yes, one of the MDB also sends a acknowledgement to the "ResponseQ".


    The client listening to the "ResponseQ" gets the acknowledgement and hit the database
    to collect all the response(s) from all the datasource(s). These response(s) are
    formatted and sent a response to the client. We have also created uniqueid for
    identifying each request. This uniqueid is set in the JMSCorrelationID. The client
    uses the uniqueid to collect all the response(s) for the request he had sent.

    Problem
    =======
    If an error/exception occurred in a one of the MDB which is listening to QueueB/QueueC/QueueD.
    How do we handle this?

    Please let me know all the possibilities that you would have done in this case.




    Many Thanks in Advance,

    C R Baradwaj








    Assuming that

    Tom Barnes wrote:
    >One approach is to send an "error" message to QB that uses
    >the JMSCorrelationID the consumer is expecting. This will
    >wake up the consumer, and the consumer can react to
    >the error as needed.
    >
    >Another is to use two asynchronous listeners, one on the
    >response queue, and one on a temporary (client created)
    >queue. On error detection the MDB can send error messages
    >to the temporary queue.
    >
    >You may want to skim the book "Professional JMS" - as I
    >recall, it contains a section on queueing design patterns.
    >
    >Tom
    >
    >Raghuram Bharadwaj C wrote:
    >
    >> Hi All,
    >>
    >> Pl. help me with ur expertise in the foll. scenario we are facing.
    >>
    >> Scenario:
    >> I have a requirement where I need to notify the exceptions to my client

    >while
    >> the client request's are processed asynchronously and my client is

    >waiting in
    >> synchronous for the response.
    >>
    >> The client is sending a message to one queue (QueueA) and waiting for

    >response
    >> in another queue (QueueB). The message from "QueueA" is picked up by

    >a MDB listening
    >> to "QueueA" and it throws an exception while processing some "business

    >logic".
    >>
    >> In this case how do I notify to my client who is waiting in another

    >queue. i.e.
    >> "QueueB" that there is an exception occurred while processing the business

    >logic.
    >>
    >> I am using JMSCorrelationID to uniquely identify a response for a request

    >sent
    >> by the client.
    >>
    >> What are the possible options to handle exceptions in JMS for an implementation
    >> like the one mentioned above.
    >>
    >> Any comments/feedback/pointers will be REALLY REALLY appreciated.
    >>
    >> Tks and regds
    >> C R Baradwaj

    >



  4. Re: How to notify the exceptions in JMS sychronous request-response



    Raghuram Bharadwaj C wrote:
    > Thanks tom for your support!
    >
    > Let me explain more about the problem.
    >
    > Scenario
    > ========
    > Lets take a simplest case where the client is sending a message to "QueueA" and
    > he is now waiting for a response in the "ResponseQ"
    >
    > The MDB listening to "QueueA" wakes up and split the message(s) into three and
    > passing it to the next layer of datasource specific queue(s). The queue(s) are
    > "QueueB", "QueueC" and "QueueD".
    >
    > The MDB listening to the datasource specific queue(s) picks up the datasource
    > request sends it to the datasource and gets the response back from the datasource.
    > The MDB also updates a table in the database with the response. The MDB also check(s)
    > after updating the database to see all response(s) from all the datasource(s)
    > are reached. If yes, one of the MDB also sends a acknowledgement to the "ResponseQ".
    >
    >
    > The client listening to the "ResponseQ" gets the acknowledgement and hit the database
    > to collect all the response(s) from all the datasource(s). These response(s) are
    > formatted and sent a response to the client. We have also created uniqueid for
    > identifying each request. This uniqueid is set in the JMSCorrelationID. The client
    > uses the uniqueid to collect all the response(s) for the request he had sent.
    >
    > Problem
    > =======
    > If an error/exception occurred in a one of the MDB which is listening to QueueB/QueueC/QueueD.
    > How do we handle this?
    >
    > Please let me know all the possibilities that you would have done in this case.
    >
    >


    Does A know how many downstream queues are involved? As part of its
    transaction it can send a message to the responseQ stating which
    queues to expect responses from. The client gets this message
    and knows that it must get responses from all of B, C, D, etc.
    before assuming success. On a failure, B, C, D, etc. can send
    an error message back to the response Q, or the client can
    simply timeout.

    This way there are no race conditions
    involving unanticipated multiple responses or missing
    responses, which I think the
    algorithm you mention above can create.
    Assuming just B and C (no D):
    B detects C is done by checking the DB
    C detects B is done by checking the DB **at the same time**
    Two response messages get sent
    - or -
    B finishes detects C not done, and sends no message.
    C finishes, B is finished but not reflected in DB yet, sends
    no message.

    NOTE: Be aware that when a transaction commits, different
    resources can response "faster" than others. The transaction
    monitor has no control over this. So, if as part of the
    same commit, a database insert and a queue insert is
    performed, it is possible for a consumer to receive the
    new message BEFORE the new database insert actually completes.

    >
    >
    > Many Thanks in Advance,
    >
    > C R Baradwaj
    >
    >
    >
    >
    >
    >
    >
    >
    > Assuming that
    >
    > Tom Barnes wrote:
    >
    >>One approach is to send an "error" message to QB that uses
    >>the JMSCorrelationID the consumer is expecting. This will
    >>wake up the consumer, and the consumer can react to
    >>the error as needed.
    >>
    >>Another is to use two asynchronous listeners, one on the
    >>response queue, and one on a temporary (client created)
    >>queue. On error detection the MDB can send error messages
    >>to the temporary queue.
    >>
    >>You may want to skim the book "Professional JMS" - as I
    >>recall, it contains a section on queueing design patterns.
    >>
    >>Tom
    >>
    >>Raghuram Bharadwaj C wrote:
    >>
    >>
    >>>Hi All,
    >>>
    >>>Pl. help me with ur expertise in the foll. scenario we are facing.
    >>>
    >>>Scenario:
    >>>I have a requirement where I need to notify the exceptions to my client

    >>
    >>while
    >>
    >>>the client request's are processed asynchronously and my client is

    >>
    >>waiting in
    >>
    >>>synchronous for the response.
    >>>
    >>>The client is sending a message to one queue (QueueA) and waiting for

    >>
    >>response
    >>
    >>>in another queue (QueueB). The message from "QueueA" is picked up by

    >>
    >>a MDB listening
    >>
    >>>to "QueueA" and it throws an exception while processing some "business

    >>
    >>logic".
    >>
    >>>In this case how do I notify to my client who is waiting in another

    >>
    >>queue. i.e.
    >>
    >>>"QueueB" that there is an exception occurred while processing the business

    >>
    >>logic.
    >>
    >>>I am using JMSCorrelationID to uniquely identify a response for a request

    >>
    >>sent
    >>
    >>>by the client.
    >>>
    >>>What are the possible options to handle exceptions in JMS for an implementation
    >>>like the one mentioned above.
    >>>
    >>>Any comments/feedback/pointers will be REALLY REALLY appreciated.
    >>>
    >>>Tks and regds
    >>>C R Baradwaj

    >>

    >



  5. Re: How to notify the exceptions in JMS sychronous request-response


    Tom,

    Once again thanks a lot for your prompt response!

    Yes, A Knows how many downstream queues are involved.

    For unanticipated multiple responses
    >>>>>>>>>>>>>>>>>>>>>>>>>>

    If I do a select for update in all the MDB's listening to "QueueB/QueueC/QueueD",
    only one response message will be sent to the "ResponseQ".

    The response from all the datasource(s) are updated in the database by the MDB.
    The MDB which updates the database last will consolidate all the response(s) and
    send one final response to the "ResponseQ".

    This will be picked up the client who is waiting in the "ResponseQ". There wont
    be multiple message(s) placed in the "ResponseQ".

    In this situation, How do I handle exceptions that occur in downstream MDB's?

    Many Thanks in Advance,
    C R Baradwaj










    Tom Barnes wrote:
    >
    >
    >Raghuram Bharadwaj C wrote:
    >> Thanks tom for your support!
    >>
    >> Let me explain more about the problem.
    >>
    >> Scenario
    >> ========
    >> Lets take a simplest case where the client is sending a message to

    >"QueueA" and
    >> he is now waiting for a response in the "ResponseQ"
    >>
    >> The MDB listening to "QueueA" wakes up and split the message(s) into

    >three and
    >> passing it to the next layer of datasource specific queue(s). The queue(s)

    >are
    >> "QueueB", "QueueC" and "QueueD".
    >>
    >> The MDB listening to the datasource specific queue(s) picks up the

    >datasource
    >> request sends it to the datasource and gets the response back from

    >the datasource.
    >> The MDB also updates a table in the database with the response. The

    >MDB also check(s)
    >> after updating the database to see all response(s) from all the datasource(s)
    >> are reached. If yes, one of the MDB also sends a acknowledgement to

    >the "ResponseQ".
    >>
    >>
    >> The client listening to the "ResponseQ" gets the acknowledgement and

    >hit the database
    >> to collect all the response(s) from all the datasource(s). These response(s)

    >are
    >> formatted and sent a response to the client. We have also created uniqueid

    >for
    >> identifying each request. This uniqueid is set in the JMSCorrelationID.

    > The client
    >> uses the uniqueid to collect all the response(s) for the request he

    >had sent.
    >>
    >> Problem
    >> =======
    >> If an error/exception occurred in a one of the MDB which is listening

    >to QueueB/QueueC/QueueD.
    >> How do we handle this?
    >>
    >> Please let me know all the possibilities that you would have done in

    >this case.
    >>
    >>

    >
    >Does A know how many downstream queues are involved? As part of its
    >transaction it can send a message to the responseQ stating which
    >queues to expect responses from. The client gets this message
    >and knows that it must get responses from all of B, C, D, etc.
    >before assuming success. On a failure, B, C, D, etc. can send
    >an error message back to the response Q, or the client can
    >simply timeout.
    >
    >This way there are no race conditions
    >involving unanticipated multiple responses or missing
    >responses, which I think the
    >algorithm you mention above can create.
    >Assuming just B and C (no D):
    > B detects C is done by checking the DB
    > C detects B is done by checking the DB **at the same time**
    > Two response messages get sent
    > - or -
    > B finishes detects C not done, and sends no message.
    > C finishes, B is finished but not reflected in DB yet, sends
    > no message.
    >
    >NOTE: Be aware that when a transaction commits, different
    >resources can response "faster" than others. The transaction
    >monitor has no control over this. So, if as part of the
    >same commit, a database insert and a queue insert is
    >performed, it is possible for a consumer to receive the
    >new message BEFORE the new database insert actually completes.
    >
    >>
    >>
    >> Many Thanks in Advance,
    >>
    >> C R Baradwaj
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >>
    >> Assuming that
    >>
    >> Tom Barnes wrote:
    >>
    >>>One approach is to send an "error" message to QB that uses
    >>>the JMSCorrelationID the consumer is expecting. This will
    >>>wake up the consumer, and the consumer can react to
    >>>the error as needed.
    >>>
    >>>Another is to use two asynchronous listeners, one on the
    >>>response queue, and one on a temporary (client created)
    >>>queue. On error detection the MDB can send error messages
    >>>to the temporary queue.
    >>>
    >>>You may want to skim the book "Professional JMS" - as I
    >>>recall, it contains a section on queueing design patterns.
    >>>
    >>>Tom
    >>>
    >>>Raghuram Bharadwaj C wrote:
    >>>
    >>>
    >>>>Hi All,
    >>>>
    >>>>Pl. help me with ur expertise in the foll. scenario we are facing.
    >>>>
    >>>>Scenario:
    >>>>I have a requirement where I need to notify the exceptions to my client
    >>>
    >>>while
    >>>
    >>>>the client request's are processed asynchronously and my client is
    >>>
    >>>waiting in
    >>>
    >>>>synchronous for the response.
    >>>>
    >>>>The client is sending a message to one queue (QueueA) and waiting

    >for
    >>>
    >>>response
    >>>
    >>>>in another queue (QueueB). The message from "QueueA" is picked up

    >by
    >>>
    >>>a MDB listening
    >>>
    >>>>to "QueueA" and it throws an exception while processing some "business
    >>>
    >>>logic".
    >>>
    >>>>In this case how do I notify to my client who is waiting in another
    >>>
    >>>queue. i.e.
    >>>
    >>>>"QueueB" that there is an exception occurred while processing the

    >business
    >>>
    >>>logic.
    >>>
    >>>>I am using JMSCorrelationID to uniquely identify a response for a

    >request
    >>>
    >>>sent
    >>>
    >>>>by the client.
    >>>>
    >>>>What are the possible options to handle exceptions in JMS for an implementation
    >>>>like the one mentioned above.
    >>>>
    >>>>Any comments/feedback/pointers will be REALLY REALLY appreciated.
    >>>>
    >>>>Tks and regds
    >>>>C R Baradwaj
    >>>

    >>

    >



  6. Re: How to notify the exceptions in JMS sychronous request-response



    Raghuram Bharadwaj C wrote:

    > Tom,
    >
    > Once again thanks a lot for your prompt response!
    >
    > Yes, A Knows how many downstream queues are involved.
    >
    > For unanticipated multiple responses
    >
    > If I do a select for update in all the MDB's listening to "QueueB/QueueC/QueueD",
    > only one response message will be sent to the "ResponseQ".


    Does this run the risk of serializing the database access? If
    B/C/D have no messages so that a new operation causes all
    three to fire at once, will they end up serializing on their
    respective selectForUpdate calls, losing parallelism?

    >
    > The response from all the datasource(s) are updated in the database by the MDB.
    > The MDB which updates the database last will consolidate all the response(s) and
    > send one final response to the "ResponseQ".
    >
    > This will be picked up the client who is waiting in the "ResponseQ". There wont
    > be multiple message(s) placed in the "ResponseQ".
    >
    > In this situation, How do I handle exceptions that occur in downstream MDB's?


    Use multiple responses. MDB's send error message on response.
    Or have failing MDB put an error message in the database table, so
    that the final responder can read the error message?

    >
    > Many Thanks in Advance,
    > C R Baradwaj
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > Tom Barnes wrote:
    >
    >>
    >>Raghuram Bharadwaj C wrote:
    >>
    >>>Thanks tom for your support!
    >>>
    >>>Let me explain more about the problem.
    >>>
    >>>Scenario
    >>>========
    >>>Lets take a simplest case where the client is sending a message to

    >>
    >>"QueueA" and
    >>
    >>>he is now waiting for a response in the "ResponseQ"
    >>>
    >>>The MDB listening to "QueueA" wakes up and split the message(s) into

    >>
    >>three and
    >>
    >>>passing it to the next layer of datasource specific queue(s). The queue(s)

    >>
    >>are
    >>
    >>>"QueueB", "QueueC" and "QueueD".
    >>>
    >>>The MDB listening to the datasource specific queue(s) picks up the

    >>
    >>datasource
    >>
    >>>request sends it to the datasource and gets the response back from

    >>
    >>the datasource.
    >>
    >>>The MDB also updates a table in the database with the response. The

    >>
    >>MDB also check(s)
    >>
    >>>after updating the database to see all response(s) from all the datasource(s)
    >>>are reached. If yes, one of the MDB also sends a acknowledgement to

    >>
    >>the "ResponseQ".
    >>
    >>>
    >>>The client listening to the "ResponseQ" gets the acknowledgement and

    >>
    >>hit the database
    >>
    >>>to collect all the response(s) from all the datasource(s). These response(s)

    >>
    >>are
    >>
    >>>formatted and sent a response to the client. We have also created uniqueid

    >>
    >>for
    >>
    >>>identifying each request. This uniqueid is set in the JMSCorrelationID.

    >>
    >>The client
    >>
    >>>uses the uniqueid to collect all the response(s) for the request he

    >>
    >>had sent.
    >>
    >>>Problem
    >>>=======
    >>>If an error/exception occurred in a one of the MDB which is listening

    >>
    >>to QueueB/QueueC/QueueD.
    >>
    >>>How do we handle this?
    >>>
    >>>Please let me know all the possibilities that you would have done in

    >>
    >>this case.
    >>
    >>>

    >>Does A know how many downstream queues are involved? As part of its
    >>transaction it can send a message to the responseQ stating which
    >>queues to expect responses from. The client gets this message
    >>and knows that it must get responses from all of B, C, D, etc.
    >>before assuming success. On a failure, B, C, D, etc. can send
    >>an error message back to the response Q, or the client can
    >>simply timeout.
    >>
    >>This way there are no race conditions
    >>involving unanticipated multiple responses or missing
    >>responses, which I think the
    >>algorithm you mention above can create.
    >>Assuming just B and C (no D):
    >> B detects C is done by checking the DB
    >> C detects B is done by checking the DB **at the same time**
    >> Two response messages get sent
    >> - or -
    >> B finishes detects C not done, and sends no message.
    >> C finishes, B is finished but not reflected in DB yet, sends
    >> no message.
    >>
    >>NOTE: Be aware that when a transaction commits, different
    >>resources can response "faster" than others. The transaction
    >>monitor has no control over this. So, if as part of the
    >>same commit, a database insert and a queue insert is
    >>performed, it is possible for a consumer to receive the
    >>new message BEFORE the new database insert actually completes.
    >>
    >>
    >>>
    >>>Many Thanks in Advance,
    >>>
    >>>C R Baradwaj
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>
    >>>Assuming that
    >>>
    >>>Tom Barnes wrote:
    >>>
    >>>
    >>>>One approach is to send an "error" message to QB that uses
    >>>>the JMSCorrelationID the consumer is expecting. This will
    >>>>wake up the consumer, and the consumer can react to
    >>>>the error as needed.
    >>>>
    >>>>Another is to use two asynchronous listeners, one on the
    >>>>response queue, and one on a temporary (client created)
    >>>>queue. On error detection the MDB can send error messages
    >>>>to the temporary queue.
    >>>>
    >>>>You may want to skim the book "Professional JMS" - as I
    >>>>recall, it contains a section on queueing design patterns.
    >>>>
    >>>>Tom
    >>>>
    >>>>Raghuram Bharadwaj C wrote:
    >>>>
    >>>>
    >>>>
    >>>>>Hi All,
    >>>>>
    >>>>>Pl. help me with ur expertise in the foll. scenario we are facing.
    >>>>>
    >>>>>Scenario:
    >>>>>I have a requirement where I need to notify the exceptions to my client
    >>>>
    >>>>while
    >>>>
    >>>>
    >>>>>the client request's are processed asynchronously and my client is
    >>>>
    >>>>waiting in
    >>>>
    >>>>
    >>>>>synchronous for the response.
    >>>>>
    >>>>>The client is sending a message to one queue (QueueA) and waiting

    >>
    >>for
    >>
    >>>>response
    >>>>
    >>>>
    >>>>>in another queue (QueueB). The message from "QueueA" is picked up

    >>
    >>by
    >>
    >>>>a MDB listening
    >>>>
    >>>>
    >>>>>to "QueueA" and it throws an exception while processing some "business
    >>>>
    >>>>logic".
    >>>>
    >>>>
    >>>>>In this case how do I notify to my client who is waiting in another
    >>>>
    >>>>queue. i.e.
    >>>>
    >>>>
    >>>>>"QueueB" that there is an exception occurred while processing the

    >>
    >>business
    >>
    >>>>logic.
    >>>>
    >>>>
    >>>>>I am using JMSCorrelationID to uniquely identify a response for a

    >>
    >>request
    >>
    >>>>sent
    >>>>
    >>>>
    >>>>>by the client.
    >>>>>
    >>>>>What are the possible options to handle exceptions in JMS for an implementation
    >>>>>like the one mentioned above.
    >>>>>
    >>>>>Any comments/feedback/pointers will be REALLY REALLY appreciated.
    >>>>>
    >>>>>Tks and regds
    >>>>>C R Baradwaj
    >>>>

    >



+ Reply to Thread