Author |
Message
|
Drax |
Posted: Sun Dec 09, 2012 5:36 pm Post subject: Geting duplicate msgs and losing msgs |
|
|
 Novice
Joined: 16 Apr 2007 Posts: 12 Location: China
|
Hello all,
I got issues to get msgs from MQ server with my consumer, it happens 2-3 times one month,
working process of my consumer is as below(not in the same host with MQ server)
1. browse MQ data get_options.Options = MQGMO_WAIT | MQGMO_BROWSE_FIRST | MQGMO_LOCK;
2. insert into DB
3. delete MQ data get_options.Options = MQGMO_NO_WAIT | MQGMO_ACCEPT_TRUNCATED_MSG;
Not sure what cause such kind of issue, I didnt see any errors in MQ server side and App side...
need you help to suggest anything I can do to impove my consumer? |
|
Back to top |
|
 |
Vitor |
Posted: Sun Dec 09, 2012 6:56 pm Post subject: Re: Geting duplicate msgs and losing msgs |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Drax wrote: |
need you help to suggest anything I can do to impove my consumer? |
Don't use that code. Use the standard / best practice method of doing a destructive read under syncpoint, insert into the database in the same unit of work and then commit or rollback as appropriate.
Not only is it more efficient, it synchronizes (hence syncpoint) the WMQ activity with the database activity and is intended to eliminate the loss / duplication you're seeing. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Drax |
Posted: Sun Dec 09, 2012 9:59 pm Post subject: Re: Geting duplicate msgs and losing msgs |
|
|
 Novice
Joined: 16 Apr 2007 Posts: 12 Location: China
|
Vitor wrote: |
Drax wrote: |
need you help to suggest anything I can do to impove my consumer? |
Don't use that code. Use the standard / best practice method of doing a destructive read under syncpoint, insert into the database in the same unit of work and then commit or rollback as appropriate.
Not only is it more efficient, it synchronizes (hence syncpoint) the WMQ activity with the database activity and is intended to eliminate the loss / duplication you're seeing. |
thanks |
|
Back to top |
|
 |
zpat |
Posted: Sun Dec 09, 2012 11:52 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
In general you never need to use browse in an application.
Certainly learn and use the standard approach first. Do remember that MQ and DB syncpoints are only truly combined when using XA coordination. |
|
Back to top |
|
 |
Drax |
Posted: Mon Dec 10, 2012 9:51 pm Post subject: |
|
|
 Novice
Joined: 16 Apr 2007 Posts: 12 Location: China
|
zpat wrote: |
In general you never need to use browse in an application.
Certainly learn and use the standard approach first. Do remember that MQ and DB syncpoints are only truly combined when using XA coordination. |
then I may need extra cost here I presume...  |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Dec 10, 2012 9:56 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Drax wrote: |
zpat wrote: |
In general you never need to use browse in an application.
Certainly learn and use the standard approach first. Do remember that MQ and DB syncpoints are only truly combined when using XA coordination. |
then I may need extra cost here I presume...  |
May be not. Licensing under 7.5 is different... but for licensing questions your partner is your IBM rep.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
zpat |
Posted: Tue Dec 11, 2012 2:12 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
XA is a feature that MQ can use as a resource, or as a transaction coordinator.
Either way there is no additional cost, but it is more set up work. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Dec 11, 2012 6:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Drax wrote: |
then I may need extra cost here I presume...  |
For what? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Drax |
Posted: Wed Dec 12, 2012 6:00 pm Post subject: |
|
|
 Novice
Joined: 16 Apr 2007 Posts: 12 Location: China
|
Vitor wrote: |
Drax wrote: |
then I may need extra cost here I presume...  |
For what? |
For XA transactional client.. actually the APp, DB and MQ are not in the same server... and if I'm not wrong, if we need two-phase commitment here, at least from MQ side, we need to install the transactional client in App side which is not free now.. licensing might be different after we using MQ 7.5, but it is not yet planned...
only for cost saving.. I'm thinking if we could separate the message gettign and DB inserting into two UOW.. it will avoid the msgs losing as well and it is much cheaper... |
|
Back to top |
|
 |
Drax |
Posted: Wed Dec 12, 2012 6:24 pm Post subject: |
|
|
 Novice
Joined: 16 Apr 2007 Posts: 12 Location: China
|
|
Back to top |
|
 |
|