6. Configuring ServiceMix

Directory layout

Main distribution layout

When you first install ServiceMix, you will see the following directory structure. Note that some directories (data for example) will only be created when you have launched ServiceMix.

List of directories:

  • ant: files for ant task based management
  • bin: start scripts for Unix / Windows
  • conf: configuration files for ServiceMix container
  • data: working directory where persistent data are stored
  • examples: contain distribution examples
  • hotdeploy: hot-deploy directory for service assemblies and JBI component installers
  • install: hot-deploy directory for components and shared libraries
  • lib: container libraries
  • lib/optional: optional libraries
Main distribution
[root]
 |- ant
 |- bin
 |- conf
 |- data
 |- examples
 |- hotdeploy
 |- install
 \- lib
     \- optional

Data directory

Although the data directory is a ServiceMix internal directory, it contains some useful information.
The following directories may be created:

  • amq: working directory for ActiveMQ
  • log: directory containing log files
  • smx: ServiceMix working directory
  • txlog: transaction log storage
Data directory
data
 |- amq
 |- log
 |- smx
 \- txlog

The smx dir is populated by ServiceMix when installing / deploying JBI artifacts in the container. It contains four subdirectories for JBI components, Service Assemblies and Shared Libraries, plus an additional folder to hold temporary files.
Each of these folders will have a subdirectory for each JBI artifact deployed / installed. All these artifacts are tracked by version, and only the latest one is used (this scheme is for internal use, in case a folder can not be completely removed when upgrading a component for example.)

ServiceMix working directory
smx
 |- components
 |   |- [component-name]
 |   |   |- version-n
 |   |   \- workspace
 |   \- [other-component]
 |       \- ...
 |- service-assemblies
 |   |- [sa-name]
 |   |   \- version-n
 |   \- [other-sa]
 |       \- ...
 |- sharedlibs
 |   |- [sl-name]
 |   |   \- version-n
 |   \- [other-sl]
 |       \- ...
 \- tmp
Reset The ServiceMix Environment By Deleting the Data Directory

The data directory contains all files generated by ServiceMix at runtime. This means that if you want to reset the environment to the default, you can just delete this directory. The next time ServiceMix is started up it will create a new data directory. Note that this method should only be used during development.

Configuration files

ServiceMix uses XML configuration files. ServiceMix use the Apache XBean library to do the XML configuration; which allows you to use regular Spring configuration or our custom XSD based XML configuration.

For a reference guide and to see the XSD see the Xml schemas.

The default ServiceMix installation comes with a number of configuration files that can be changed to fit your needs. These configuration files are all in the /conf directory, which is also included in the classpath.

  • activemq.xml: ActiveMQ configuration file
  • jmx.xml: JMX configuration file
  • jndi.properties: system file for JNDI configuration
  • jndi.xml: JNDI configuration file
  • log4j.xml: Log4J configuration file
  • login.properties: JAAS configuration file
  • security.xml: ServiceMix security configuration file
  • servicemix.conf: Classworlds configuration file defining the classpath
  • servicemix.xml: ServiceMix JBI container configuration
  • tx.xml: Transaction Manager configuration
  • group.properties: security related configuration file for associating groups to users
  • users-credentials.properties: security related configuration file for associating a certificate to a user
  • users-passwords.properties: security related configuration file for associating a password to a user
  • keystore.jks: security related configuration file for storing certificates

Container configuration

Properties

ServiceMix has a number of parameters that you can set to change it's runtime behaviour on either the JBIContainer or the derived SpringJBIContainer .

These are as follows:

Attributes
Name type Description
name String name of the container - needs to be unique if running in a cluster The default is defaultJBI
rootDir String the path to the directory structure used by ServiceMix - the default is <current directory>/wdir
flowName String one of seda, st, jms or jca - see NMR Flows. The jms and jca flows can also take an optional jmsURL parameter to explicitly reference an activemq transport e.g. flowName=jms?jmsURL=tcp://localhost:61616
flowNames String comma separated list of flow names. Note that flows can also be configured using the <sm:flows> element
useMBeanServer boolean if true, ServiceMix will try and find an MBeanServer from the MBeanServerFactory if one is not supplied
createMBeanServer boolean if true, ServiceMix will create its own MBeanServer if one is not supplied to the container or found from an MBeanServerFactory
createJmxConnector boolean if true, ServiceMix will create its own JMX connector using the specified rmiPort
rmiPort int the port used for the rmi registry (and thus, the JMX connector), defaults to (1099)
installationDirPath String the path to the installation directory that ServiceMix can optionally monitor for new component archives
monitorInstallationDirectory boolean if true, ServiceMix will monitor the installation directory for new component archives to install
deploymentDirPath String the path to the deployment directory that ServiceMix can optionally monitor for new service assembilies
monitorDeploymentDirectory boolean if true, ServiceMix will monitor the deployment directory for new service assembilies to deploy
monitorInterval int if set, used as delay (measured in seconds) between checks of the deployment directory. Default is 10sec.
dumpStats boolean if true, ServiceMix will dump message throughput statistics to file Stats.csv for individual components
statsInterval int interval (in seconds) between collection of statistics for message throughput
persistent boolean If set to true, all exchanges sent to the JBI broker will have a persistence flag set to true by default. This is used to determine the QoS used, hence the flow to choose. Defaults to false
autoEnlistInTransaction boolean If set to true, each time a JBI exchange is sent from a component while a transaction is active, it will be enlisted in the current transaction. This only applies to using XA transactions. Defaults to false.
embedded boolean If set to true, a number of default parameter values will be changed to allow a more lightweight JBI container configuration (no hotdeploy, no jmx, etc...). Defaults to false
useShutdownHook boolean If set to false, the JBI container will not create a jvm shutdown hook to stop itself. Defaults to true
notifyStatistics boolean If set to true, everytime a statistic changes, a JMX notification will be sent. Defaults to false for performance.
forceShutdown int Indicates the timeout in milliseconds before exchanges get cancelled to force a shutdown in case of handling a kill signal, e.g. forceShutdown="15000" will abort all sync exchanges after attempting a clean shutdown for 15 seconds. If not set (or set to 0) the container shutdown procedure will wait for all sync exchanges to be answered.

Several elements or references can also be used to configure ServiceMix with existing objects:

Elements
Name type Description
namingContext InitialContext the JNDI initial context to use
workManager WorkManager The work manager provides a thread pool that ServiceMix container and components will use. If none is provided, a default implementation will be used.
transactionManager TransactionManager The transaction manager that ServiceMix container will use. It will also be given to components via their ComponentContext.
MBeanServer MBeanServer JMX mbean server to use
flow Flow A single flow to use
flows Flow[] An array of flows to use
broker Broker The broker used to dispatch JBI exchanges.
activationSpecs ActivationSpec[] The list of activation specs to use. Activations specs are used to configure JBI components.
componentNames String[] An array of Strings identifying the spring ids of components to activate
listeners EventListener[] An array of event listeners to configure on the container. Event listeners can be used to receive several kind of events wrt to the JBI container.

See XML Schemas for a full description of these XML elements.

Others properties can be defined as system wide:

System Properties
Name Type Description Default
org.apache.servicemix.default.charset String Define the default charset encoding used by the SourceTransformer when parsing XML source. UTF-8
org.apache.servicemix.default.validating-dtd boolean Define if the SourceTransformer parser needs to validate the XML source using a DTD. false

Examples

Attributes listed above are properties of simple types, they can be set using attributes on the main container tag in xbean.
See the XBean syntax guide for more informations.