The xweld-services project includes several useful out-of-the-box runtime services. It also provides the basic building blocks to quickly create custom engines and runtime services.

Primary Features and Benefits

Pre-built services include:

  • Periodic task scheduling, useful for defining regularly executing processes such as ‘rate reset’ or other application-specific processes on a schedule
  • Importing XML-based messages from any number of input sources and persisting them as domain objects to a JPA data store using an application-specified DAO or handler
  • A 'pluggable' memory and data grid API that supports runtime configuration of a number of providers, such as Infinispan

Key Concepts

Services and Servers

An <xweld/> Server is a configurable remote java process that runs in its own virtual machine, registered via RMI and instrumented using JMX beans for management purposes. The Server class may be used as a base for any runtime engine or component that follows this pattern. It is also the base class for the Service class, a pattern that adds message listeners that read any number of inbound readers, and writes to any number of outbound writers. The Service pattern is useful for message routing, document matching, XML message processing, and similar tasks; it is basically an engine or service that reads ‘messages’ in an event-driven manner and processes them, producing messages as output.

<xweld/> services are instrumented with JMX beans. As a result, they can be monitored and stopped using any JMX console. A ServiceManager MBean is also provided so that Servers may be started and stopped by name using the bean. This way, Servers may be run inside a J2EE container for example, in order to support high availability or failover.

All <xweld/> Servers and services require both an RMI registry and a JMX registry at run time. They register themselves and their URLs in the registry so they can be looked up by any RMI client.


Services and Servers are started using the command line ServiceTool, which is defined in the runtime module. The ServiceTool injects a named configuration into a process and starts it.

The ServiceTool is run as follows: -start <service name>  

where the service name is the name (primary key) of the ServiceConfiguration defined by the runtime tool.

Import Service

The import service is a pre-built component that can be used to read XML documents in any schema, optionally validate them, and store them into an application-specific domain model using a developer-defined message or document handler. Each instance of the import service will define a number of readers that deliver XML documents to a developer-defined/configured class that implements the IDocumentHandler interface.

The ImportService uses any IReader to obtain its input, including the JMS readers and the multi-threaded directory/file reader. This service can be used as the basis for a high-performance parallel event-driven XML reading process that converts XML to any domain model for persistence.

Packages and Classes

service control MBean class diagram

The classes shown above implement the MBean infrastructure required to start, ping and stop a Server using an MBean controller. A ContextListener is also provided that can be deployed inside a J2EE container to install the ServiceManager MBean. Installing the ServiceManager MBean will allow control over a pre-configured Server via any JMX console. The name argument passed to the MBean methods is the name of the configuration object for the given Server or service, created by your SetupTool. This MBean exposes the same functionality as the command line ServiceTool inside a bean.


Hello World Task Scheduler

A sample setup tool is provided in the package that can be called by the SetupTool by including the Setup class on the command line like this:

-Dcom.xweld.setup.types=<type list>,
 * A example service setup that creates the hello world task
 * data.
public class Setup implements ISetupTool

   * @see com.xweld.runtime.ISetupTool#setup(com.xweld.persistence.IPersistenceManager,
   *      java.lang.String[])
  public void setup(IPersistenceManager p, String[] args)
  throws ConfigurationException

    ConfigurationManager m = ConfigurationManager.getInstance();
    TaskScheduleConfiguration tconfig = m.getConfiguration("scheduler",
    if (tconfig == null)
      tconfig = new TaskScheduleConfiguration("scheduler");

    HelloWorldTask task = new HelloWorldTask();
    task.setIPAddress(""); // set this to your ip address
    task.setName("Hello, World!");


Once this is defined, and your MBean installed, you can start, stop and ping the task scheduler from the JMX console as needed. Since the configuraiton primary key for this Server is "scheduler", this is the name that must be passed to the MBean to control the service.

Contact Us

For more information, please contact us at


Copyright © 1999-2012 Free North Alliance Inc. All Rights Reserved.

The contents of this web site, including all images, text, graphics and software, are the sole property of Free North Alliance Inc. and its agents. Unauthorized use or transmission is strictly forbidden by international copyright law.

mbeans.JPG View - service control MBean class diagram (20.6 KB) John Free, 20 October 2011 05:46 PM