12 Replies Latest reply on Mar 9, 2010 11:32 AM by alesj

    Sub deployer not kicking in on CreateDestinationDeployer

    clebert.suconic
      I'm making a few changes on the the CreateDestinationDeployer. Instead of having the Deployer calling the Bean creations directly I'm having it to reuse another deployer.
        • 1. Re: Sub deployer not kicking in on CreateDestinationDeployer
          clebert.suconic

          I'm not sure what happened to my entire post... I have all the content but only the first paragraph appeared, and I can't edit the first post.

           

          At least I'm glad I had it on my copy&paste buffer. So, reposting it (sorry for the dup):

           

          I'm making a few changes on the the CreateDestinationDeployer. Instead of having the Deployer calling the Bean creations directly I'm having it to reuse another deployer.

           

          This deployer is currently using pluging to create a destination. I'm currently asking the plugins what outputs they are going to make. So when the plugin is added I'm basically calling addOutput as you can see at the source code:

           

          http://anonsvn.jboss.org/repos/jbossas/branches/Branch_Hornet_Temporary_2/server/src/main/java/org/jboss/ejb/deployers/CreateDestinationDeployer.java

           

           

           

          The plugin is loaded through the CreateDestination class:

           

          http://anonsvn.jboss.org/repos/jbossas/branches/Branch_Hornet_Temporary_2/server/src/main/java/org/jboss/ejb/deployers/CreateDestination.java

           


          CreateDestination is encapsulating the Factory usage:

           

          http://anonsvn.jboss.org/repos/jbossas/branches/Branch_Hornet_Temporary_2/server/src/main/java/org/jboss/ejb/deployers/CreateDestinationFactory.java

           

           

           

          I'm registering the output on DestinationFactoryDeployerPlugin using by doing:

           

          unit.getTransientManagedObjects().addAttachment(JMSConfiguration.class.getName(), config, JMSConfiguration.class);

           


          I had to add a hack on the deployer to make it work (by basically calling the deployer's directly) but I was expecting MC to handle the invocation for me. For some reason this is not working.

           

          I'm not sure what's going wrong.

           


          http://anonsvn.jboss.org/repos/jbossas/branches/Branch_Hornet_Temporary_2/hornetq-int/src/main/java/org/jboss/as/integration/hornetq/deployers/DestinationFactoryDeployerPlugin.java

           

           

           

          thanks for any help

          • 2. Re: Sub deployer not kicking in on CreateDestinationDeployer
            alesj

            How does your definition of CreateDestination look like?

            e.g. what is the CreateDestinationMatcher

             

            I think it's just the ordering problem.

            HornetQJMSRealDeployer must kick-in after CreateDestinationDeployer.

            Since CreateDestination' output is added runtime, perhaps DestinationFactoryDeployerPlugin is added too late?
            e.g. after your HornetQJMSRealDeployer is already added -- properly placed according to "stale" outputs.
            --> stale as in not "seeing" JMSConfiguration as CreateDestinationDeployer' output
            • 3. Re: Sub deployer not kicking in on CreateDestinationDeployer
              clebert.suconic

              I have tried adding a dependency on HornetQJMSRealDeployer to the HornetQDestinationCreator and it still didn't work.

               

               

                 <!-- Destination creator for HornetQ
                      This gets "automagically" injected into CreateDestinationDeployer Bean at ejb-deployer-jboss.xml through incallback and uncallback
                  -->
                 <bean name="HornetQDestinationCreator" class="org.jboss.ejb.deployers.CreateDestination">
                    <!-- We match any jms mdb that is going to be deployed using our rar -->
                    <property name="matcher">
                       <bean class="org.jboss.ejb.deployers.SimpleCreateDestinationMatcher">
                          <property name="default">true</property>
                          <property name="messageListener">javax.jms.MessageListener</property>
                          <property name="rarName">hornetq-ra.rar</property>
                       </bean>
                    </property>
                    <!-- Create a destination with HornetQ -->
                    <property name="factory">
                       <bean class="org.jboss.as.integration.hornetq.deployers.DestinationFactoryDeployerPlugin"/>
                    </property>
                 </bean>
              
                 <bean name="HornetQJMSRealDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQJMSRealDeployer">
                     <depends>HornetQDestinationCreator</depends>
                 </bean>
              
              
              

               


              I have also tried the opposite. having the DestinationCreator depending on the JMSRealDeployer, and still no luck.

               

               

              I'm basically adding the output class by using this method:

               

               

                    unit.getTransientManagedObjects().addAttachment(JMSConfiguration.class.getName(), config, JMSConfiguration.class);
              
               
              
              • 4. Re: Sub deployer not kicking in on CreateDestinationDeployer
                alesj

                I have tried adding a dependency on HornetQJMSRealDeployer to the HornetQDestinationCreator and it still didn't work.

                 

                 

                   <bean name="HornetQJMSRealDeployer" class="org.jboss.as.integration.hornetq.deployers.HornetQJMSRealDeployer">
                       <depends>HornetQDestinationCreator</depends>
                   </bean>
                

                You need demand, not depends.

                 

                Depends does this -- legacy style depends -- B depends on A:

                * B waits until A is created

                * A is created, now B can be created

                * B now waits until A is started

                * A is started, hence B can be as well

                 

                Where "demand" is simple one state dependency, by default in Installed.

                 

                In our case we need the A to be fully installed, since this is when it is automagically picked up and its output added to deployer.

                • 5. Re: Sub deployer not kicking in on CreateDestinationDeployer
                  clebert.suconic

                  I've added the demand as you said, but still not working.

                   

                   

                  I have also added logging to the constructors. The order is correct but it still doesn't work:

                   

                  9:55:32,048 INFO  [CreateDestinationDeployer] Adding output: org.hornetq.jms.server.config.JMSConfiguration

                  09:55:32,048 INFO  [CreateDestinationDeployer] Factory: org.jboss.as.integration.hornetq.deployers.DestinationFactoryDeployerPlugin

                  09:55:32,050 INFO  [HornetQJMSRealDeployer] Instantiating HornetQJMSRealDeployer

                   

                   

                  The CreateDestinationDeployer is instantiated first, the addOutput is done before and nothing happens.
                  I guess I will just make the CreateDestinationDeployer to create the Queue directly.
                  • 6. Re: Sub deployer not kicking in on CreateDestinationDeployer
                    alesj

                    Can you debug the order in which the deployers are executed for HQ-xml-files-containing deployment?

                    Is it HQJMSRealDeployer before CDDeployer?

                    • 7. Re: Sub deployer not kicking in on CreateDestinationDeployer
                      alesj

                      Another idea it comes to my mind is that prehaps new deployers sorting doesn't account for runtime addition of outputs?

                      * http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-impl/src/main/java/org/jboss/deployers/plugins/sort/SortedDeployers.java

                      • 8. Re: Sub deployer not kicking in on CreateDestinationDeployer
                        alesj

                        I've added additional input to your HQJMSRealDeployer:

                         

                        public class HornetQJMSRealDeployer extends AbstractSimpleRealDeployer<JMSConfiguration>
                        {
                           public HornetQJMSRealDeployer()
                           {
                              super(JMSConfiguration.class);
                              addInput(HornetQCoreDeployment.class);
                              addInput(JBossMetaData.class); // CreateDestinationDeployer has this as an output
                        

                         

                        Can you try it now?

                        • 9. Re: Sub deployer not kicking in on CreateDestinationDeployer
                          clebert.suconic

                          The CDDeployer is not used for HQ-xml files.

                           

                          That's only used when deploying a MDB containing queues. There's an option on the MDBContainer, to let it create destinations.

                           

                          I was putting CDDeployer to create the JMSConfiguration which is the input for the RealDeployer, and it is not kicking.

                           

                          the CreateDestinationDeployer is being instantiated before the HornetQJMSRealDeployer, as I have added some logging on it:

                           

                           

                          10:08:57,084 INFO  [CreateDestinationDeployer] Adding output: org.hornetq.jms.server.config.JMSConfiguration

                          10:08:57,084 INFO  [CreateDestinationDeployer] Factory: org.jboss.as.integration.hornetq.deployers.DestinationFactoryDeployerPlugin

                          10:08:57,086 INFO  [HornetQJMSRealDeployer] Instantiating HornetQJMSRealDeployer

                           

                          The last message is from HornetQJMSRealDeployer's contructor. What means the CreateDestinationDeployer is being instantiated first, and setting the output before HornetQJMSRealDeployer is created.
                          • 10. Re: Sub deployer not kicking in on CreateDestinationDeployer
                            clebert.suconic

                            Sweet! It works!

                             

                             

                            thanks a lot for the help!

                            • 11. Re: Sub deployer not kicking in on CreateDestinationDeployer
                              alesj
                              The last message is from HornetQJMSRealDeployer's contructor. What means the CreateDestinationDeployer is being instantiated first, and setting the output before HornetQJMSRealDeployer is created.

                              That's all nice and OK, but that's irrelevant information. ;-)

                               

                              The only thing that is relevant here is how they are ordered a the end -- once both are added to DeployersImpl bean.

                              • 12. Re: Sub deployer not kicking in on CreateDestinationDeployer
                                alesj

                                Sweet! It works!

                                This only hiddes the real problem --> runtime addition to CDD's outputs is ignored in new ordering.

                                 

                                I'll check how other sorting algorithms cope with this.