Index: src/java/com/sun/genericra/GenericJMSRA.java =================================================================== --- src/java/com/sun/genericra/GenericJMSRA.java (revision 244) +++ src/java/com/sun/genericra/GenericJMSRA.java (working copy) @@ -18,6 +18,7 @@ import com.sun.genericra.inbound.EndpointConsumerFactory; import com.sun.genericra.inbound.AbstractConsumer; +import com.sun.genericra.inbound.async.EndpointConsumer; import com.sun.genericra.util.*; import java.io.Serializable; @@ -212,8 +213,10 @@ */ public void endpointActivation(MessageEndpointFactory mef, ActivationSpec spec) throws ResourceException { - AbstractConsumer consumer = EndpointConsumerFactory.createEndpointConsumer(mef, spec); - consumer.start(); + AbstractConsumer consumer = EndpointConsumerFactory.createEndpointConsumer(mef, spec); + if(isAutostartConsumption()) { + consumer.start(); + } if ((getMonitoring()) && (monitor != null)) { if (consumer.getSpec().getApplicationName() != null) { monitor.addPool(consumer.getSpec().getApplicationName(), consumer.getPool()); @@ -229,6 +232,36 @@ } /** + * Starts consumption for all endpoint consumers + */ + public void startConsumption() { + Iterator consumersIt = consumers.values().iterator(); + while(consumersIt.hasNext()) { + EndpointConsumer consumer = (EndpointConsumer) consumersIt.next(); + try { + if(consumer.isStopped()) { + consumer.start(); + } + } catch (ResourceException e) { + logger.log(Level.SEVERE, "Failed to start consumer for destination " + consumer.getDestination()); + } + } + } + + /** + * Stops consumption for all endpoint consumers + */ + public void stopConsumption() { + Iterator consumersIt = consumers.values().iterator(); + while(consumersIt.hasNext()) { + EndpointConsumer consumer = (EndpointConsumer) consumersIt.next(); + if(!consumer.isStopped()) { + consumer.stop(); + } + } + } + + /** * This method is invoked by the application server when it requires * the RA to de-activate an endpoint. This method would typically be called * when an MDB is un-deployed in the application server and that uses the RA @@ -244,7 +277,7 @@ if ((getMonitoring()) && (monitor != null)) { monitor.removePool(consumer.getSpec().getApplicationName()); } - if (consumer != null) { + if (consumer != null && !consumer.isStopped()) { consumer.stop(); } } Index: src/java/com/sun/genericra/GenericJMSRAProperties.java =================================================================== --- src/java/com/sun/genericra/GenericJMSRAProperties.java (revision 244) +++ src/java/com/sun/genericra/GenericJMSRAProperties.java (working copy) @@ -177,6 +177,9 @@ private String deliveryConcurrencyMode; private Boolean usefirstxaforredelivery = null; + + private boolean autostartConsumption = true; + /** * Sets the connection factory class name. * @@ -558,6 +561,23 @@ this.password = password; } + /** + * + * @return whether to start consumption immediately after endpoint is registered + */ + public boolean isAutostartConsumption() { + return autostartConsumption; + } + + /** + * Sets the autostartConsumption property + * @param autostartConsumption whether to start consumption immediately after endpoint is registered + + */ + public void setAutostartConsumption(boolean autostartConsumption) { + this.autostartConsumption = autostartConsumption; + } + //START CR 6604707 public int getMDBDeploymentRetryAttempt() { Index: src/java/com/sun/genericra/monitoring/ResourceMonitor.java =================================================================== --- src/java/com/sun/genericra/monitoring/ResourceMonitor.java (revision 244) +++ src/java/com/sun/genericra/monitoring/ResourceMonitor.java (working copy) @@ -21,6 +21,7 @@ import java.util.Hashtable; +import com.sun.genericra.GenericJMSRA; import com.sun.genericra.inbound.AbstractJmsResourcePool; import com.sun.genericra.inbound.async.InboundJmsResourcePool; @@ -194,5 +195,12 @@ } return pool.getMaxWaitTime(); } - + + public void startConsumption() { + GenericJMSRA.getInstance().startConsumption(); + } + + public void stopConsumption() { + GenericJMSRA.getInstance().stopConsumption(); + } } Index: src/java/com/sun/genericra/monitoring/ResourceMonitorMBean.java =================================================================== --- src/java/com/sun/genericra/monitoring/ResourceMonitorMBean.java (revision 244) +++ src/java/com/sun/genericra/monitoring/ResourceMonitorMBean.java (working copy) @@ -84,6 +84,16 @@ * @param endpoint name. * @return wait time. */ - long getMaxWaitTime(String name) ; - + long getMaxWaitTime(String name) ; + + + /** + * Starts consumption for all endpoint consumers + */ + void startConsumption(); + + /** + * Stops consumption for all endpoint consumers + */ + void stopConsumption(); }