今天同事问我说,如何处理RECEIVE、VISIBLE的JMS消息?有点懵,之前从没有关注过消息的状态。Weblogic81中,我们是不能看到destination中的消息的,只能看到当前destination中,有多少message, 有多少pending的message。而92中,我们监控destination的时候,可以看到具体的message,而且message后面会跟一个state string。标题中说的RECEIVE、VISIBLE就是这个state string,其实state有很多,常见的也就是RECEIVE、VISIBLE。下面我们看看所有这些STATE在代码(MessageInfo.java)中的解释,
VISIBLE:Indicates that the message is visible on the destination.消息已经入列,等待被消费。
ORDERED:Indicates that the message belongs to a Unit of Order. 消息处于某个unit中。
DELAYED:Indicates that the message exists on the destination but is classified as pending because it has a scheduled delivery time or is delayed. 消息已经入列,但因为TimeToDeliver还没有到,直到TimeToDeliver,该消息才会变成VISIBLE。或者由于客户端消费异常,比如onMessage中出现了RuntimeException,消息被recover后,等待Redelivery Delay时间到达,然后重新发送。
RECEIVE:Indicates that the message exists on the destination but is classified as pending because it has been received but not acknowledged. The actual state may also include STATE_TRANSACTION if the receive operation was performed as part of a transaction.消息已经入列,且已经被DELIVER到某个CONSUMER,但CONSUMER的ACKNOWLEDGE还没有收到。可能是网络问题或客户端设为CLIENT_ACK模式。
SEND:Indicates that the message exists on the destination but is classified as pending because it is part of a send operation that is in progress. The actual state may also include STATE_TRANSACTION if the send operation was perfromed as part of a transaction.消息已经入列,但目前send操作正在处理中(比如事务未提交),该消息对于consumer是不可用的。
TRANSACTION:Indicates that the message exists on the destination but is classified as pending because it is part of a send or receive operation that is being performed as part of a global transaction.
PAUSED:Indicates that the message exists on the destination but is being held in a pending state because of a pause operation. 消息因为PAUSE被PENDING在DEST中。
REDELIVERY_COUNT_EXCEEDED:Indicates that the message has exceeded the redelivery count set for the destination and is no longer available for consumption. 消息反复REDELIVERY的上限已经到达,这样的消息不会被重发。
根据消息的状态,我们基本可以断定JMS消息相关问题的位置,从而调查可以做到有的放矢。
posted on 2009-05-21 15:27
走走停停又三年 阅读(1635)
评论(0) 编辑 收藏 所属分类:
Weblogic