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