users@glassfish.java.net

Re: What exactly means NumMsgsHeldInTransaction and NumMsgsPendingAcks in JMS Destinations?

From: Amy Kang <amy.kang_at_oracle.com>
Date: Tue, 20 Dec 2011 15:19:16 -0800

NumMsgsHeldInTransaction indicates the number of messages that have been
produced in transactions which have not been completed. For Queues,
NumMsgsHeldInTransaction is also shown as NumMsgsPendingAcks.

If your Stateless EJB has container managed transaction type, please
see EJB specification section 12.3.5
"Because the container manages the transactional enlistment of JMS
sessions on behalf of a bean, the parameters of the
createSession(boolean transacted, int acknowledgeMode),
createQueueSession(boolean transacted, int acknowledgeMode) and
createTopicSession(boolean transacted, int acknowledgeMode) methods are
ignored."

Amy

On 12/14/2011 03:01 PM, Gustavo Henrique Orair wrote:
> I am not sure but this problem may be related to JMX technology. So,
> if it is the case, I am trying to tell what exactly better my code.
>
> My JMS producers are being invoked by JMX.
>
> In fact, I have an EJB Singleton JMXServiceActivator may be invoked to
> perform JMX enabled tasks, such as ExtractLastYearReports,
> ExtractLastMonthReports, ExtractLastWeekReports and ExtractLastDayReports.
> This JMXServiceActivator do not have any complex logic, it just inject
> and invoke a Stateless EJB that I call ExtractorScheduler (their
> methods may execute in programmed hours also).
>
> The Stateless EJB will just iterate (30 times for
> ExtractLastMonthReports, 7 times for ExtractLastWeekReports). For each
> iteration, a new Extractor object is created and Extractor execute an
> extraction. The extraction method access the filesystem, get a Report
> Business Object and send this report to a queue. The JMS connection
> pool and JMS queue are scoped inside a dispatch method invoked by the
> extraction method.
>
> Strangely, the messages are just "unlocked" (not held in transaction)
> when all iterations are done. In the case I have too many reports,
> such as ExtractLastYearReports, the producers stop working because no
> more connection are available in Connection Factory.
>
> Is this a JMX related bug or am I missing something?
>
> BR,
> ---------------------------------------------------------------------------------------------------------------------
> Gustavo Henrique Orair
> Mestre em Ciência da Computação - MSc in Computer Science
> Universidade Federal de Minas Gerais
> Celular/Cell phone: 55-31-85157887
> ------------------------------------------------------------------------------------------------------------------
>
>
> 2011/12/14 Gustavo Henrique Orair <gustavo.orair_at_gmail.com
> <mailto:gustavo.orair_at_gmail.com>>
>
> Sorry, if it is a very noob question but I have some problems
> using JMS.
>
> I have some producers that obtain the JMS resources (Connection
> Factory and Queue) using explicitly JNDI.
>
> So I create a session using connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE).
> I assume that as I created the session with first parameter to
> false, no transactions are involved and this is really the
> behaviour I need.
>
> I have an iteration that basically change the object inside
> ObjectMessage:
> msg.setObject(objetoCorrente);
> And send the message
> produtorMsg.send(msg);
>
>
> When monitoring using Jconsole I see the NumMsgs equals to zero
> while NumMsgsPendingAcks and NumMsgsHeldInTransaction increases
> simultaneously.
> For some reason, looks like the transacted==false are not being
> honored and no msgs are being sent before the session is closed.
>
> Could someone explain me better what exactly NumMsgsPendingAcks
> and NumMsgsHeldInTransaction means? And which could be my problem?
>
> Best,
> ---------------------------------------------------------------------------------------------------------------------
> Gustavo Henrique Orair
> ------------------------------------------------------------------------------------------------------------------
>
>