org.figure8.join.core.messaging
Class ConfigurableBrokerFactoryBean

java.lang.Object
  extended by org.activemq.spring.BrokerFactoryBean
      extended by org.figure8.join.core.messaging.ConfigurableBrokerFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.InitializingBean

public class ConfigurableBrokerFactoryBean
extends org.activemq.spring.BrokerFactoryBean

This factory is an extension of the Spring BrokerFactory provided by ActiveMQ. This configurable broker factory only creates broker if we are on the asynchronous side of the application. It also replaces the URL of the TCP transport layer provided into the configuration file by the one configured by application administrator (during the setup process, through the ActiveMQConfigurator helper object).

Version:
$Revision: 1.3 $
Author:
Laurent Broudoux
See Also:
ApplicationConfig, ActiveMQConfigurator

Field Summary
protected  org.activemq.broker.BrokerContainer broker
          The wrapped ActiveMQ broker container.
 
Constructor Summary
ConfigurableBrokerFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
          Override of broker creation method from ActiveMQ BrokerFactory.
 void destroy()
          Stop the wrapped broker before destroy.
 java.lang.Object getObject()
          We must ovveride this method cause broker container is private into ActiveMQ BrokerFactoryBean.
 void setActiveMQConfigurator(ActiveMQConfigurator configurator)
           
protected  void updateBrokerTransportChannelUrl()
          Update the url of the TCP trasnport server channel of the previously created borker.
 
Methods inherited from class org.activemq.spring.BrokerFactoryBean
getConfig, getObjectType, isSingleton, setConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

broker

protected org.activemq.broker.BrokerContainer broker
The wrapped ActiveMQ broker container.

Constructor Detail

ConfigurableBrokerFactoryBean

public ConfigurableBrokerFactoryBean()
Method Detail

setActiveMQConfigurator

public void setActiveMQConfigurator(ActiveMQConfigurator configurator)
Parameters:
configurator - Helper for configuring connection factory

updateBrokerTransportChannelUrl

protected void updateBrokerTransportChannelUrl()
                                        throws java.lang.Exception
Update the url of the TCP trasnport server channel of the previously created borker. This later is replaced with the one coming from ActiveMQConfigurator.

Throws:
java.lang.Exception

getObject

public java.lang.Object getObject()
                           throws java.lang.Exception
We must ovveride this method cause broker container is private into ActiveMQ BrokerFactoryBean.

Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean
Overrides:
getObject in class org.activemq.spring.BrokerFactoryBean
Returns:
The created ActiveMQ broker.
Throws:
java.lang.Exception - this does not happen (return null if no object)

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Override of broker creation method from ActiveMQ BrokerFactory. This implementation only creates and starts the broker if we are on the asynchronous side of the application. More over, the transport url of the broker is replaced by the one from ActiveMQConfigurator.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class org.activemq.spring.BrokerFactoryBean
Throws:
java.lang.Exception - IllegalArgumentException if broker factory is not well configured

destroy

public void destroy()
             throws java.lang.Exception
Stop the wrapped broker before destroy. We must ovveride this method cause broker container is private into ActiveMQ BrokerFactoryBean.

Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Overrides:
destroy in class org.activemq.spring.BrokerFactoryBean
Throws:
java.lang.Exception - if something wrong occurs during broker stop


Copyright © 2005-2008 Join. All Rights Reserved.