ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Losing messages in multithreaded Java program

Post new topic  Reply to topic
 Losing messages in multithreaded Java program « View previous topic :: View next topic » 
Author Message
unkind
PostPosted: Thu May 19, 2011 5:28 am    Post subject: Losing messages in multithreaded Java program Reply with quote

Newbie

Joined: 19 May 2011
Posts: 1
Location: Russia

Hello,
I am trying to write a multithreaded java application that gets messages from queue and inserts them to database.
using ,MQC.MQGMO_SYNCPOINT and MQC.MQGMO_WAIT (with unlimited wait interval) open options.
first of all, I create a thread (t1) that waits a message to come. when it gets it from queue, it creates a second thread (t2) which waits for a next message. at the same time thread t1 tries to insert message to database. after succesfull insert transaction commits. both methods are synchronized, count of active threads is under control.

so, when I try to get 100 messages (for example) from a queue, one or two last of them are lost. queue is empty, but database contains only 98-99 messages. how can I solve this problem?

windows 7, MQ v 7.0, DB2 v 9.5
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu May 19, 2011 7:36 am    Post subject: Re: Losing messages in multithreaded Java program Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

unkind wrote:
Hello,
I am trying to write a multithreaded java application that gets messages from queue and inserts them to database.
using ,MQC.MQGMO_SYNCPOINT and MQC.MQGMO_WAIT (with unlimited wait interval) open options.
first of all, I create a thread (t1) that waits a message to come. when it gets it from queue, it creates a second thread (t2) which waits for a next message. at the same time thread t1 tries to insert message to database. after succesfull insert transaction commits. both methods are synchronized, count of active threads is under control.

so, when I try to get 100 messages (for example) from a queue, one or two last of them are lost. queue is empty, but database contains only 98-99 messages. how can I solve this problem?

windows 7, MQ v 7.0, DB2 v 9.5

Review your threading model and have each thread work an independent connection.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Losing messages in multithreaded Java program
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.