activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r523430 - in /activemq/camel/trunk: ./ camel-jms/ camel-jms/src/main/java/org/apache/camel/component/jms/ camel-jms/src/test/java/org/apache/camel/component/jms/
Date Wed, 28 Mar 2007 18:16:53 GMT
Author: jstrachan
Date: Wed Mar 28 11:16:48 2007
New Revision: 523430

URL: http://svn.apache.org/viewvc?view=rev&rev=523430
Log:
upgraded to spring 2.0.3 and tidied up the JMS endpoints so that they can configure the JmsTemplate
/ MessageListenerContainer objects from Spring

Added:
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
  (with props)
Modified:
    activemq/camel/trunk/camel-jms/pom.xml
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
    activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
    activemq/camel/trunk/pom.xml

Modified: activemq/camel/trunk/camel-jms/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/pom.xml?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/pom.xml (original)
+++ activemq/camel/trunk/camel-jms/pom.xml Wed Mar 28 11:16:48 2007
@@ -40,6 +40,11 @@
     </dependency>
 
     <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
     </dependency>
@@ -50,24 +55,28 @@
     </dependency>
 
     <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>apache-activemq</artifactId>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
       <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
       <optional>true</optional>
     </dependency>
+
     <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
-      <optional>true</optional>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apache-activemq</artifactId>
+      <scope>test</scope>
     </dependency>
+    <!--
+        <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
+          <scope>test</scope>
+        </dependency>
+    -->
 
     <dependency>
       <groupId>junit</groupId>

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java
Wed Mar 28 11:16:48 2007
@@ -22,12 +22,8 @@
 import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.util.ObjectHelper;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.listener.AbstractMessageListenerContainer;
-import org.springframework.jms.listener.DefaultMessageListenerContainer;
 
 import javax.jms.ConnectionFactory;
-import javax.jms.Session;
 
 /**
  * @version $Revision:520964 $
@@ -35,7 +31,7 @@
 public class JmsComponent extends DefaultComponent<JmsExchange> {
     public static final String QUEUE_PREFIX = "queue/";
     public static final String TOPIC_PREFIX = "topic/";
-    private JmsTemplate template;
+    private JmsConfiguration configuration;
 
     /**
      * Static builder method
@@ -47,38 +43,38 @@
     /**
      * Static builder method
      */
-    public static JmsComponent jmsComponent(JmsTemplate template) {
-        return new JmsComponent(template);
+    public static JmsComponent jmsComponent(JmsConfiguration configuration) {
+        return new JmsComponent(configuration);
     }
 
     /**
      * Static builder method
      */
     public static JmsComponent jmsComponent(ConnectionFactory connectionFactory) {
-        return jmsComponent(new JmsTemplate(connectionFactory));
+        return jmsComponent(new JmsConfiguration(connectionFactory));
     }
 
     /**
      * Static builder method
      */
     public static JmsComponent jmsComponentClientAcknowledge(ConnectionFactory connectionFactory)
{
-        JmsTemplate template = new JmsTemplate(connectionFactory);
-        template.setSessionTransacted(false);
-        template.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
+        JmsConfiguration template = new JmsConfiguration(connectionFactory);
+        template.setProducerAcknowledgementMode("CLIENT_ACKNOWLEDGE");
+        template.setConsumerAcknowledgementMode("CLIENT_ACKNOWLEDGE");
         return jmsComponent(template);
     }
 
     protected JmsComponent() {
-        this.template = new JmsTemplate();
+        this.configuration = new JmsConfiguration();
     }
 
-    protected JmsComponent(JmsTemplate template) {
-        this.template = template;
+    public JmsComponent(JmsConfiguration configuration) {
+        this.configuration = configuration;
     }
 
     public JmsComponent(CamelContext context) {
         super(context);
-        this.template = new JmsTemplate();
+        this.configuration = new JmsConfiguration();
     }
 
     public JmsEndpoint createEndpoint(Uri uri) {
@@ -91,17 +87,17 @@
     public JmsEndpoint createEndpoint(String uri, String path) {
         ObjectHelper.notNull(getContext(), "container");
 
+        boolean pubSubDomain = false;
         if (path.startsWith(QUEUE_PREFIX)) {
-            template.setPubSubDomain(false);
+            pubSubDomain = false;
             path = path.substring(QUEUE_PREFIX.length());
         }
         else if (path.startsWith(TOPIC_PREFIX)) {
-            template.setPubSubDomain(false);
+            pubSubDomain = true;
             path = path.substring(TOPIC_PREFIX.length());
         }
 
         final String subject = convertPathToActualDestination(path);
-        template.setDefaultDestinationName(subject);
 
         /*
         Destination destination = (Destination) template.execute(new SessionCallback() {
@@ -111,15 +107,21 @@
         });
         */
 
-        return new JmsEndpoint(uri, getContext(), subject, template);
+        // TODO configure endpoint configuration and selector using URI properties
+        return new JmsEndpoint(uri, getContext(), subject, pubSubDomain, getConfiguration().copy());
     }
 
-    public JmsTemplate getTemplate() {
-        return template;
+    public JmsConfiguration getConfiguration() {
+        return configuration;
     }
 
-    public void setTemplate(JmsTemplate template) {
-        this.template = template;
+    /**
+     * Sets the JMS configuration
+     *
+     * @param configuration the configuration to use by default for endpoints
+     */
+    public void setConfiguration(JmsConfiguration configuration) {
+        this.configuration = configuration;
     }
 
     /**

Added: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java?view=auto&rev=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
(added)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
Wed Mar 28 11:16:48 2007
@@ -0,0 +1,512 @@
+/**
+ *
+ * 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.camel.component.jms;
+
+import org.apache.camel.RuntimeCamelException;
+import org.springframework.core.task.TaskExecutor;
+import org.springframework.jms.core.JmsOperations;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.JmsTemplate102;
+import org.springframework.jms.listener.AbstractMessageListenerContainer;
+import org.springframework.jms.listener.DefaultMessageListenerContainer;
+import org.springframework.jms.listener.SimpleMessageListenerContainer;
+import org.springframework.jms.listener.serversession.ServerSessionFactory;
+import org.springframework.jms.listener.serversession.ServerSessionMessageListenerContainer;
+import org.springframework.jms.support.converter.MessageConverter;
+import org.springframework.transaction.PlatformTransactionManager;
+
+import javax.jms.ConnectionFactory;
+import javax.jms.ExceptionListener;
+
+/**
+ * @version $Revision$
+ */
+public class JmsConfiguration implements Cloneable {
+    protected static final String TRANSACTED = "TRANSACTED";
+    private ConnectionFactory connectionFactory;
+    private ConnectionFactory producerConnectionFactory;
+    private boolean useVersion102;
+    private boolean autoStartup;
+    private boolean acceptMessagesWhileStopping;
+    private String consumerClientId;
+    private String durableSubscriptionName;
+    private ExceptionListener exceptionListener;
+    private String producerAcknowledgementMode = TRANSACTED;
+    private boolean subscriptionDurable;
+    private String consumerAcknowledgementMode = TRANSACTED;
+    private boolean exposeListenerSession;
+    // not used for ServerSessionMessageListenerContainer 
+    private TaskExecutor taskExecutor;
+    // SimpleMessageListenerContainer only
+    private boolean pubSubNoLocal;
+    // not used for ServerSessionMessageListenerContainer
+    private int concurrentConsumers = -1;
+    // not used for SimpleMessageListenerContainer
+    private int maxMessagesPerTask = -1;
+    // ServerSessionMessageListenerContainer only
+    private ServerSessionFactory serverSessionFactory;
+    //  DefaultMessageListenerContainer only
+    private int cacheLevel = -1;
+    private String cacheName;
+    private long recoveryInterval = -1;
+    private long receiveTimeout = -1;
+    private PlatformTransactionManager transactionManager;
+    private String transactionName;
+    private int transactionTimeout = -1;
+    private int idleTaskExecutionLimit = -1;
+    private int maxConcurrentConsumers = -1;
+    // JmsTemplate only
+    private boolean explicitQosEnabled;
+    private boolean deliveryPersistent = true;
+    private long timeToLive = -1;
+    private MessageConverter messageConverter;
+    private boolean messageIdEnabled = true;
+    private boolean messageTimestampEnabled;
+    private int priority = -1;
+
+    public JmsConfiguration() {
+    }
+
+    public JmsConfiguration(ConnectionFactory connectionFactory) {
+        this.connectionFactory = connectionFactory;
+    }
+
+    /**
+     * Returns a copy of this configuration
+     */
+    public JmsConfiguration copy() {
+        try {
+            return (JmsConfiguration) clone();
+        }
+        catch (CloneNotSupportedException e) {
+            throw new RuntimeCamelException(e);
+        }
+    }
+
+    public JmsOperations createJmsOperations(boolean pubSubDomain, String destination) {
+        JmsTemplate template = useVersion102
+                ? new JmsTemplate102(getProducerConnectionFactory(), pubSubDomain)
+                : new JmsTemplate(getProducerConnectionFactory());
+        template.setPubSubDomain(pubSubDomain);
+        template.setDefaultDestinationName(destination);
+
+        template.setExplicitQosEnabled(explicitQosEnabled);
+        template.setDeliveryPersistent(deliveryPersistent);
+        if (messageConverter != null) {
+            template.setMessageConverter(messageConverter);
+        }
+        template.setMessageIdEnabled(messageIdEnabled);
+        template.setMessageTimestampEnabled(messageTimestampEnabled);
+        if (priority >= 0) {
+            template.setPriority(priority);
+        }
+        template.setPubSubNoLocal(pubSubNoLocal);
+        if (receiveTimeout >= 0) {
+            template.setReceiveTimeout(receiveTimeout);
+        }
+        if (timeToLive >= 0) {
+            template.setTimeToLive(timeToLive);
+        }
+
+        boolean transacted = TRANSACTED.equals(producerAcknowledgementMode);
+        template.setSessionTransacted(transacted);
+        if (!transacted) {
+            // TODO not sure if Spring can handle TRANSACTED as an ack mode
+            template.setSessionAcknowledgeModeName(producerAcknowledgementMode);
+        }
+        return template;
+    }
+
+    public AbstractMessageListenerContainer createMessageListenerContainer() {
+        AbstractMessageListenerContainer container = chooseMessageListenerContainerImplementation();
+        configureMessageListenerContainer(container);
+        return container;
+    }
+
+    protected void configureMessageListenerContainer(AbstractMessageListenerContainer container)
{
+        container.setConnectionFactory(getConnectionFactory());
+        if (autoStartup) {
+            container.setAutoStartup(true);
+        }
+        if (consumerClientId != null) {
+            container.setClientId(consumerClientId);
+        }
+        if (durableSubscriptionName != null) {
+            container.setDurableSubscriptionName(durableSubscriptionName);
+        }
+        if (exceptionListener != null) {
+            container.setExceptionListener(exceptionListener);
+        }
+        container.setAcceptMessagesWhileStopping(acceptMessagesWhileStopping);
+        container.setExposeListenerSession(exposeListenerSession);
+        boolean transacted = TRANSACTED.equals(consumerAcknowledgementMode);
+        container.setSessionTransacted(transacted);
+        if (!transacted) {
+            // TODO not sure if Spring can handle TRANSACTED as an ack mode
+            container.setSessionAcknowledgeModeName(consumerAcknowledgementMode);
+        }
+        container.setSubscriptionDurable(subscriptionDurable);
+
+        if (container instanceof DefaultMessageListenerContainer) {
+            // this includes DefaultMessageListenerContainer102
+            DefaultMessageListenerContainer listenerContainer = (DefaultMessageListenerContainer)
container;
+            if (concurrentConsumers >= 0) {
+                listenerContainer.setConcurrentConsumers(concurrentConsumers);
+            }
+            if (cacheLevel >= 0) {
+                listenerContainer.setCacheLevel(cacheLevel);
+            }
+            if (cacheName != null) {
+                listenerContainer.setCacheLevelName(cacheName);
+            }
+            if (idleTaskExecutionLimit >= 0) {
+                listenerContainer.setIdleTaskExecutionLimit(idleTaskExecutionLimit);
+            }
+            if (maxConcurrentConsumers >= 0) {
+                listenerContainer.setMaxConcurrentConsumers(maxConcurrentConsumers);
+            }
+            if (maxMessagesPerTask >= 0) {
+                listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
+            }
+            listenerContainer.setPubSubNoLocal(pubSubNoLocal);
+            if (receiveTimeout >= 0) {
+                listenerContainer.setReceiveTimeout(receiveTimeout);
+            }
+            if (recoveryInterval >= 0) {
+                listenerContainer.setRecoveryInterval(recoveryInterval);
+            }
+            if (taskExecutor != null) {
+                listenerContainer.setTaskExecutor(taskExecutor);
+            }
+            if (transactionManager != null) {
+                listenerContainer.setTransactionManager(transactionManager);
+            }
+            if (transactionName != null) {
+                listenerContainer.setTransactionName(transactionName);
+            }
+            if (transactionTimeout >= 0) {
+                listenerContainer.setTransactionTimeout(transactionTimeout);
+            }
+        }
+        else if (container instanceof ServerSessionMessageListenerContainer) {
+            // this includes ServerSessionMessageListenerContainer102
+            ServerSessionMessageListenerContainer listenerContainer = (ServerSessionMessageListenerContainer)
container;
+            if (maxMessagesPerTask >= 0) {
+                listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
+            }
+            if (serverSessionFactory != null) {
+                listenerContainer.setServerSessionFactory(serverSessionFactory);
+            }
+        }
+        else if (container instanceof SimpleMessageListenerContainer) {
+            // this includes SimpleMessageListenerContainer102
+            SimpleMessageListenerContainer listenerContainer = (SimpleMessageListenerContainer)
container;
+            if (concurrentConsumers >= 0) {
+                listenerContainer.setConcurrentConsumers(concurrentConsumers);
+            }
+            listenerContainer.setPubSubNoLocal(pubSubNoLocal);
+            if (taskExecutor != null) {
+                listenerContainer.setTaskExecutor(taskExecutor);
+            }
+        }
+    }
+
+    // Properties
+    //-------------------------------------------------------------------------
+    public ConnectionFactory getConnectionFactory() {
+        return connectionFactory;
+    }
+
+    public void setConnectionFactory(ConnectionFactory connectionFactory) {
+        this.connectionFactory = connectionFactory;
+    }
+
+    public ConnectionFactory getProducerConnectionFactory() {
+        if (producerConnectionFactory == null) {
+            return getConnectionFactory();
+        }
+        return producerConnectionFactory;
+    }
+
+    /**
+     * Allows the connection factory for the producer side (sending) to be different from
the connection factory used for consuming.
+     * By default the {@link #getConnectionFactory()} will be used for both.
+     *
+     * @param producerConnectionFactory the connection factory to be used for sending.
+     */
+    public void setProducerConnectionFactory(ConnectionFactory producerConnectionFactory)
{
+        this.producerConnectionFactory = producerConnectionFactory;
+    }
+
+    public boolean isUseVersion102() {
+        return useVersion102;
+    }
+
+    public void setUseVersion102(boolean useVersion102) {
+        this.useVersion102 = useVersion102;
+    }
+
+    public boolean isAutoStartup() {
+        return autoStartup;
+    }
+
+    public void setAutoStartup(boolean autoStartup) {
+        this.autoStartup = autoStartup;
+    }
+
+    public boolean isAcceptMessagesWhileStopping() {
+        return acceptMessagesWhileStopping;
+    }
+
+    public void setAcceptMessagesWhileStopping(boolean acceptMessagesWhileStopping) {
+        this.acceptMessagesWhileStopping = acceptMessagesWhileStopping;
+    }
+
+    public String getConsumerClientId() {
+        return consumerClientId;
+    }
+
+    public void setConsumerClientId(String consumerClientId) {
+        this.consumerClientId = consumerClientId;
+    }
+
+    public String getDurableSubscriptionName() {
+        return durableSubscriptionName;
+    }
+
+    public void setDurableSubscriptionName(String durableSubscriptionName) {
+        this.durableSubscriptionName = durableSubscriptionName;
+    }
+
+    public ExceptionListener getExceptionListener() {
+        return exceptionListener;
+    }
+
+    public void setExceptionListener(ExceptionListener exceptionListener) {
+        this.exceptionListener = exceptionListener;
+    }
+
+    public String getProducerAcknowledgementMode() {
+        return producerAcknowledgementMode;
+    }
+
+    public void setProducerAcknowledgementMode(String producerAcknowledgementMode) {
+        this.producerAcknowledgementMode = producerAcknowledgementMode;
+    }
+
+    public boolean isSubscriptionDurable() {
+        return subscriptionDurable;
+    }
+
+    public void setSubscriptionDurable(boolean subscriptionDurable) {
+        this.subscriptionDurable = subscriptionDurable;
+    }
+
+    public String getConsumerAcknowledgementMode() {
+        return consumerAcknowledgementMode;
+    }
+
+    public void setConsumerAcknowledgementMode(String consumerAcknowledgementMode) {
+        this.consumerAcknowledgementMode = consumerAcknowledgementMode;
+    }
+
+    public boolean isExposeListenerSession() {
+        return exposeListenerSession;
+    }
+
+    public void setExposeListenerSession(boolean exposeListenerSession) {
+        this.exposeListenerSession = exposeListenerSession;
+    }
+
+    public TaskExecutor getTaskExecutor() {
+        return taskExecutor;
+    }
+
+    public void setTaskExecutor(TaskExecutor taskExecutor) {
+        this.taskExecutor = taskExecutor;
+    }
+
+    public boolean isPubSubNoLocal() {
+        return pubSubNoLocal;
+    }
+
+    public void setPubSubNoLocal(boolean pubSubNoLocal) {
+        this.pubSubNoLocal = pubSubNoLocal;
+    }
+
+    public int getConcurrentConsumers() {
+        return concurrentConsumers;
+    }
+
+    public void setConcurrentConsumers(int concurrentConsumers) {
+        this.concurrentConsumers = concurrentConsumers;
+    }
+
+    public int getMaxMessagesPerTask() {
+        return maxMessagesPerTask;
+    }
+
+    public void setMaxMessagesPerTask(int maxMessagesPerTask) {
+        this.maxMessagesPerTask = maxMessagesPerTask;
+    }
+
+    public ServerSessionFactory getServerSessionFactory() {
+        return serverSessionFactory;
+    }
+
+    public void setServerSessionFactory(ServerSessionFactory serverSessionFactory) {
+        this.serverSessionFactory = serverSessionFactory;
+    }
+
+    public int getCacheLevel() {
+        return cacheLevel;
+    }
+
+    public void setCacheLevel(int cacheLevel) {
+        this.cacheLevel = cacheLevel;
+    }
+
+    public String getCacheName() {
+        return cacheName;
+    }
+
+    public void setCacheName(String cacheName) {
+        this.cacheName = cacheName;
+    }
+
+    public long getRecoveryInterval() {
+        return recoveryInterval;
+    }
+
+    public void setRecoveryInterval(long recoveryInterval) {
+        this.recoveryInterval = recoveryInterval;
+    }
+
+    public long getReceiveTimeout() {
+        return receiveTimeout;
+    }
+
+    public void setReceiveTimeout(long receiveTimeout) {
+        this.receiveTimeout = receiveTimeout;
+    }
+
+    public PlatformTransactionManager getTransactionManager() {
+        return transactionManager;
+    }
+
+    public void setTransactionManager(PlatformTransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
+    public String getTransactionName() {
+        return transactionName;
+    }
+
+    public void setTransactionName(String transactionName) {
+        this.transactionName = transactionName;
+    }
+
+    public int getTransactionTimeout() {
+        return transactionTimeout;
+    }
+
+    public void setTransactionTimeout(int transactionTimeout) {
+        this.transactionTimeout = transactionTimeout;
+    }
+
+    public int getIdleTaskExecutionLimit() {
+        return idleTaskExecutionLimit;
+    }
+
+    public void setIdleTaskExecutionLimit(int idleTaskExecutionLimit) {
+        this.idleTaskExecutionLimit = idleTaskExecutionLimit;
+    }
+
+    public int getMaxConcurrentConsumers() {
+        return maxConcurrentConsumers;
+    }
+
+    public void setMaxConcurrentConsumers(int maxConcurrentConsumers) {
+        this.maxConcurrentConsumers = maxConcurrentConsumers;
+    }
+
+    public boolean isExplicitQosEnabled() {
+        return explicitQosEnabled;
+    }
+
+    public void setExplicitQosEnabled(boolean explicitQosEnabled) {
+        this.explicitQosEnabled = explicitQosEnabled;
+    }
+
+    public boolean isDeliveryPersistent() {
+        return deliveryPersistent;
+    }
+
+    public void setDeliveryPersistent(boolean deliveryPersistent) {
+        this.deliveryPersistent = deliveryPersistent;
+    }
+
+    public long getTimeToLive() {
+        return timeToLive;
+    }
+
+    public void setTimeToLive(long timeToLive) {
+        this.timeToLive = timeToLive;
+    }
+
+    public MessageConverter getMessageConverter() {
+        return messageConverter;
+    }
+
+    public void setMessageConverter(MessageConverter messageConverter) {
+        this.messageConverter = messageConverter;
+    }
+
+    public boolean isMessageIdEnabled() {
+        return messageIdEnabled;
+    }
+
+    public void setMessageIdEnabled(boolean messageIdEnabled) {
+        this.messageIdEnabled = messageIdEnabled;
+    }
+
+    public boolean isMessageTimestampEnabled() {
+        return messageTimestampEnabled;
+    }
+
+    public void setMessageTimestampEnabled(boolean messageTimestampEnabled) {
+        this.messageTimestampEnabled = messageTimestampEnabled;
+    }
+
+    public int getPriority() {
+        return priority;
+    }
+
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+
+    // Implementation methods
+    //-------------------------------------------------------------------------
+    protected AbstractMessageListenerContainer chooseMessageListenerContainerImplementation()
{
+        // TODO use an enum to auto-switch container types?
+
+        //return new SimpleMessageListenerContainer();
+        return new DefaultMessageListenerContainer();
+    }
+}

Propchange: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java
Wed Mar 28 11:16:48 2007
@@ -17,14 +17,11 @@
  */
 package org.apache.camel.component.jms;
 
-import org.apache.camel.Processor;
 import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultConsumer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.springframework.jms.listener.AbstractMessageListenerContainer;
 
-import javax.jms.Message;
 import javax.jms.MessageListener;
 
 /**
@@ -57,12 +54,10 @@
         listenerContainer.start();
     }
 
-
     @Override
     protected void doStop() throws Exception {
         listenerContainer.stop();
         listenerContainer.destroy();
         super.doStop();
     }
-
 }

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java
Wed Mar 28 11:16:48 2007
@@ -17,55 +17,45 @@
 package org.apache.camel.component.jms;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.Exchange;
-import org.apache.camel.Producer;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
+import org.apache.camel.Producer;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.springframework.jms.core.JmsOperations;
-import org.springframework.jms.core.MessageCreator;
-import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.listener.AbstractMessageListenerContainer;
-import org.springframework.jms.listener.DefaultMessageListenerContainer;
 
-import javax.jms.JMSException;
 import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Session;
 
 /**
  * @version $Revision:520964 $
  */
 public class JmsEndpoint extends DefaultEndpoint<JmsExchange> {
-    private static final Log log = LogFactory.getLog(JmsEndpoint.class);
     private JmsBinding binding;
-    private JmsTemplate template;
     private String destination;
-
-    public JmsEndpoint(String endpointUri, CamelContext container, String destination, JmsTemplate
template) {
-        super(endpointUri, container);
+    private final boolean pubSubDomain;
+    private String selector;
+    private JmsConfiguration configuration;
+
+    public JmsEndpoint(String uri, CamelContext context, String destination, boolean pubSubDomain,
JmsConfiguration configuration) {
+        super(uri, context);
+        this.configuration = configuration;
         this.destination = destination;
-        this.template = template;
+        this.pubSubDomain = pubSubDomain;
     }
 
     public Producer<JmsExchange> createProducer() throws Exception {
+        JmsOperations template = configuration.createJmsOperations(pubSubDomain, destination);
         return startService(new JmsProducer(this, template));
     }
 
     public Consumer<JmsExchange> createConsumer(Processor<JmsExchange> processor)
throws Exception {
-        AbstractMessageListenerContainer listenerContainer = createMessageListenerContainer(template);
+
+        AbstractMessageListenerContainer listenerContainer = configuration.createMessageListenerContainer();
         listenerContainer.setDestinationName(destination);
-        listenerContainer.setPubSubDomain(template.isPubSubDomain());
-        listenerContainer.setConnectionFactory(template.getConnectionFactory());
+        listenerContainer.setPubSubDomain(pubSubDomain);
 
         // TODO support optional parameters
         // selector
-        // messageConverter
-        // durableSubscriberName
-
 
         return startService(new JmsConsumer(this, processor, listenerContainer));
     }
@@ -96,22 +86,22 @@
         this.binding = binding;
     }
 
-    public JmsOperations getTemplate() {
-        return template;
-    }
-
     public String getDestination() {
         return destination;
     }
 
-    // Implementation methods
-    //-------------------------------------------------------------------------
-
-    protected AbstractMessageListenerContainer createMessageListenerContainer(JmsTemplate
template) {
-        // TODO use an enum to auto-switch container types?
+    public JmsConfiguration getConfiguration() {
+        return configuration;
+    }
 
-        //return new SimpleMessageListenerContainer();
-        return new DefaultMessageListenerContainer();
+    public String getSelector() {
+        return selector;
     }
 
+    /**
+     * Sets the JMS selector to use
+     */
+    public void setSelector(String selector) {
+        this.selector = selector;
+    }
 }

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpointResolver.java
Wed Mar 28 11:16:48 2007
@@ -17,7 +17,6 @@
  */
 package org.apache.camel.component.jms;
 
-import org.apache.axis.transport.jms.JMSEndpoint;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Component;
 import org.apache.camel.EndpointResolver;
@@ -27,7 +26,7 @@
 
 /**
  * An implementation of {@link EndpointResolver} that creates
- * {@link JMSEndpoint} objects.
+ * {@link JmsEndpoint} objects.
  * <p/>
  * The syntax for a JMS URI looks like:
  * <p/>
@@ -84,6 +83,4 @@
         });
         return (JmsComponent) rc;
     }
-
-
 }

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsExchange.java
Wed Mar 28 11:16:48 2007
@@ -64,7 +64,6 @@
         return new JmsExchange(getContext(), binding);
     }
 
-
     // Expose JMS APIs
     //-------------------------------------------------------------------------
 
@@ -94,7 +93,6 @@
     public Message getFaultMessage() {
         return getOut().getJmsMessage();
     }
-
 
     // Implementation methods
     //-------------------------------------------------------------------------

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
(original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
Wed Mar 28 11:16:48 2007
@@ -17,23 +17,22 @@
  */
 package org.apache.camel.component.jms;
 
-import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultProducer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.springframework.jms.core.MessageCreator;
 import org.springframework.jms.core.JmsOperations;
+import org.springframework.jms.core.MessageCreator;
 
+import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.Session;
-import javax.jms.JMSException;
 
 /**
  * @version $Revision$
  */
 public class JmsProducer extends DefaultProducer<JmsExchange> {
     private static final transient Log log = LogFactory.getLog(JmsProducer.class);
-
     private final JmsEndpoint endpoint;
     private final JmsOperations template;
 

Modified: activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
(original)
+++ activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteTest.java
Wed Mar 28 11:16:48 2007
@@ -22,18 +22,17 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.util.ProducerCache;
 import org.apache.camel.builder.RouteBuilder;
 import static org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge;
 import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.ProducerCache;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.jms.ConnectionFactory;
 import javax.jms.Message;
-import javax.jms.TextMessage;
 import javax.jms.ObjectMessage;
+import javax.jms.TextMessage;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 

Modified: activemq/camel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/pom.xml?view=diff&rev=523430&r1=523429&r2=523430
==============================================================================
--- activemq/camel/trunk/pom.xml (original)
+++ activemq/camel/trunk/pom.xml Wed Mar 28 11:16:48 2007
@@ -224,6 +224,13 @@
         <groupId>org.apache.activemq</groupId>
         <artifactId>apache-activemq</artifactId>
         <version>4.1.0-incubator</version>
+        <optional>true</optional>
+        <exclusions>
+          <exclusion>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
 
       <dependency>
@@ -273,7 +280,7 @@
       <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring</artifactId>
-        <version>2.0</version>
+        <version>2.0.3</version>
         <optional>true</optional>
         <exclusions>
           <exclusion>



Mime
View raw message