Coverage Report - org.apache.camel.component.jms.JmsConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
JmsConfiguration
51% 
79% 
1.549
 
 1  
 /**
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  *
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.camel.component.jms;
 18  
 
 19  
 import javax.jms.ConnectionFactory;
 20  
 import javax.jms.ExceptionListener;
 21  
 
 22  
 import org.apache.camel.RuntimeCamelException;
 23  
 import org.apache.camel.util.ObjectHelper;
 24  
 
 25  
 import org.springframework.core.task.TaskExecutor;
 26  
 import org.springframework.jms.core.JmsOperations;
 27  
 import org.springframework.jms.core.JmsTemplate;
 28  
 import org.springframework.jms.core.JmsTemplate102;
 29  
 import org.springframework.jms.listener.AbstractMessageListenerContainer;
 30  
 import org.springframework.jms.listener.DefaultMessageListenerContainer;
 31  
 import org.springframework.jms.listener.DefaultMessageListenerContainer102;
 32  
 import org.springframework.jms.listener.SimpleMessageListenerContainer;
 33  
 import org.springframework.jms.listener.SimpleMessageListenerContainer102;
 34  
 import org.springframework.jms.listener.serversession.ServerSessionFactory;
 35  
 import org.springframework.jms.listener.serversession.ServerSessionMessageListenerContainer;
 36  
 import org.springframework.jms.listener.serversession.ServerSessionMessageListenerContainer102;
 37  
 import org.springframework.jms.support.converter.MessageConverter;
 38  
 import org.springframework.transaction.PlatformTransactionManager;
 39  
 
 40  
 /**
 41  
  * @version $Revision: 563665 $
 42  
  */
 43  
 public class JmsConfiguration implements Cloneable {
 44  
     protected static final String TRANSACTED = "TRANSACTED";
 45  
     protected static final String CLIENT_ACKNOWLEDGE = "CLIENT_ACKNOWLEDGE";
 46  
     protected static final String AUTO_ACKNOWLEDGE = "AUTO_ACKNOWLEDGE";
 47  
     protected static final String DUPS_OK_ACKNOWLEDGE = "DUPS_OK_ACKNOWLEDGE";
 48  
 
 49  
     private ConnectionFactory connectionFactory;
 50  
     private ConnectionFactory templateConnectionFactory;
 51  
     private ConnectionFactory listenerConnectionFactory;
 52  13
     private int acknowledgementMode = -1;
 53  13
     private String acknowledgementModeName = AUTO_ACKNOWLEDGE;
 54  
     // Used to configure the spring Container
 55  
     private ExceptionListener exceptionListener;
 56  13
     private ConsumerType consumerType = ConsumerType.Default;
 57  13
     private boolean autoStartup = true;
 58  
     private boolean acceptMessagesWhileStopping;
 59  
     private String clientId;
 60  
     private String durableSubscriptionName;
 61  
     private boolean subscriptionDurable;
 62  13
     private boolean exposeListenerSession = true;
 63  
     private TaskExecutor taskExecutor;
 64  
     private boolean pubSubNoLocal;
 65  13
     private int concurrentConsumers = 1;
 66  13
     private int maxMessagesPerTask = 1;
 67  
     private ServerSessionFactory serverSessionFactory;
 68  13
     private int cacheLevel = -1;
 69  13
     private String cacheLevelName = "CACHE_CONSUMER";
 70  13
     private long recoveryInterval = -1;
 71  13
     private long receiveTimeout = -1;
 72  13
     private int idleTaskExecutionLimit = 1;
 73  13
     private int maxConcurrentConsumers = 1;
 74  
     // JmsTemplate only
 75  
     private boolean useVersion102;
 76  
     private boolean explicitQosEnabled;
 77  13
     private boolean deliveryPersistent = true;
 78  13
     private long timeToLive = -1;
 79  
     private MessageConverter messageConverter;
 80  13
     private boolean messageIdEnabled = true;
 81  13
     private boolean messageTimestampEnabled = true;
 82  13
     private int priority = -1;
 83  
     // Transaction related configuration
 84  
     private boolean transacted;
 85  
     private PlatformTransactionManager transactionManager;
 86  
     private String transactionName;
 87  13
     private int transactionTimeout = -1;
 88  
 
 89  4
     public JmsConfiguration() {
 90  4
     }
 91  
 
 92  9
     public JmsConfiguration(ConnectionFactory connectionFactory) {
 93  9
         this.connectionFactory = connectionFactory;
 94  9
     }
 95  
 
 96  
     /**
 97  
      * Returns a copy of this configuration
 98  
      */
 99  
     public JmsConfiguration copy() {
 100  
         try {
 101  133
             return (JmsConfiguration)clone();
 102  0
         } catch (CloneNotSupportedException e) {
 103  0
             throw new RuntimeCamelException(e);
 104  
         }
 105  
     }
 106  
 
 107  
     public JmsOperations createJmsOperations(boolean pubSubDomain, String destination) {
 108  52
         ConnectionFactory factory = getTemplateConnectionFactory();
 109  52
         JmsTemplate template = useVersion102 ? new JmsTemplate102(factory, pubSubDomain) : new JmsTemplate(factory);
 110  52
         template.setPubSubDomain(pubSubDomain);
 111  52
         template.setDefaultDestinationName(destination);
 112  
 
 113  52
         template.setExplicitQosEnabled(explicitQosEnabled);
 114  52
         template.setDeliveryPersistent(deliveryPersistent);
 115  52
         if (messageConverter != null) {
 116  0
             template.setMessageConverter(messageConverter);
 117  
         }
 118  52
         template.setMessageIdEnabled(messageIdEnabled);
 119  52
         template.setMessageTimestampEnabled(messageTimestampEnabled);
 120  52
         if (priority >= 0) {
 121  0
             template.setPriority(priority);
 122  
         }
 123  52
         template.setPubSubNoLocal(pubSubNoLocal);
 124  52
         if (receiveTimeout >= 0) {
 125  0
             template.setReceiveTimeout(receiveTimeout);
 126  
         }
 127  52
         if (timeToLive >= 0) {
 128  0
             template.setTimeToLive(timeToLive);
 129  
         }
 130  
 
 131  52
         template.setSessionTransacted(transacted);
 132  
 
 133  
         // This is here for completeness, but the template should not get used
 134  
         // for receiving messages.
 135  52
         if (acknowledgementMode >= 0) {
 136  4
             template.setSessionAcknowledgeMode(acknowledgementMode);
 137  4
         } else if (acknowledgementModeName != null) {
 138  48
             template.setSessionAcknowledgeModeName(acknowledgementModeName);
 139  
         }
 140  52
         return template;
 141  
     }
 142  
 
 143  
     public AbstractMessageListenerContainer createMessageListenerContainer() {
 144  81
         AbstractMessageListenerContainer container = chooseMessageListenerContainerImplementation();
 145  81
         configureMessageListenerContainer(container);
 146  81
         return container;
 147  
     }
 148  
 
 149  
     protected void configureMessageListenerContainer(AbstractMessageListenerContainer container) {
 150  81
         container.setConnectionFactory(getListenerConnectionFactory());
 151  81
         if (autoStartup) {
 152  81
             container.setAutoStartup(true);
 153  
         }
 154  81
         if (clientId != null) {
 155  12
             container.setClientId(clientId);
 156  
         }
 157  81
         container.setSubscriptionDurable(subscriptionDurable);
 158  81
         if (durableSubscriptionName != null) {
 159  12
             container.setDurableSubscriptionName(durableSubscriptionName);
 160  
         }
 161  
 
 162  
         // lets default to durable subscription if the subscriber name and
 163  
         // client ID are specified (as there's
 164  
         // no reason to specify them if not! :)
 165  81
         if (durableSubscriptionName != null && clientId != null) {
 166  12
             container.setSubscriptionDurable(true);
 167  
         }
 168  
 
 169  81
         if (exceptionListener != null) {
 170  0
             container.setExceptionListener(exceptionListener);
 171  
         }
 172  
 
 173  81
         container.setAcceptMessagesWhileStopping(acceptMessagesWhileStopping);
 174  81
         container.setExposeListenerSession(exposeListenerSession);
 175  81
         container.setSessionTransacted(transacted);
 176  
 
 177  81
         if (acknowledgementMode >= 0) {
 178  20
             container.setSessionAcknowledgeMode(acknowledgementMode);
 179  20
         } else if (acknowledgementModeName != null) {
 180  61
             container.setSessionAcknowledgeModeName(acknowledgementModeName);
 181  
         }
 182  
 
 183  81
         if (container instanceof DefaultMessageListenerContainer) {
 184  
             // this includes DefaultMessageListenerContainer102
 185  81
             DefaultMessageListenerContainer listenerContainer = (DefaultMessageListenerContainer)container;
 186  81
             if (concurrentConsumers >= 0) {
 187  81
                 listenerContainer.setConcurrentConsumers(concurrentConsumers);
 188  
             }
 189  
 
 190  81
             if (cacheLevel >= 0) {
 191  0
                 listenerContainer.setCacheLevel(cacheLevel);
 192  0
             } else if (cacheLevelName != null) {
 193  81
                 listenerContainer.setCacheLevelName(cacheLevelName);
 194  81
             } else {
 195  
                 // Default to CACHE_CONSUMER unless specified. This works best
 196  
                 // with most JMS providers.
 197  0
                 listenerContainer.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
 198  
             }
 199  
 
 200  81
             if (idleTaskExecutionLimit >= 0) {
 201  81
                 listenerContainer.setIdleTaskExecutionLimit(idleTaskExecutionLimit);
 202  
             }
 203  81
             if (maxConcurrentConsumers >= 0) {
 204  81
                 listenerContainer.setMaxConcurrentConsumers(maxConcurrentConsumers);
 205  
             }
 206  81
             if (maxMessagesPerTask >= 0) {
 207  81
                 listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
 208  
             }
 209  81
             listenerContainer.setPubSubNoLocal(pubSubNoLocal);
 210  81
             if (receiveTimeout >= 0) {
 211  0
                 listenerContainer.setReceiveTimeout(receiveTimeout);
 212  
             }
 213  81
             if (recoveryInterval >= 0) {
 214  0
                 listenerContainer.setRecoveryInterval(recoveryInterval);
 215  
             }
 216  81
             if (taskExecutor != null) {
 217  0
                 listenerContainer.setTaskExecutor(taskExecutor);
 218  
             }
 219  81
             if (transactionManager != null) {
 220  55
                 listenerContainer.setTransactionManager(transactionManager);
 221  
             }
 222  81
             if (transactionName != null) {
 223  0
                 listenerContainer.setTransactionName(transactionName);
 224  
             }
 225  81
             if (transactionTimeout >= 0) {
 226  0
                 listenerContainer.setTransactionTimeout(transactionTimeout);
 227  
             }
 228  81
         } else if (container instanceof ServerSessionMessageListenerContainer) {
 229  
             // this includes ServerSessionMessageListenerContainer102
 230  0
             ServerSessionMessageListenerContainer listenerContainer = (ServerSessionMessageListenerContainer)container;
 231  0
             if (maxMessagesPerTask >= 0) {
 232  0
                 listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
 233  
             }
 234  0
             if (serverSessionFactory != null) {
 235  0
                 listenerContainer.setServerSessionFactory(serverSessionFactory);
 236  
             }
 237  0
         } else if (container instanceof SimpleMessageListenerContainer) {
 238  
             // this includes SimpleMessageListenerContainer102
 239  0
             SimpleMessageListenerContainer listenerContainer = (SimpleMessageListenerContainer)container;
 240  0
             if (concurrentConsumers >= 0) {
 241  0
                 listenerContainer.setConcurrentConsumers(concurrentConsumers);
 242  
             }
 243  0
             listenerContainer.setPubSubNoLocal(pubSubNoLocal);
 244  0
             if (taskExecutor != null) {
 245  0
                 listenerContainer.setTaskExecutor(taskExecutor);
 246  
             }
 247  
         }
 248  81
     }
 249  
 
 250  
     // Properties
 251  
     // -------------------------------------------------------------------------
 252  
     public ConnectionFactory getConnectionFactory() {
 253  133
         if (connectionFactory == null) {
 254  0
             connectionFactory = createConnectionFactory();
 255  
         }
 256  133
         return connectionFactory;
 257  
     }
 258  
 
 259  
     /**
 260  
      * Sets the default connection factory to be used if a connection factory is
 261  
      * not specified for either
 262  
      * {@link #setTemplateConnectionFactory(ConnectionFactory)} or
 263  
      * {@link #setListenerConnectionFactory(ConnectionFactory)}
 264  
      * 
 265  
      * @param connectionFactory the default connection factory to use
 266  
      */
 267  
     public void setConnectionFactory(ConnectionFactory connectionFactory) {
 268  4
         this.connectionFactory = connectionFactory;
 269  4
     }
 270  
 
 271  
     public ConnectionFactory getListenerConnectionFactory() {
 272  81
         if (listenerConnectionFactory == null) {
 273  81
             listenerConnectionFactory = createListenerConnectionFactory();
 274  
         }
 275  81
         return listenerConnectionFactory;
 276  
     }
 277  
 
 278  
     /**
 279  
      * Sets the connection factory to be used for consuming messages via the
 280  
      * {@link #createMessageListenerContainer()}
 281  
      * 
 282  
      * @param listenerConnectionFactory the connection factory to use for
 283  
      *                consuming messages
 284  
      */
 285  
     public void setListenerConnectionFactory(ConnectionFactory listenerConnectionFactory) {
 286  0
         this.listenerConnectionFactory = listenerConnectionFactory;
 287  0
     }
 288  
 
 289  
     public ConnectionFactory getTemplateConnectionFactory() {
 290  52
         if (templateConnectionFactory == null) {
 291  52
             templateConnectionFactory = createTemplateConnectionFactory();
 292  
         }
 293  52
         return templateConnectionFactory;
 294  
     }
 295  
 
 296  
     /**
 297  
      * Sets the connection factory to be used for sending messages via the
 298  
      * {@link JmsTemplate} via {@link #createJmsOperations(boolean, String)}
 299  
      * 
 300  
      * @param templateConnectionFactory the connection factory for sending
 301  
      *                messages
 302  
      */
 303  
     public void setTemplateConnectionFactory(ConnectionFactory templateConnectionFactory) {
 304  0
         this.templateConnectionFactory = templateConnectionFactory;
 305  0
     }
 306  
 
 307  
     public boolean isUseVersion102() {
 308  81
         return useVersion102;
 309  
     }
 310  
 
 311  
     public void setUseVersion102(boolean useVersion102) {
 312  0
         this.useVersion102 = useVersion102;
 313  0
     }
 314  
 
 315  
     public boolean isAutoStartup() {
 316  0
         return autoStartup;
 317  
     }
 318  
 
 319  
     public void setAutoStartup(boolean autoStartup) {
 320  0
         this.autoStartup = autoStartup;
 321  0
     }
 322  
 
 323  
     public boolean isAcceptMessagesWhileStopping() {
 324  0
         return acceptMessagesWhileStopping;
 325  
     }
 326  
 
 327  
     public void setAcceptMessagesWhileStopping(boolean acceptMessagesWhileStopping) {
 328  0
         this.acceptMessagesWhileStopping = acceptMessagesWhileStopping;
 329  0
     }
 330  
 
 331  
     public String getClientId() {
 332  2
         return clientId;
 333  
     }
 334  
 
 335  
     public void setClientId(String consumerClientId) {
 336  12
         this.clientId = consumerClientId;
 337  12
     }
 338  
 
 339  
     public String getDurableSubscriptionName() {
 340  2
         return durableSubscriptionName;
 341  
     }
 342  
 
 343  
     public void setDurableSubscriptionName(String durableSubscriptionName) {
 344  12
         this.durableSubscriptionName = durableSubscriptionName;
 345  12
     }
 346  
 
 347  
     public ExceptionListener getExceptionListener() {
 348  0
         return exceptionListener;
 349  
     }
 350  
 
 351  
     public void setExceptionListener(ExceptionListener exceptionListener) {
 352  0
         this.exceptionListener = exceptionListener;
 353  0
     }
 354  
 
 355  
     public boolean isSubscriptionDurable() {
 356  0
         return subscriptionDurable;
 357  
     }
 358  
 
 359  
     public void setSubscriptionDurable(boolean subscriptionDurable) {
 360  10
         this.subscriptionDurable = subscriptionDurable;
 361  10
     }
 362  
 
 363  
     public String getAcknowledgementModeName() {
 364  0
         return acknowledgementModeName;
 365  
     }
 366  
 
 367  
     public void setAcknowledgementModeName(String consumerAcknowledgementMode) {
 368  0
         this.acknowledgementModeName = consumerAcknowledgementMode;
 369  0
         this.acknowledgementMode = -1;
 370  0
     }
 371  
 
 372  
     public boolean isExposeListenerSession() {
 373  0
         return exposeListenerSession;
 374  
     }
 375  
 
 376  
     public void setExposeListenerSession(boolean exposeListenerSession) {
 377  0
         this.exposeListenerSession = exposeListenerSession;
 378  0
     }
 379  
 
 380  
     public TaskExecutor getTaskExecutor() {
 381  0
         return taskExecutor;
 382  
     }
 383  
 
 384  
     public void setTaskExecutor(TaskExecutor taskExecutor) {
 385  0
         this.taskExecutor = taskExecutor;
 386  0
     }
 387  
 
 388  
     public boolean isPubSubNoLocal() {
 389  0
         return pubSubNoLocal;
 390  
     }
 391  
 
 392  
     public void setPubSubNoLocal(boolean pubSubNoLocal) {
 393  0
         this.pubSubNoLocal = pubSubNoLocal;
 394  0
     }
 395  
 
 396  
     public int getConcurrentConsumers() {
 397  0
         return concurrentConsumers;
 398  
     }
 399  
 
 400  
     public void setConcurrentConsumers(int concurrentConsumers) {
 401  5
         this.concurrentConsumers = concurrentConsumers;
 402  5
     }
 403  
 
 404  
     public int getMaxMessagesPerTask() {
 405  0
         return maxMessagesPerTask;
 406  
     }
 407  
 
 408  
     public void setMaxMessagesPerTask(int maxMessagesPerTask) {
 409  0
         this.maxMessagesPerTask = maxMessagesPerTask;
 410  0
     }
 411  
 
 412  
     public ServerSessionFactory getServerSessionFactory() {
 413  0
         return serverSessionFactory;
 414  
     }
 415  
 
 416  
     public void setServerSessionFactory(ServerSessionFactory serverSessionFactory) {
 417  0
         this.serverSessionFactory = serverSessionFactory;
 418  0
     }
 419  
 
 420  
     public int getCacheLevel() {
 421  0
         return cacheLevel;
 422  
     }
 423  
 
 424  
     public void setCacheLevel(int cacheLevel) {
 425  0
         this.cacheLevel = cacheLevel;
 426  0
     }
 427  
 
 428  
     public String getCacheLevelName() {
 429  0
         return cacheLevelName;
 430  
     }
 431  
 
 432  
     public void setCacheLevelName(String cacheName) {
 433  0
         this.cacheLevelName = cacheName;
 434  0
     }
 435  
 
 436  
     public long getRecoveryInterval() {
 437  0
         return recoveryInterval;
 438  
     }
 439  
 
 440  
     public void setRecoveryInterval(long recoveryInterval) {
 441  0
         this.recoveryInterval = recoveryInterval;
 442  0
     }
 443  
 
 444  
     public long getReceiveTimeout() {
 445  0
         return receiveTimeout;
 446  
     }
 447  
 
 448  
     public void setReceiveTimeout(long receiveTimeout) {
 449  0
         this.receiveTimeout = receiveTimeout;
 450  0
     }
 451  
 
 452  
     public PlatformTransactionManager getTransactionManager() {
 453  0
         return transactionManager;
 454  
     }
 455  
 
 456  
     public void setTransactionManager(PlatformTransactionManager transactionManager) {
 457  5
         this.transactionManager = transactionManager;
 458  5
     }
 459  
 
 460  
     public String getTransactionName() {
 461  0
         return transactionName;
 462  
     }
 463  
 
 464  
     public void setTransactionName(String transactionName) {
 465  0
         this.transactionName = transactionName;
 466  0
     }
 467  
 
 468  
     public int getTransactionTimeout() {
 469  0
         return transactionTimeout;
 470  
     }
 471  
 
 472  
     public void setTransactionTimeout(int transactionTimeout) {
 473  0
         this.transactionTimeout = transactionTimeout;
 474  0
     }
 475  
 
 476  
     public int getIdleTaskExecutionLimit() {
 477  0
         return idleTaskExecutionLimit;
 478  
     }
 479  
 
 480  
     public void setIdleTaskExecutionLimit(int idleTaskExecutionLimit) {
 481  0
         this.idleTaskExecutionLimit = idleTaskExecutionLimit;
 482  0
     }
 483  
 
 484  
     public int getMaxConcurrentConsumers() {
 485  0
         return maxConcurrentConsumers;
 486  
     }
 487  
 
 488  
     public void setMaxConcurrentConsumers(int maxConcurrentConsumers) {
 489  0
         this.maxConcurrentConsumers = maxConcurrentConsumers;
 490  0
     }
 491  
 
 492  
     public boolean isExplicitQosEnabled() {
 493  0
         return explicitQosEnabled;
 494  
     }
 495  
 
 496  
     public void setExplicitQosEnabled(boolean explicitQosEnabled) {
 497  0
         this.explicitQosEnabled = explicitQosEnabled;
 498  0
     }
 499  
 
 500  
     public boolean isDeliveryPersistent() {
 501  2
         return deliveryPersistent;
 502  
     }
 503  
 
 504  
     public void setDeliveryPersistent(boolean deliveryPersistent) {
 505  0
         this.deliveryPersistent = deliveryPersistent;
 506  0
     }
 507  
 
 508  
     public long getTimeToLive() {
 509  0
         return timeToLive;
 510  
     }
 511  
 
 512  
     public void setTimeToLive(long timeToLive) {
 513  0
         this.timeToLive = timeToLive;
 514  0
     }
 515  
 
 516  
     public MessageConverter getMessageConverter() {
 517  0
         return messageConverter;
 518  
     }
 519  
 
 520  
     public void setMessageConverter(MessageConverter messageConverter) {
 521  0
         this.messageConverter = messageConverter;
 522  0
     }
 523  
 
 524  
     public boolean isMessageIdEnabled() {
 525  0
         return messageIdEnabled;
 526  
     }
 527  
 
 528  
     public void setMessageIdEnabled(boolean messageIdEnabled) {
 529  0
         this.messageIdEnabled = messageIdEnabled;
 530  0
     }
 531  
 
 532  
     public boolean isMessageTimestampEnabled() {
 533  0
         return messageTimestampEnabled;
 534  
     }
 535  
 
 536  
     public void setMessageTimestampEnabled(boolean messageTimestampEnabled) {
 537  0
         this.messageTimestampEnabled = messageTimestampEnabled;
 538  0
     }
 539  
 
 540  
     public int getPriority() {
 541  0
         return priority;
 542  
     }
 543  
 
 544  
     public void setPriority(int priority) {
 545  0
         this.priority = priority;
 546  0
     }
 547  
 
 548  
     public ConsumerType getConsumerType() {
 549  0
         return consumerType;
 550  
     }
 551  
 
 552  
     public void setConsumerType(ConsumerType consumerType) {
 553  0
         this.consumerType = consumerType;
 554  0
     }
 555  
 
 556  
     public int getAcknowledgementMode() {
 557  0
         return acknowledgementMode;
 558  
     }
 559  
 
 560  
     public void setAcknowledgementMode(int consumerAcknowledgementMode) {
 561  14
         this.acknowledgementMode = consumerAcknowledgementMode;
 562  14
         this.acknowledgementModeName = null;
 563  14
     }
 564  
 
 565  
     public boolean isTransacted() {
 566  0
         return transacted;
 567  
     }
 568  
 
 569  
     public void setTransacted(boolean consumerTransacted) {
 570  32
         this.transacted = consumerTransacted;
 571  32
     }
 572  
 
 573  
     // Implementation methods
 574  
     // -------------------------------------------------------------------------
 575  
     protected AbstractMessageListenerContainer chooseMessageListenerContainerImplementation() {
 576  
         // TODO we could allow a spring container to auto-inject these objects?
 577  1
         switch (consumerType) {
 578  
         case Simple:
 579  0
             return isUseVersion102() ? new SimpleMessageListenerContainer102() : new SimpleMessageListenerContainer();
 580  
         case ServerSessionPool:
 581  0
             return isUseVersion102() ? new ServerSessionMessageListenerContainer102() : new ServerSessionMessageListenerContainer();
 582  
         case Default:
 583  81
             return isUseVersion102() ? new DefaultMessageListenerContainer102() : new DefaultMessageListenerContainer();
 584  
         default:
 585  0
             throw new IllegalArgumentException("Unknown consumer type: " + consumerType);
 586  
         }
 587  
     }
 588  
 
 589  
     /**
 590  
      * Factory method which allows derived classes to customize the lazy
 591  
      * creation
 592  
      */
 593  
     protected ConnectionFactory createConnectionFactory() {
 594  0
         ObjectHelper.notNull(connectionFactory, "connectionFactory");
 595  0
         return null;
 596  
     }
 597  
 
 598  
     /**
 599  
      * Factory method which allows derived classes to customize the lazy
 600  
      * creation
 601  
      */
 602  
     protected ConnectionFactory createListenerConnectionFactory() {
 603  81
         return getConnectionFactory();
 604  
     }
 605  
 
 606  
     /**
 607  
      * Factory method which allows derived classes to customize the lazy
 608  
      * creation
 609  
      */
 610  
     protected ConnectionFactory createTemplateConnectionFactory() {
 611  52
         return getConnectionFactory();
 612  
     }
 613  
 }