Questions about the JMS message pending

Source: Internet
Author: User
Tags ack

Some time ago, I was told by a colleague that there are a lot of message status for receive in the client, which can only be consumed if the JMS server or WebLogic server is fully charged. After investigation, this problem may be a bug in the WebLogic, of course, does not exclude the possibility of the specific environment. Let's take a look at the root cause of the problem, which helps us to understand more about the implementation of WebLogic JMS.

First, let's take a look at what is receive,receive means that a message has been consumed by consumer, but the server has no ACK on it, so messages cannot be removed from the queue. Because the messages in the queue are point-2-point, a message that is marked as receive is naturally not consumed by other consumer. So who is responsible for this ACK sent to the server, when to send it? These are the ack_mode decisions that we use when we create the JMS session, and the typical ack-mode are the following two kinds:

Auto-ack: Automatic response mode, consumer.receive () after the call, if the server side found that there are available messages, the message returned to the client JMS implementation layer, before the message returned to the customer, by the WebLogic client (Jmssession.getasyncmessageforconsumer (), accepted asynchronously, such as MessageListener, or jmssession.receivemessage (), The synchronous accept) layer implements a direct call to the acknowledge () notification server, and after the server receives an ACK, it is responsible for removing the message at receive from the physical queue.

Client-ack: Customer response mode, consumer.receive () after the client receives a message, the client program determines when to send an ACK, can be sent immediately after the message, can also be sent after the successful message processing, ACK sent by Message.acknowledge () implementation. The following procedure is the same as Auto-ack.

First look at this problem, the feeling is ACK did not receive, then what will appear ack lost? Network issues? Then the client or server log should be able to see the exception, and the customer insists there is no exception. It's kind of weird, for the client's code, they don't have the code, actually their application is based on the spring framework, through simple configuration to achieve their business needs, looking at the next spring's related code, the customer said nothing unusual, because spring Catch the server-side return of the jmsexception and eat the exception (that is, the exception is not printed), this exception output can be implemented through the configuration of spring. After the client configuration, gave me the specific exception, as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.