1 2 Previous Next 19 Replies Latest reply on Apr 24, 2009 2:38 AM by kconner

    JMS Listener Mapper and JCA activation

    kconner

      https://jira.jboss.org/jira/browse/JBESB-2538 raises an issue with the mapping of properties onto activation contexts, specifically maxSession but in reality a more general issue.

      The JMS listener mapper has an explicit binding between some of the properties in the configuration and those required for activating the JCA context and, at present, these are specific to JBoss.

      We need to generalise this behaviour now that we are working with other providers.

      The current properties specified are

      "destination" <- messageFilter.getDestName()
      "providerAdapterJNDI" <- jmsJcaProvider.getProviderAdapterJNDI()
      "destinationType" <- Queue.class.getName() or Topic.class.getName()
      "messageSelector", messageFilter.getSelector()
      "maxSession" <- listener.getMaxThreads()

      To solve this I am proposing to create an adapter interface, an implementation of which can be specified using the listener properties (no schema changes) with the default being the JBoss mappings.

      The implementation will probably look something like the following

      public interface ActivationAdapter
      {
       public void setDestination(final String name)
       throws ConfigurationException ;
      
       public void setProviderAdapterJNDI(final String providerAdapterJNDI)
       throws ConfigurationException ;
      
       // true for queue, false for topic
       public void setDestinationType(final boolean queue)
       throws ConfigurationException ;
      
       public void setMessageSelector(final String messageSelector)
       throws ConfigurationException ;
      
       public void setMaxThreads(final String maxThreads)
       throws ConfigurationException ;
      }
      

      Can anyone see anything I have missed? Any other suggestions?

      Thanks

      Kev

        • 1. Re: JMS Listener Mapper and JCA activation
          kconner

          Forgot to add the activation configuration element on those methods, so assume they would all take an additional parameter.

          • 2. Re: JMS Listener Mapper and JCA activation
            kconner

            Perhaps this is a more appropriate interface

            public interface ActivationAdapter
            {
             public void setDestination(final Map<String, String> activationConfig, final String name)
             throws ConfigurationException ;
            
             public void setProviderAdapterJNDI(final Map<String, String> activationConfig, final String providerAdapterJNDI)
             throws ConfigurationException ;
            
             // true for queue, false for topic
             public void setDestinationType(final Map<String, String> activationConfig, final boolean queue)
             throws ConfigurationException ;
            
             public void setMessageSelector(final Map<String, String> activationConfig, final String messageSelector)
             throws ConfigurationException ;
            
             public void setMaxThreads(final Map<String, String> activationConfig, final String maxThreads)
             throws ConfigurationException ;
            }
            


            • 3. Re: JMS Listener Mapper and JCA activation
              beve

              Looks good to me. Just really have question about where this is going to be used in the code.
              If I understood you correctly one will be able to specify a concrete impl of an ActivationAdapter in the listener configuration element as a property.
              Will this class be used in the JmsListenerMapper? Could you provide an example just so I can visualize it?


              Thanks,

              /Daniel

              • 4. Re: JMS Listener Mapper and JCA activation
                kconner

                Also, change the maxThreads to an Integer rather than a String.

                Sorry for rambling :)

                • 5. Re: JMS Listener Mapper and JCA activation
                  kconner

                   

                  "beve" wrote:
                  If I understood you correctly one will be able to specify a concrete impl of an ActivationAdapter in the listener configuration element as a property.
                  Will this class be used in the JmsListenerMapper? Could you provide an example just so I can visualize it?

                  Yes, this is intended to be used in the mapper and replace our explicit configuration.

                  At the moment we make invocations such as the following
                   addPropertyElement(activationConfigElement, "destination", messageFilter.getDestName()) ;
                  

                  So the intention would be to replace these with calls to the adapter, allowing us to map these attributes for different providers.

                  • 6. Re: JMS Listener Mapper and JCA activation
                    tfennelly

                    Hey guys... how about globally configuring the adapter classes based on the adapter name e.g. in the jbossesb-properties.xml? Would keep the .esb configs a bit cleaner perhaps.

                    The JmsListenerMapper might then look up the adapter something like:

                    String adapterClassName = ModulePropertyManager.getPropertyManager("jca.activation.adapters").getProperty(jmsJcaProvider.getAdapter());
                    


                    With the config file something like:

                    <properties name="jca.activation.adapters">
                     <property name="jms-ra.rar" value="org.jboss....JBossJmsJcaAdapter"/>
                     <property name="wmq.jmsra.rar" value="org.jboss....WMQJmsJcaAdapter"/>
                    </properties>
                    


                    • 7. Re: JMS Listener Mapper and JCA activation
                      tfennelly

                      Is the use of "Adapter" here not potentially confusing, since th .rar is an "Adapter" too? To me, this thing is performing a mapping operation, so how about "ActivationMapper"?

                      • 8. Re: JMS Listener Mapper and JCA activation
                        tfennelly

                        Sorry for drip feeding, but I just had another thought :)....

                        I wonder would it be possible to generalize the interface more? I'm thinking of a situation where the mapping for a particular adapter may need to perform other mappings outside the set layed down here.

                        If we could also extract the provider/listener config into a Map ala the activation config being mapped too, we could then do something like....

                        public interface ActivationAdapter
                        {
                         public void map(final Map<String, String> listenerConfig, final Map<String, String> activationConfig) throws ConfigurationException ;
                        }
                        


                        Just a thought!

                        • 9. Re: JMS Listener Mapper and JCA activation
                          kconner

                           

                          "tfennelly" wrote:
                          Hey guys... how about globally configuring the adapter classes based on the adapter name e.g. in the jbossesb-properties.xml? Would keep the .esb configs a bit cleaner perhaps.

                          Yeah, I was thinking about doing that as well and allowing a property to override it if necessary. The comment about the property was more to highlight the fact that we cannot change the schema for this.

                          • 10. Re: JMS Listener Mapper and JCA activation
                            kconner

                             

                            "tfennelly" wrote:
                            Is the use of "Adapter" here not potentially confusing, since th .rar is an "Adapter" too? To me, this thing is performing a mapping operation, so how about "ActivationMapper"?

                            I'm easy, either is good to me. Not sure it would be confusing though :)

                            • 11. Re: JMS Listener Mapper and JCA activation
                              tfennelly

                               

                              "Kevin.Conner@jboss.com" wrote:
                              "tfennelly" wrote:
                              Hey guys... how about globally configuring the adapter classes based on the adapter name e.g. in the jbossesb-properties.xml? Would keep the .esb configs a bit cleaner perhaps.

                              Yeah, I was thinking about doing that as well and allowing a property to override it if necessary.


                              Right... better again!!

                              • 12. Re: JMS Listener Mapper and JCA activation
                                kconner

                                 

                                "tfennelly" wrote:
                                I wonder would it be possible to generalize the interface more? I'm thinking of a situation where the mapping for a particular adapter may need to perform other mappings outside the set layed down here.

                                If we could also extract the provider/listener config into a Map ala the activation config being mapped too, we could then do something like.


                                I thought of that but we already have another mechanism for the 4.4/trunk to specify other activation properties. The purpose of this is just to map our overrides so I would be happier limiting the mapping to this.

                                Handling the 4.4/trunk extension within 4.2 is another issue, which I think is what you may be trying to address.

                                Kev

                                • 13. Re: JMS Listener Mapper and JCA activation
                                  kconner

                                   

                                  "tfennelly" wrote:
                                  Right... better again!!

                                  Well the property has to be included because the name of the rar means nothing. We can't rely on jbossesb-properties.xml for anything other than a few defaults as anyone can deploy any rar at any time.

                                  Kev

                                  • 14. Re: JMS Listener Mapper and JCA activation
                                    tfennelly

                                     

                                    "Kevin.Conner@jboss.com" wrote:
                                    "tfennelly" wrote:
                                    I wonder would it be possible to generalize the interface more? I'm thinking of a situation where the mapping for a particular adapter may need to perform other mappings outside the set layed down here.

                                    If we could also extract the provider/listener config into a Map ala the activation config being mapped too, we could then do something like.


                                    I thought of that but we already have another mechanism for the 4.4/trunk to specify other activation properties. The purpose of this is just to map our overrides so I would be happier limiting the mapping to this.


                                    That's true... forgot that... okidoki :)

                                    1 2 Previous Next