Cheng,
The MDB is annotated with @MessageDriven and nothing else. My
sun-ejb-jar.xml is below. We are connecting to Websphere MQ 7 using IBM's
JCA resource adapter. Anything else that I should be looking at?
---
sun-ejb-jar.xml
---
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application
Server 9.0 EJB 3.0//EN"
"http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_0-0.dtd">
<sun-ejb-jar>
<enterprise-beans>
<unique-id>1</unique-id>
<ejb>
<ejb-name>AlertRouterBean</ejb-name>
<mdb-resource-adapter>
<resource-adapter-mid>wmq.jmsra</resource-adapter-mid>
<activation-config>
<!-- Props that create a JMS connection -->
<activation-config-property>
<activation-config-property-name>brokerQueueManager</activation-config-prop
erty-name>
<activation-config-property-value>QM_EXAM_01</activation-config-property-va
lue>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>channel</activation-config-property-name>
<activation-config-property-value>MY.JMS.PROCESS</activation-config-propert
y-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>hostName</activation-config-property-name>
<activation-config-property-value>qm.example.com</activation-config-propert
y-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>port</activation-config-property-name>
<activation-config-property-value>1234</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>queueManager</activation-config-property-n
ame>
<activation-config-property-value>QM_EXAM_01</activation-config-property-va
lue>
</activation-config-property>
<!-- Props that create a JMS connection consumer -->
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-na
me>
<activation-config-property-value>MY.QUEUE</activation-config-property-valu
e>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>destinationType</activation-config-propert
y-name>
<activation-config-property-value>javax.jms.Queue</activation-config-proper
ty-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>maxPoolDepth</activation-config-property-n
ame>
<activation-config-property-value>100</activation-config-property-value>
</activation-config-property>
</activation-config>
</mdb-resource-adapter>
<resource-ref>
<!-- binds the ref to the actual jndi name,
they just happen to be the same, but they don't have
to be -->
<res-ref-name>jdbc/gAlerts</res-ref-name>
<jndi-name>jdbc/gAlerts</jndi-name>
</resource-ref>
<bean-pool>
<steady-pool-size>10</steady-pool-size>
<resize-quantity>2</resize-quantity>
<max-pool-size>100</max-pool-size>
<pool-idle-timeout-in-seconds>600</pool-idle-timeout-in-seconds>
</bean-pool>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
On 9/7/11 7:53 PM, "Cheng Fang" <cheng.fang_at_oracle.com> wrote:
>PostConstruct method is invoked when bean instances are created. It
>should not be invoked when servicing incoming messages. But it's
>possible your MDB is configured in a way that each incoming message
>causes a new instance to be created.
>
>-cheng
>
>On 9/7/11 7:35 PM, Jackson, Brian R. wrote:
>> I'm using Glassfish 2.1.1 and I've just profiled my app and see that
>> my @PostConstruct method appears to be called on every message rather
>> than when the MDB is created in the bean pool. Is this the expected
>> behavior? Have I configured or coded something incorrectly?
>
>Please consider the environment before printing this e-mail.