start at getting jms sca binding to use a native amq broker
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@705230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6109b6819a
commit
99a63d6cbe
4 changed files with 75 additions and 11 deletions
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.tuscany.sca.binding.sca.jms;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnection;
|
||||
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl;
|
||||
|
||||
public class AMQJMSResourceFactory extends JMSResourceFactoryImpl {
|
||||
|
||||
public AMQJMSResourceFactory(String connectionFactoryName, String initialContextFactoryName, String jndiURL) {
|
||||
super(connectionFactoryName, initialContextFactoryName, jndiURL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createConnection() throws NamingException, JMSException {
|
||||
super.createConnection();
|
||||
((ActiveMQConnection)connection).setWatchTopicAdvisories(false);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.apache.tuscany.sca.binding.sca.jms;
|
||||
|
||||
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
|
||||
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
|
||||
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
|
||||
|
||||
public class AMQResourceFactoryExtensionPoint implements JMSResourceFactoryExtensionPoint{
|
||||
|
||||
public JMSResourceFactory createJMSResourceFactory(JMSBinding binding) {
|
||||
return new AMQJMSResourceFactory(binding.getConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
|
||||
}
|
||||
|
||||
}
|
|
@ -19,9 +19,7 @@
|
|||
|
||||
package org.apache.tuscany.sca.binding.sca.jms;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.broker.TransportConnector;
|
||||
|
@ -40,7 +38,6 @@ public class JMSBroker implements ModuleActivator {
|
|||
|
||||
public void start(ExtensionPointRegistry arg0) {
|
||||
if (broker == null) {
|
||||
ps();
|
||||
broker = new BrokerService();
|
||||
broker.setPersistent(false);
|
||||
broker.setUseJmx(false);
|
||||
|
@ -71,11 +68,8 @@ public class JMSBroker implements ModuleActivator {
|
|||
}
|
||||
}
|
||||
|
||||
protected void ps() {
|
||||
URL ps = Thread.currentThread().getContextClassLoader().getResource("domain.properties");
|
||||
System.out.println("url " + ps);
|
||||
File f = new File("/domain.properties");
|
||||
System.out.println("f " + f.toURI());
|
||||
System.out.println("f " + f.exists());
|
||||
public static BrokerService getBroker() {
|
||||
return broker;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.tuscany.sca.binding.sca.jms;
|
|||
|
||||
import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
|
||||
import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
|
||||
import org.apache.tuscany.sca.binding.jms.provider.DefaultJMSResourceFactoryExtensionPoint;
|
||||
import org.apache.tuscany.sca.binding.jms.provider.JMSBindingReferenceBindingProvider;
|
||||
import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider;
|
||||
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
|
||||
|
@ -53,7 +52,7 @@ public class JMSSCABindingProviderFactory implements BindingProviderFactory<Dist
|
|||
assert workScheduler != null;
|
||||
jmsRFEP = (JMSResourceFactoryExtensionPoint)extensionPoints.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
|
||||
if (jmsRFEP == null) {
|
||||
jmsRFEP = new DefaultJMSResourceFactoryExtensionPoint();
|
||||
jmsRFEP = new AMQResourceFactoryExtensionPoint();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue