Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
Description
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
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; }