...
...
Mandatory concepts
The two most important concepts in JCF are Endpoints and Component. An JCF endpoint represents a JBI endpoint: usually a Service Unit deployed on this component will contain a JCF endpoint definition. When started, this JCF endpoint will activate a JBI endpoint so that it can receive and process JBI exchanges. The component is a container of endpoints and manages their lifecycles, deployment, etc ...
Component
Section |
---|
Column |
---|
The component is one of the two mandatory classes that you will have to implement. JCF provides a very easy to use class that you should inherit called DefaultComponent . This class is abstract and you will need to implement a few methods to start using it. Those are: Those methods are related to the next concept, but are quite easy to grok. The getConfiguredEndpoints is used in the lightweight deployment mode, where the component is configured statically with its endpoints. This method will return the list of JCF endpoints contained by this component. The getEndpointClasses method is used when validating a XBean based deployment, to make sure the deployed endpoint is correct. The component should return a list of known endpoint classes that will be accepted. The code snippet on the right shows the most simple component. This rather simple code will create a full-blown JBI component, supporting deployment of service units, and all the advanced features provided by JCF ! Note the @XBean pseudo-annotation which is used by the xbean plugin to generate an xml schema we will leverage for deployment ... |
Column |
---|
Code Block |
---|
lang | java |
---|
title | Simple component |
---|
|
package com.foo;
import java.util.List;
import org.apache.servicemix.common.DefaultComponent;
/**
* @org.apache.xbean.XBean element="component"
*/
public class MyComponent extends DefaultComponent {
private MyEndpoint[] endpoints;
public MyEndpoint[] getEndpoints() {
return endpoints;
}
public void setEndpoint(MyEndpoint[] endpoints) {
this.endpoints = endpoints;
}
protected List getConfiguredEndpoints() {
return asList(endpoints);
}
protected Class[] getEndpointClasses() {
return new Class[] { MyEndpoint.class };
}
}
|
|
|
Endpoints
Optional concepts
Deployer
Bootstrap
Service Engines
This tutorial will help you creating a Service Engine using ServiceMix JCF.
...