-
1. Re: MDB Topic/Queue definitions and deployment order
jaikiran Aug 26, 2009 10:39 AM (in response to thammoud)You can make the MDB depend on the queue/topic by using the @Depends. Here's an example from our EJB3 tutorials http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/docs/tutorial/mdb/src/org/jboss/tutorial/mdb/bean/ExampleMDB.java (Note, use the correct MBean name of the queue/topic in the @Depends)
-
2. Re: MDB Topic/Queue definitions and deployment order
thammoud Aug 26, 2009 10:46 AM (in response to thammoud)Thanks for the quick response. As we have about 100 MDB's, is there another global settings that we can specify? Thank you.
-
3. Re: MDB Topic/Queue definitions and deployment order
jaikiran Aug 26, 2009 10:49 AM (in response to thammoud)Unfortunately no, since it's a per MDB setting and each MDB might depend on a different queue.
-
4. Re: MDB Topic/Queue definitions and deployment order
dimitris Aug 26, 2009 10:52 AM (in response to thammoud)Couldn't he specify the order in the ear? (.sar to deploy before the ejb)
-
5. Re: MDB Topic/Queue definitions and deployment order
thammoud Aug 26, 2009 11:04 AM (in response to thammoud)Couldn't he specify the order in the ear? (.sar to deploy before the ejb)
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5"> <display-name>Financial Data Server</display-name> <module> <java>FinancialDataServer.sar</java> </module> <module> <ejb>FinancialDataServerEJB.jar</ejb> </module> </application>
What will consider the most straight forward method of achieving this? Again, thank for your help. -
6. Re: MDB Topic/Queue definitions and deployment order
jaikiran Aug 26, 2009 11:05 AM (in response to thammoud)Unfortunately, in AS-5, the ordering of modules (even when specified as strict) is broken https://jira.jboss.org/jira/browse/JBAS-7106
-
7. Re: MDB Topic/Queue definitions and deployment order
alesj Aug 26, 2009 11:11 AM (in response to thammoud)You can use jboss-structure.xml (http://www.jboss.org/community/docs/DOC-13178) to define module order.
-
8. Re: MDB Topic/Queue definitions and deployment order
thammoud Aug 26, 2009 11:17 AM (in response to thammoud)I added a depends to one of my MDB's and it still fails. This is what I did:
@MessageDriven(name="PositionMDB", activationConfig ={ @ActivationConfigProperty(propertyName ="destinationType", propertyValue="javax.jms.Topic"), @ActivationConfigProperty(propertyName ="Destination", propertyValue="topic/Position") },messageListenerInterface=MessageListener.class) @PoolClass(value = org.jboss.ejb3.StrictMaxPool.class, maxSize = 1) @Depends ("jboss.mq.destination:service=Topic,name=Position") public class PositionMDB implements MessageListener {
and this is how my topic is defined in the -service file:<mbean code="org.jboss.jms.server.destination.TopicService" name="jboss.messaging.destination:service=Topic,name=Position" xmbean-dd="xmdesc/Topic-xmbean.xml"> <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends> <depends>jboss.messaging:service=PostOffice</depends> </mbean>
and this is the error I get:10:09:14,944 WARN [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@290bcd0f(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@ab633cc destination=topic/Position destinationType=javax.jms.Topic tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5) javax.naming.NameNotFoundException: Position not bound
-
9. Re: MDB Topic/Queue definitions and deployment order
alesj Aug 26, 2009 11:22 AM (in response to thammoud)"alesj" wrote:
You can use jboss-structure.xml (http://www.jboss.org/community/docs/DOC-13178) to define module order.
But sometimes even this is not enough - as per how the new deployers work.
It's deploy per deployer all (sub)deployments.
e.g.
if you counted on sub-deployment ordering, w/o explicit dependencies
and some X real deployer is ordered before Y real deployer
where you have some component y present in your 1st subdeployment
on which x component in 2nd subdeployment depends on
X deployer would pick up x before Y would pick up y --> failure. -
10. Re: MDB Topic/Queue definitions and deployment order
jaikiran Aug 26, 2009 11:32 AM (in response to thammoud)As i said in my first reply, take extra care while specifying the MBean names on the @Depends :)
@Depends ("jboss.mq.destination:service=Topic,name=Position")
From what i see in your queue configuration, this should be:@Depends ("jboss.messaging.destination:service=Topic,name=Position")
-
11. Re: MDB Topic/Queue definitions and deployment order
thammoud Aug 26, 2009 1:57 PM (in response to thammoud)That works. Thank you very much.
-
12. Re: MDB Topic/Queue definitions and deployment order
thammoud Aug 26, 2009 7:00 PM (in response to thammoud)Maybe be I spoke too soon. I had a Topic entry in the /xxdestinations.xml file and that is why it worked.
So the topics are in a different file than the EJB jar. What I don't understand is why is it so difficult to find the "Normal" way of deploying these destinations in an ear file. This shouldn't be this difficult. Perhaps, I am missing something. If someone can please explain as to what is considered best practices for declaring destinations, I and certainly many other folks, would greatly appreciate it.
As for using the structure stuff for dependency, it just seemed overly complex for specifying the order of just two files. There must be a simpler way.
Any help or input will be greatly appreciated. Again, thank you all for your help. -
13. Re: MDB Topic/Queue definitions and deployment order
vickyk Aug 27, 2009 12:34 AM (in response to thammoud)"jaikiran" wrote:
Unfortunately, in AS-5, the ordering of modules (even when specified as strict) is broken https://jira.jboss.org/jira/browse/JBAS-7106
We should fix it, let me see if someone else is working on it or else I can take it. -
14. Re: MDB Topic/Queue definitions and deployment order
alesj Aug 27, 2009 10:00 AM (in response to thammoud)"vickyk" wrote:
"jaikiran" wrote:
Unfortunately, in AS-5, the ordering of modules (even when specified as strict) is broken https://jira.jboss.org/jira/browse/JBAS-7106
We should fix it, let me see if someone else is working on it or else I can take it.
It's assigned to me, but I'm not working on it (yet).
So, you're welcome to take it.