3

I am having problems with a JMS Tibco consumer in Java.

Queue management is carried out by another company and they don't want to make changes on their part.

I have to read the messages one by one to process them later in another service. I can usually read messages without problem, but if I lose the connection and reconnect the message that was being read disappears and is not available again. The following next message that hasn't been read returns to the queue in 15 minutes but not the current.

I use this function to read.

if (isConnected) {
    try {

        message = msgConsumer.receiveNoWait();
        //message=msgConsumer.receive();

        if (message != null) {
            TextMessage txtMessage = (TextMessage) message;
            out.SetProperty("message", txtMessage.getText());
            out.SetProperty("read", true);
        } else {
            out.SetProperty("read", false);
        }

    } catch (JMSException e) {
        connection.close();
        errorMessage = e.getMessage();
        errorCode = "666";
        throw new JMSException(e.getMessage());
    }
}

I'm using:

  • javax.jms.*;
  • com.tibco.tibjms.TibjmsConnectionFactory;

For example the original queue message are:

<message>1<message>
<message>2<message>
<message>3<message>
<message>4<message>
<message>5<message>

and I lose the connection during 2 seconds when I'm reading message number 2. The next messages that I read are 4 and 5 and then 3 I can read after 15 minutes. But number 2 is lost.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43

0 Answers0