1 2 Previous Next 17 Replies Latest reply on Aug 5, 2008 4:22 AM by timfox Go to original post
      • 15. Re: All messages are not persisted in Database.
        timfox

        As I said before I suspect you're starting your publisher(s) before the subscriber has created the durable subscription, hence the first few messages get "lost" since there's no durable subscription. That's to be expected.

        Putting publisher and subscriber into the same file means that can't happen.

        • 16. Re: All messages are not persisted in Database.
          timfox

          There are two other problems with your code I can see after a quick perusal:

          1) You're starting your threads but not waiting for them to complete before exiting. You need to add calls to Thread::join() to make sure you wait until they complete or your program will exit before they are done

          2) JMS sessions are *single threaded* see JMS spec. It is illegal to use a particular JMS session concurrently by more than one thread. Your publisher threads are using the same session.

          • 17. Re: All messages are not persisted in Database.
            timfox

            There's a third problem with your code:

            You start the subscriber thread, then immediately start the publisher thread(s) before waiting for the subcriber thread to finish.

            This means there's a strong possibility you'll start sending messages before the durable subscription is created, so messages will be "lost".

            Much as I would like to debug your code all day, I have to get back to work now ;)

            1 2 Previous Next