-
1. Re: Message Driven Beans reading messages before Application
hannwei Oct 13, 2006 12:46 AM (in response to rocky.alam)I face a similar problem. Sometimes, there are still messages in a queue when JBoss is shutdown intentionally for maintenance. During the next startup of JBoss, before all the EJBs are successfully deployed, the previously-queued messages have already started to be processed by the MDBs. As the processing of those queued messages requires the EJBs that are still being deployed, there are lots of NameNotFound exceptions and transaction rollbacks during JBoss startup.
Can JBoss be configured to start delivering queued messages to MDBs only after the complete startup of JBoss? This capability will help a lot by removing the tons of exceptions that are not supposed to happen.
By the way, I am using jboss-4.0.4.GA-Patch1.
Thanks.
Hann Wei -
2. Re: Message Driven Beans reading messages before Application
genman Oct 14, 2006 2:11 PM (in response to rocky.alam)
You can add to your MDB so they don't start too soon. Check out the DTD. -
3. Re: Message Driven Beans reading messages before Application
hannwei Oct 16, 2006 10:12 PM (in response to rocky.alam)"genman" wrote:
You can add <depends> to your MDB so they don't start too soon. Check out the DTD.
Thanks. Found the DeliveryActive tag in jboss_4_0.dtd.
I added it with the value "false" to server/default/conf/standardjboss.xml:<invoker-proxy-binding> <name>message-driven-bean</name> <invoker-mbean>default</invoker-mbean> <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory> <proxy-factory-config> <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI> <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI> <CreateJBossMQDestination>true</CreateJBossMQDestination> <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed --> <MinimumSize>1</MinimumSize> <MaximumSize>15</MaximumSize> <KeepAliveMillis>30000</KeepAliveMillis> <MaxMessages>1</MaxMessages> <MDBConfig> <ReconnectIntervalSec>10</ReconnectIntervalSec> <DeliveryActive>false</DeliveryActive> <DLQConfig> <DestinationQueue>queue/DLQ</DestinationQueue> <MaxTimesRedelivered>10</MaxTimesRedelivered> <TimeToLive>0</TimeToLive> </DLQConfig> </MDBConfig> </proxy-factory-config> </invoker-proxy-binding>
<invoker-proxy-binding> <name>singleton-message-driven-bean</name> <invoker-mbean>default</invoker-mbean> <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory> <proxy-factory-config> <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI> <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI> <CreateJBossMQDestination>true</CreateJBossMQDestination> <!-- WARN: Don't set this to zero until a bug in the pooled executor is fixed --> <MinimumSize>1</MinimumSize> <MaximumSize>1</MaximumSize> <KeepAliveMillis>30000</KeepAliveMillis> <MaxMessages>1</MaxMessages> <MDBConfig> <ReconnectIntervalSec>10</ReconnectIntervalSec> <DeliveryActive>false</DeliveryActive> <DLQConfig> <DestinationQueue>queue/DLQ</DestinationQueue> <MaxTimesRedelivered>10</MaxTimesRedelivered> <TimeToLive>0</TimeToLive> </DLQConfig> </MDBConfig> </proxy-factory-config> </invoker-proxy-binding>
However, after a restart of JBoss, when I looked at the JMX console through a browser, the StateString of MDBs is still "Started". The State value shown by the console is 3. I thought the "Started" value should appear only after I have pressed the Start() button on the browser.
They are ejb3 MDBs. Did I configure the DeliveryActive value at the right place? -
4. Re: Message Driven Beans reading messages before Application
genman Oct 17, 2006 3:54 PM (in response to rocky.alam)There should be a startDelivery and stopDelivery method someplace: http://docs.jboss.org/jbossas/getting_started/v4/html/mdb.html
-
5. Re: Message Driven Beans reading messages before Application
hannwei Oct 17, 2006 11:41 PM (in response to rocky.alam)"genman" wrote:
There should be a startDelivery and stopDelivery method someplace: http://docs.jboss.org/jbossas/getting_started/v4/html/mdb.html
Is the description at that URL up-to-date? I clicked the link:jboss.j2ee - ear=aps.ear,jar=aps-ejb.jar,name=LocalReplyMDB,service=EJB3
Then I was shown:... MBean Java Class: org.jboss.ejb3.ServiceDelegateWrapper ... List of MBean operations: void start() void create() void jbossInternalLifecycle() void stop() void destroy()
There wasn't an operation named startDelivery(). I searched the JBoss source code, and found the operation is defined only in the class:
http://fisheye.jboss.org/browse/JBoss/jboss/src/main/org/jboss/ejb/plugins/jms/JMSContainerInvoker.java?r=1.74
Just to show that LocalReplyMDB above is an MDB:@MessageDriven (activationConfig= { @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"), @ActivationConfigProperty(propertyName="destination", propertyValue="queue/aps/localReply") } ) public class LocalReplyMDB implements MessageListener {
Does it mean org.jboss.ejb3.ServiceDelegateWrapper used by the JMX console has erroneously left out startDelivery() and stopDelivery() when dealing with MDBs? -
6. Re: Message Driven Beans reading messages before Application
genman Oct 24, 2006 1:55 AM (in response to rocky.alam)http://jira.jboss.com/jira/browse/EJBTHREE-372
EJB3 issue I guess. -
7. Re: Message Driven Beans reading messages before Application
weston.price Oct 24, 2006 1:57 AM (in response to rocky.alam)Correct. These are features that are being carried over to the JMS/JCA adapter which is the default messaging provider for EJB3 after RC9.