|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.activemq.broker.BrokerService
public class BrokerService
Manages the lifecycle of an ActiveMQ Broker. A BrokerService consists of a number of transport connectors, network connectors and a bunch of properties which can be used to configure the broker as its lazily created.
Field Summary | |
---|---|
static String |
DEFAULT_PORT
|
Constructor Summary | |
---|---|
BrokerService()
|
Method Summary | |
---|---|
TransportConnector |
addConnector(String bindAddress)
Adds a new transport connector for the given bind address |
TransportConnector |
addConnector(TransportConnector connector)
Adds a new transport connector |
TransportConnector |
addConnector(TransportServer transport)
Adds a new transport connector for the given TransportServer transport |
TransportConnector |
addConnector(URI bindAddress)
Adds a new transport connector for the given bind address |
protected Broker |
addInterceptors(Broker broker)
Strategy method to add interceptors to the broker |
JmsConnector |
addJmsConnector(JmsConnector connector)
|
NetworkConnector |
addNetworkConnector(NetworkConnector connector)
Adds a new network connector to connect this broker to a federated network |
NetworkConnector |
addNetworkConnector(String discoveryAddress)
Adds a new network connector using the given discovery address |
NetworkConnector |
addNetworkConnector(URI discoveryAddress)
Adds a new network connector using the given discovery address |
ProxyConnector |
addProxyConnector(ProxyConnector connector)
|
ProxyConnector |
addProxyConnector(String bindAddress)
Adds a new proxy connector using the given bind address |
ProxyConnector |
addProxyConnector(URI bindAddress)
Adds a new proxy connector using the given bind address |
void |
addService(Service service)
Adds a new service so that it will be started as part of the broker lifecycle |
protected void |
addShutdownHook()
|
protected void |
configureService(Object service)
Perform any custom dependency injection |
protected void |
containerShutdown()
Causes a clean shutdown of the container when the VM is being shut down |
protected ConnectionContext |
createAdminConnectionContext()
Factory method to create the new administration connection context object. |
protected Broker |
createBroker()
Factory method to create a new broker |
protected ObjectName |
createBrokerObjectName()
|
protected DestinationInterceptor |
createDefaultDestinationInterceptor()
Create the default destination interceptor |
protected ObjectName |
createNetworkConnectorObjectName(NetworkConnector connector)
|
protected PersistenceAdapter |
createPersistenceAdapter()
|
protected DefaultPersistenceAdapterFactory |
createPersistenceFactory()
|
protected Broker |
createRegionBroker()
Factory method to create the core region broker onto which interceptors are added |
protected TransportConnector |
createTransportConnector(Broker broker,
URI brokerURI)
|
void |
deleteAllMessages()
Delete all messages from the persistent store |
ConnectionContext |
getAdminConnectionContext()
Returns the broker's administration connection context used for configuring the broker at startup |
BrokerView |
getAdminView()
Returns the administration view of the broker; used to create and destroy resources such as queues and topics. |
Broker |
getBroker()
Returns the message broker |
String |
getBrokerName()
|
ObjectName |
getBrokerObjectName()
|
File |
getDataDirectory()
|
DestinationInterceptor[] |
getDestinationInterceptors()
|
PolicyMap |
getDestinationPolicy()
|
ActiveMQDestination[] |
getDestinations()
|
JmsConnector[] |
getJmsBridgeConnectors()
|
ManagementContext |
getManagementContext()
|
String |
getMasterConnectorURI()
|
UsageManager |
getMemoryManager()
|
MessageAuthorizationPolicy |
getMessageAuthorizationPolicy()
|
List |
getNetworkConnectors()
|
String[] |
getNetworkConnectorURIs()
|
PendingDurableSubscriberMessageStoragePolicy |
getPendingDurableSubscriberPolicy()
|
PersistenceAdapter |
getPersistenceAdapter()
|
PersistenceAdapterFactory |
getPersistenceFactory()
|
TaskRunnerFactory |
getPersistenceTaskRunnerFactory()
|
int |
getPersistenceThreadPriority()
|
BrokerPlugin[] |
getPlugins()
|
protected Object |
getPort(Map options)
Extracts the port from the options |
List |
getProxyConnectors()
|
Service[] |
getServices()
|
TaskRunnerFactory |
getTaskRunnerFactory()
|
Store |
getTempDataStore()
|
File |
getTmpDataDirectory()
|
List |
getTransportConnectors()
|
String[] |
getTransportConnectorURIs()
|
URI |
getVmConnectorURI()
|
boolean |
isAdvisorySupport()
|
boolean |
isDeleteAllMessagesOnStartup()
|
boolean |
isKeepDurableSubsActive()
|
boolean |
isPersistent()
|
boolean |
isPopulateJMSXUserID()
|
boolean |
isShutdownOnMasterFailure()
|
boolean |
isSlave()
|
boolean |
isStarted()
|
boolean |
isUseJmx()
|
boolean |
isUseLoggingForShutdownErrors()
|
boolean |
isUseShutdownHook()
|
boolean |
isUseVirtualTopics()
|
protected void |
logError(String message,
Throwable e)
|
void |
masterFailed()
|
protected void |
processHelperProperties()
Handles any lazy-creation helper properties which are added to make things easier to configure inside environments such as Spring |
protected TransportConnector |
registerConnectorMBean(TransportConnector connector)
|
protected void |
registerFTConnectorMBean(MasterConnector connector)
|
protected void |
registerJmsConnectorMBean(JmsConnector connector)
|
protected void |
registerNetworkConnectorMBean(NetworkConnector connector)
|
protected void |
registerProxyConnectorMBean(ProxyConnector connector)
|
boolean |
removeConnector(TransportConnector connector)
Stops and removes a transport connector from the broker. |
JmsConnector |
removeJmsConnector(JmsConnector connector)
|
boolean |
removeNetworkConnector(NetworkConnector connector)
Removes the given network connector without stopping it. |
protected void |
removeShutdownHook()
|
void |
setAdminView(BrokerView adminView)
|
void |
setAdvisorySupport(boolean advisorySupport)
Allows the support of advisory messages to be disabled for performance reasons. |
void |
setBrokerName(String brokerName)
Sets the name of this broker; which must be unique in the network |
void |
setBrokerObjectName(ObjectName brokerObjectName)
Sets the JMX ObjectName for this broker |
void |
setDataDirectory(File dataDirectory)
Sets the directory in which the data files will be stored by default for the JDBC and Journal persistence adaptors. |
void |
setDeleteAllMessagesOnStartup(boolean deletePersistentMessagesOnStartup)
Sets whether or not all messages are deleted on startup - mostly only useful for testing. |
void |
setDestinationFactory(DestinationFactory destinationFactory)
|
void |
setDestinationInterceptors(DestinationInterceptor[] destinationInterceptors)
Sets the destination interceptors to use |
void |
setDestinationPolicy(PolicyMap policyMap)
Sets the destination specific policies available either for exact destinations or for wildcard areas of destinations. |
void |
setDestinations(ActiveMQDestination[] destinations)
Sets the destinations which should be loaded/created on startup |
void |
setJmsBridgeConnectors(JmsConnector[] jmsConnectors)
|
void |
setKeepDurableSubsActive(boolean keepDurableSubsActive)
|
void |
setManagementContext(ManagementContext managementContext)
|
void |
setMasterConnectorURI(String masterConnectorURI)
|
void |
setMemoryManager(UsageManager memoryManager)
|
void |
setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)
Sets the policy used to decide if the current connection is authorized to consume a given message |
void |
setNetworkConnectors(List networkConnectors)
Sets the network connectors which this broker will use to connect to other brokers in a federated network |
void |
setNetworkConnectorURIs(String[] networkConnectorURIs)
|
void |
setPendingDurableSubscriberPolicy(PendingDurableSubscriberMessageStoragePolicy pendingDurableSubscriberPolicy)
|
void |
setPersistenceAdapter(PersistenceAdapter persistenceAdapter)
Sets the persistence adaptor implementation to use for this broker |
void |
setPersistenceFactory(PersistenceAdapterFactory persistenceFactory)
|
void |
setPersistenceTaskRunnerFactory(TaskRunnerFactory persistenceTaskRunnerFactory)
|
void |
setPersistenceThreadPriority(int persistenceThreadPriority)
|
void |
setPersistent(boolean persistent)
Sets whether or not persistence is enabled or disabled. |
void |
setPlugins(BrokerPlugin[] plugins)
Sets a number of broker plugins to install such as for security authentication or authorization |
void |
setPopulateJMSXUserID(boolean populateJMSXUserID)
Sets whether or not the broker should populate the JMSXUserID header. |
void |
setProxyConnectors(List proxyConnectors)
Sets the network connectors which this broker will use to connect to other brokers in a federated network |
void |
setServices(Service[] services)
Sets the services associated with this broker such as a MasterConnector |
void |
setShutdownOnMasterFailure(boolean shutdownOnMasterFailure)
|
void |
setTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory)
|
void |
setTempDataStore(Store tempDataStore)
|
void |
setTmpDataDirectory(File tmpDataDirectory)
|
void |
setTransportConnectors(List transportConnectors)
Sets the transport connectors which this broker will listen on for new clients |
void |
setTransportConnectorURIs(String[] transportConnectorURIs)
|
void |
setUseJmx(boolean useJmx)
Sets whether or not the Broker's services should be exposed into JMX or not. |
void |
setUseLoggingForShutdownErrors(boolean useLoggingForShutdownErrors)
Sets whether or not we should use commons-logging when reporting errors when shutting down the broker |
void |
setUseShutdownHook(boolean useShutdownHook)
Sets whether or not we should use a shutdown handler to close down the broker cleanly if the JVM is terminated. |
void |
setUseVirtualTopics(boolean useVirtualTopics)
Sets whether or not Virtual Topics should be supported by default if they have not been explicitly configured. |
void |
setVmConnectorURI(URI vmConnectorURI)
|
void |
start()
|
protected void |
startAllConnectors()
Start all transport and network connections, proxies and bridges |
protected void |
startDestinations()
Starts any configured destinations on startup |
protected void |
startDestinationsInPersistenceStore(Broker broker)
Starts all destiantions in persistence store. |
protected TransportConnector |
startTransportConnector(TransportConnector connector)
|
void |
stop()
|
protected void |
stopAllConnectors(ServiceStopper stopper)
|
protected void |
unregisterConnectorMBean(TransportConnector connector)
|
protected void |
unregisterNetworkConnectorMBean(NetworkConnector connector)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_PORT
Constructor Detail |
---|
public BrokerService()
Method Detail |
---|
public TransportConnector addConnector(String bindAddress) throws Exception
Exception
public TransportConnector addConnector(URI bindAddress) throws Exception
Exception
public TransportConnector addConnector(TransportServer transport) throws Exception
Exception
public TransportConnector addConnector(TransportConnector connector) throws Exception
Exception
public boolean removeConnector(TransportConnector connector) throws Exception
connector
-
Exception
public NetworkConnector addNetworkConnector(String discoveryAddress) throws Exception
Exception
public ProxyConnector addProxyConnector(String bindAddress) throws Exception
Exception
public NetworkConnector addNetworkConnector(URI discoveryAddress) throws Exception
Exception
public ProxyConnector addProxyConnector(URI bindAddress) throws Exception
Exception
public NetworkConnector addNetworkConnector(NetworkConnector connector) throws Exception
Exception
public boolean removeNetworkConnector(NetworkConnector connector)
ServiceSupport.stop()
to close the connector
public ProxyConnector addProxyConnector(ProxyConnector connector) throws Exception
Exception
public JmsConnector addJmsConnector(JmsConnector connector) throws Exception
Exception
public JmsConnector removeJmsConnector(JmsConnector connector)
public String getMasterConnectorURI()
public void setMasterConnectorURI(String masterConnectorURI)
masterConnectorURI
- The masterConnectorURI to set.public boolean isSlave()
public void masterFailed()
public boolean isStarted()
public void start() throws Exception
start
in interface Service
Exception
public void stop() throws Exception
stop
in interface Service
Exception
protected void stopAllConnectors(ServiceStopper stopper)
public Broker getBroker() throws Exception
Exception
public BrokerView getAdminView() throws Exception
Exception
public void setAdminView(BrokerView adminView)
public String getBrokerName()
public void setBrokerName(String brokerName)
public PersistenceAdapterFactory getPersistenceFactory()
public File getDataDirectory()
public void setDataDirectory(File dataDirectory)
dataDirectory
- the directory to store data filespublic File getTmpDataDirectory()
public void setTmpDataDirectory(File tmpDataDirectory)
tmpDataDirectory
- the tmpDataDirectory to setpublic void setPersistenceFactory(PersistenceAdapterFactory persistenceFactory)
public void setDestinationFactory(DestinationFactory destinationFactory)
public boolean isPersistent()
public void setPersistent(boolean persistent)
public boolean isPopulateJMSXUserID()
public void setPopulateJMSXUserID(boolean populateJMSXUserID)
public UsageManager getMemoryManager()
public void setMemoryManager(UsageManager memoryManager)
public PersistenceAdapter getPersistenceAdapter() throws IOException
IOException
public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter)
public TaskRunnerFactory getTaskRunnerFactory()
public void setTaskRunnerFactory(TaskRunnerFactory taskRunnerFactory)
public TaskRunnerFactory getPersistenceTaskRunnerFactory()
public void setPersistenceTaskRunnerFactory(TaskRunnerFactory persistenceTaskRunnerFactory)
public boolean isUseJmx()
public void setUseJmx(boolean useJmx)
public ObjectName getBrokerObjectName() throws IOException
IOException
public void setBrokerObjectName(ObjectName brokerObjectName)
public ManagementContext getManagementContext()
public void setManagementContext(ManagementContext managementContext)
public String[] getNetworkConnectorURIs()
public void setNetworkConnectorURIs(String[] networkConnectorURIs)
public String[] getTransportConnectorURIs()
public void setTransportConnectorURIs(String[] transportConnectorURIs)
public JmsConnector[] getJmsBridgeConnectors()
public void setJmsBridgeConnectors(JmsConnector[] jmsConnectors)
jmsConnectors
- The jmsBridgeConnectors to set.public Service[] getServices()
public void setServices(Service[] services)
MasterConnector
public void addService(Service service)
public boolean isUseLoggingForShutdownErrors()
public void setUseLoggingForShutdownErrors(boolean useLoggingForShutdownErrors)
public boolean isUseShutdownHook()
public void setUseShutdownHook(boolean useShutdownHook)
public boolean isAdvisorySupport()
public void setAdvisorySupport(boolean advisorySupport)
public List getTransportConnectors()
public void setTransportConnectors(List transportConnectors) throws Exception
Exception
public List getNetworkConnectors()
public List getProxyConnectors()
public void setNetworkConnectors(List networkConnectors) throws Exception
Exception
public void setProxyConnectors(List proxyConnectors) throws Exception
Exception
public PolicyMap getDestinationPolicy()
public void setDestinationPolicy(PolicyMap policyMap)
public BrokerPlugin[] getPlugins()
public void setPlugins(BrokerPlugin[] plugins)
public MessageAuthorizationPolicy getMessageAuthorizationPolicy()
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)
public void deleteAllMessages() throws IOException
IOException
public boolean isDeleteAllMessagesOnStartup()
public void setDeleteAllMessagesOnStartup(boolean deletePersistentMessagesOnStartup)
public URI getVmConnectorURI()
public void setVmConnectorURI(URI vmConnectorURI)
public boolean isShutdownOnMasterFailure()
public void setShutdownOnMasterFailure(boolean shutdownOnMasterFailure)
shutdownOnMasterFailure
- The shutdownOnMasterFailure to set.public boolean isKeepDurableSubsActive()
public void setKeepDurableSubsActive(boolean keepDurableSubsActive)
public boolean isUseVirtualTopics()
public void setUseVirtualTopics(boolean useVirtualTopics)
public DestinationInterceptor[] getDestinationInterceptors()
public void setDestinationInterceptors(DestinationInterceptor[] destinationInterceptors)
public ActiveMQDestination[] getDestinations()
public void setDestinations(ActiveMQDestination[] destinations)
public Store getTempDataStore()
public void setTempDataStore(Store tempDataStore)
tempDataStore
- the tempDataStore to setpublic int getPersistenceThreadPriority()
public void setPersistenceThreadPriority(int persistenceThreadPriority)
public PendingDurableSubscriberMessageStoragePolicy getPendingDurableSubscriberPolicy()
public void setPendingDurableSubscriberPolicy(PendingDurableSubscriberMessageStoragePolicy pendingDurableSubscriberPolicy)
pendingDurableSubscriberPolicy
- the pendingDurableSubscriberPolicy to setprotected void processHelperProperties() throws Exception
Exception
protected TransportConnector registerConnectorMBean(TransportConnector connector) throws IOException
IOException
protected void unregisterConnectorMBean(TransportConnector connector) throws IOException
IOException
protected void registerNetworkConnectorMBean(NetworkConnector connector) throws IOException
IOException
protected ObjectName createNetworkConnectorObjectName(NetworkConnector connector) throws MalformedObjectNameException
MalformedObjectNameException
protected void unregisterNetworkConnectorMBean(NetworkConnector connector)
protected void registerProxyConnectorMBean(ProxyConnector connector) throws IOException
IOException
protected void registerFTConnectorMBean(MasterConnector connector) throws IOException
IOException
protected void registerJmsConnectorMBean(JmsConnector connector) throws IOException
IOException
protected Broker createBroker() throws Exception
Exception
protected Broker createRegionBroker() throws Exception
Exception
protected DestinationInterceptor createDefaultDestinationInterceptor()
protected Broker addInterceptors(Broker broker) throws Exception
IOException
Exception
protected PersistenceAdapter createPersistenceAdapter() throws IOException
IOException
protected DefaultPersistenceAdapterFactory createPersistenceFactory()
protected ObjectName createBrokerObjectName() throws IOException
IOException
protected TransportConnector createTransportConnector(Broker broker, URI brokerURI) throws Exception
Exception
protected Object getPort(Map options)
protected void addShutdownHook()
protected void removeShutdownHook()
protected void containerShutdown()
protected void logError(String message, Throwable e)
protected void startDestinations() throws Exception
Exception
public ConnectionContext getAdminConnectionContext() throws Exception
Exception
protected ConnectionContext createAdminConnectionContext() throws Exception
Exception
protected void startAllConnectors() throws Exception
Exception
protected TransportConnector startTransportConnector(TransportConnector connector) throws Exception
Exception
protected void configureService(Object service)
protected void startDestinationsInPersistenceStore(Broker broker) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |