Support to fully plugin host-jms module 
----------------------------------------

                 Key: TUSCANY-2918
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2918
             Project: Tuscany
          Issue Type: Bug
            Reporter: Rashmi Hunt


In order for host-jms module to support clean plugin for different JMS 
listeners, these  changes are needed in current Tuscany code

1) JMSBindingServiceBindingProvider.start()  function should remove below line, 
            MessageListener listener = new RRBJMSBindingListener(jmsBinding, 
jmsResourceFactory, service, targetBinding, messageFactory); 

RRBJMSBindingListener is Tuscany specific listener and  this line will not 
allow user to plugin a different JMS listener.
Instead, code should instantiate in JMSServiceListener implementation's 
constructor which is constructor of ASFListener.

Code in JMSBindingServiceBindingProvider.start() method should be,

        public void start() {
                try {
        
                    this.serviceListener = 
serviceListenerFactory.createJMSServiceListener(this);  //pass current instance 
of JMSBindingServiceBindingProvider
            serviceListener.start();

                } catch (Exception e) {
                throw new JMSBindingException("Error starting 
JMSServiceBinding", e);
                }
    }

}

2) Tuscany should change JMSServiceListenerFactory.createJMSServiceListener()  
method declaration to below method,  which just passes 
JMSBindingServiceBindingProvider
as parameter.

        public JMSServiceListener 
createJMSServiceListener(JMSBindingServiceBindingProvider service) ; 

The reason for this is, current code passes serviceName, isCallbackService, 
jmsBinding & listener as params for JMSServiceListenerFactory which are 
very specific for RRBJMSBindingListener, but not useful for different JMS 
listener frameworks. If Tuscany passes instance of 
JMSBindingServiceBindingProvider
it gives full flexibility for the listener frameworks to extract what they need 
from this class.

Once above signature is modified, Tuscany can pass the 
JMSBindingServiceBindingProvider to JMSListener constructor and create the 
RRBJMSBindingListener in JMSListener contsructor
as below,

    public ASFListener(JMSBindingServiceBindingProvider service) {
        this.service = service;  //pass JMSBindingServiceBindingProvider  
instance all the way here so that every listener implementation will have full 
flexibility
        
        this.listener = new RRBJMSBindingListener(service.getJMSBinding(), 
service.getJMSResourceFactory(), service.getService(), 
service.getTargetBinding(), service.getMessageFactory());

       ... //do whatever else needed for specific listener frameworks
   
    }

3) Add these getter methods to JMSBindingServiceBindingProvider class, so that 
listener frameworks can extract what they need.

    public JMSBinding getBinding(){
        return jmsBinding;
    }

    public Binding getTargetBinding(){
        return targetBinding;
    }

    public  RuntimeComponentService getService(){
        return this.service;
    }

    public  RuntimeComponent getComponent(){
        return this.component;
    }

    public  MessageFactory getMessageFactory(){
        return this.messageFactory;
    }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to