cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r803689 - in /cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms: JMSConfiguration.java JMSDestination.java JMSFactory.java continuations/JMSContinuation.java continuations/JMSContinuationProvider.java
Date Wed, 12 Aug 2009 20:06:53 GMT
Author: dkulp
Date: Wed Aug 12 20:06:52 2009
New Revision: 803689

URL: http://svn.apache.org/viewvc?rev=803689&view=rev
Log:
Update JMS to allow injecting of custom JmsTemplate and
AbstractMessageLIstenerContainer objects

Modified:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=803689&r1=803688&r2=803689&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
Wed Aug 12 20:06:52 2009
@@ -28,6 +28,8 @@
 import org.springframework.core.task.TaskExecutor;
 import org.springframework.jms.connection.SingleConnectionFactory;
 import org.springframework.jms.connection.SingleConnectionFactory102;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
 import org.springframework.jms.support.destination.DestinationResolver;
 import org.springframework.jndi.JndiTemplate;
 import org.springframework.transaction.PlatformTransactionManager;
@@ -42,7 +44,10 @@
     static final boolean DEFAULT_USEJMS11 = true;
     
     private boolean usingEndpointInfo = true;
-
+    
+    private JmsTemplate jmsTemplate;
+    private AbstractMessageListenerContainer messageListenerContainer;
+    
     private JndiTemplate jndiTemplate;
     private ConnectionFactory connectionFactory;
     private DestinationResolver destinationResolver;
@@ -494,4 +499,20 @@
     public boolean isSetEnforceSpec() {
         return this.enforceSpec != null;
     }
+
+    public void setJmsTemplate(JmsTemplate jmsTemplate) {
+        this.jmsTemplate = jmsTemplate;
+    }
+
+    public JmsTemplate getJmsTemplate() {
+        return jmsTemplate;
+    }
+
+    public AbstractMessageListenerContainer getMessageListenerContainer() {
+        return messageListenerContainer;
+    }
+
+    public void setMessageListenerContainer(AbstractMessageListenerContainer messageListenerContainer)
{
+        this.messageListenerContainer = messageListenerContainer;
+    }
 }

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=803689&r1=803688&r2=803689&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Wed Aug 12 20:06:52 2009
@@ -61,7 +61,7 @@
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.core.MessageCreator;
 import org.springframework.jms.core.SessionCallback;
-import org.springframework.jms.listener.DefaultMessageListenerContainer;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
 import org.springframework.jms.support.JmsUtils;
 import org.springframework.jms.support.destination.DestinationResolver;
 
@@ -73,7 +73,7 @@
     private JMSConfiguration jmsConfig;
     private Bus bus;
     private EndpointInfo ei;
-    private DefaultMessageListenerContainer jmsListener;
+    private AbstractMessageListenerContainer jmsListener;
     private Collection<JMSContinuation> continuations = 
         new ConcurrentLinkedQueue<JMSContinuation>();
 

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java?rev=803689&r1=803688&r2=803689&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
Wed Aug 12 20:06:52 2009
@@ -36,6 +36,7 @@
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.core.JmsTemplate102;
 import org.springframework.jms.core.SessionCallback;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
 import org.springframework.jms.listener.DefaultMessageListenerContainer;
 import org.springframework.jms.listener.DefaultMessageListenerContainer102;
 import org.springframework.jms.support.destination.DestinationResolver;
@@ -93,6 +94,9 @@
      */
     public static JmsTemplate createJmsTemplate(JMSConfiguration jmsConfig,
                                                 JMSMessageHeadersType messageProperties)
{
+        if (jmsConfig.getJmsTemplate() != null) {
+            return jmsConfig.getJmsTemplate();
+        }
         JmsTemplate jmsTemplate = jmsConfig.isUseJms11() ? new JmsTemplate() : new JmsTemplate102();
         jmsTemplate.setConnectionFactory(jmsConfig.getOrCreateWrappedConnectionFactory());
         jmsTemplate.setPubSubDomain(jmsConfig.isPubSubDomain());
@@ -125,10 +129,13 @@
      * @param destinationName null for temp dest or a destination name
      * @return
      */
-    public static DefaultMessageListenerContainer createJmsListener(EndpointInfo ei,
+    public static AbstractMessageListenerContainer createJmsListener(EndpointInfo ei,
                                                                     JMSConfiguration jmsConfig,
                                                                     MessageListener listenerHandler,
                                                                     String destinationName)
{
+        if (jmsConfig.getMessageListenerContainer() != null) {
+            return jmsConfig.getMessageListenerContainer();
+        }
         DefaultMessageListenerContainer jmsListener = null;
         
         if (jmsConfig.isUseJms11()) {
@@ -165,7 +172,7 @@
         
         jmsListener.setConnectionFactory(jmsConfig.getOrCreateWrappedConnectionFactory());
         jmsListener.setMessageSelector(jmsConfig.getMessageSelector());
-        //jmsListener.setSubscriptionDurable(jmsConfig.isSubscriptionDurable());
+        jmsListener.setSubscriptionDurable(jmsConfig.isSubscriptionDurable());
         jmsListener.setDurableSubscriptionName(jmsConfig.getDurableSubscriptionName());
         jmsListener.setSessionTransacted(jmsConfig.isSessionTransacted());
         jmsListener.setTransactionManager(jmsConfig.getTransactionManager());

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java?rev=803689&r1=803688&r2=803689&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
Wed Aug 12 20:06:52 2009
@@ -30,6 +30,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.jms.JMSConfiguration;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
 import org.springframework.jms.listener.DefaultMessageListenerContainer;
 
 public class JMSContinuation implements Continuation {
@@ -38,7 +39,7 @@
     private Message inMessage;
     private MessageObserver incomingObserver;
     private Collection<JMSContinuation> continuations;
-    private DefaultMessageListenerContainer jmsListener;
+    private AbstractMessageListenerContainer jmsListener;
     private JMSConfiguration jmsConfig;
     
     private Object userObject;
@@ -50,7 +51,7 @@
     
     public JMSContinuation(Bus b, Message m, MessageObserver observer,
                            Collection<JMSContinuation> cList, 
-                           DefaultMessageListenerContainer jmsListener,
+                           AbstractMessageListenerContainer jmsListener,
                            JMSConfiguration jmsConfig) {
         bus = b;
         inMessage = m;    
@@ -151,7 +152,9 @@
     protected void updateContinuations(boolean remove) {
 
         if (jmsConfig.getMaxSuspendedContinuations() < 0
-            || jmsListener.getCacheLevel() >= DefaultMessageListenerContainer.CACHE_CONSUMER)
{
+            || (jmsListener instanceof DefaultMessageListenerContainer
+                && ((DefaultMessageListenerContainer)jmsListener).getCacheLevel()

+                    >= DefaultMessageListenerContainer.CACHE_CONSUMER)) {
             modifyList(remove);
             return;
         }

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java?rev=803689&r1=803688&r2=803689&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuationProvider.java
Wed Aug 12 20:06:52 2009
@@ -27,7 +27,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.transport.MessageObserver;
 import org.apache.cxf.transport.jms.JMSConfiguration;
-import org.springframework.jms.listener.DefaultMessageListenerContainer;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
 
 public class JMSContinuationProvider implements ContinuationProvider {
 
@@ -35,14 +35,14 @@
     private Message inMessage;
     private MessageObserver incomingObserver;
     private Collection<JMSContinuation> continuations;
-    private DefaultMessageListenerContainer jmsListener;
+    private AbstractMessageListenerContainer jmsListener;
     private JMSConfiguration jmsConfig;
     
     public JMSContinuationProvider(Bus b,
                                    Message m, 
                                    MessageObserver observer,
                                    Collection<JMSContinuation> cList,
-                                   DefaultMessageListenerContainer jmsListener,
+                                   AbstractMessageListenerContainer jmsListener,
                                    JMSConfiguration jmsConfig) {
         bus = b;
         inMessage = m;    



Mime
View raw message