activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r366161 - /incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
Date Thu, 05 Jan 2006 11:14:42 GMT
Author: jstrachan
Date: Thu Jan  5 03:14:38 2006
New Revision: 366161

URL: http://svn.apache.org/viewcvs?rev=366161&view=rev
Log:
fix for AMQ-348 to allow a ConnectionFactory to be specified so it can be shared across inbound
and outputbound messaging

Modified:
    incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java

Modified: incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java?rev=366161&r1=366160&r2=366161&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
(original)
+++ incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
Thu Jan  5 03:14:38 2006
@@ -57,6 +57,7 @@
     private BootstrapContext bootstrapContext;
     private String brokerXmlConfig;
     private BrokerService broker;
+    private ActiveMQConnectionFactory connectionFactory;
 
     public ActiveMQResourceAdapter() {
     }
@@ -77,7 +78,12 @@
     }
 
     public ActiveMQConnection makeConnection() throws JMSException {
-        return makeConnection(info);
+        if (connectionFactory != null) {
+            return makeConnection(info, connectionFactory);
+        }
+        else {
+            return makeConnection(info);
+        }
     }
     
     /**
@@ -85,6 +91,10 @@
     public ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info) throws JMSException
{
 
         ActiveMQConnectionFactory connectionFactory = createConnectionFactory(info);
+        return makeConnection(info, connectionFactory);
+    }
+
+    public ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info, ActiveMQConnectionFactory
connectionFactory) throws JMSException {
         String userName = info.getUserName();
         String password = info.getPassword();
         ActiveMQConnection physicalConnection = (ActiveMQConnection) connectionFactory.createConnection(userName,
password);
@@ -457,6 +467,19 @@
 
     public void setUseInboundSession(Boolean useInboundSession) {
         info.setUseInboundSession(useInboundSession);
+    }
+
+    public ActiveMQConnectionFactory getConnectionFactory() {
+        return connectionFactory;
+    }
+
+    /**
+     * This allows a connection factory to be configured and shared between a ResourceAdaptor
and outbound messaging.
+     * Note that setting the connectionFactory will overload many of the properties on this
POJO such as the redelivery
+     * and prefetch policies; the properties on the connectionFactory will be used instead.
+     */
+    public void setConnectionFactory(ActiveMQConnectionFactory connectionFactory) {
+        this.connectionFactory = connectionFactory;
     }
 
 



Mime
View raw message