JBI User's Guide - Welcome to Apache ServiceMix!
Post on 12-Sep-2021
3 Views
Preview:
Transcript
JBI Users Guide
Apache ServiceMixVersion 442
1
1 Introduction to JBI
11 What is JBI
TODO Describe what the JBI specification is all about
12 Message Exchange Patterns
TODO Describe the four standard JBI MEPs
13 JBI API
TODO Describe the standard JBI API (MessageExchange NormalizedMessage )
Apache ServiceMix 442
2
2 JBI Components
21 servicemix-bean
Overview
The ServiceMix Bean component provides integration with beans (POJOs) with the JBI bus to make iteasy to use POJOs to process JBI message exchanges Like in an Message Driven Bean in J2EE a POJOwill receive a message from the NMR and process it in any way it likes Unlike in a JMS componentwhere the coding is already done the Bean component gives the developer the freedom to create anytype of message handling but it must be hand coded all the way
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgbean10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnsbean=httpservicemixapacheorgbean10gtgtltbeanendpointltbeanendpoint service=testservice endpoint=endpoint bean=listenerBeangtgtltbeanltbean id=listenerBean class=orgapacheservicemixbeanbeansListenerBeangtgt
ltbeansgtltbeansgtltbeansgtltbeansgt
Endpoint types
The servicemix-bean component only defines one endpoint called beanendpoint It can be usedto receive and send message exchanges fromto the NMR
Endpoint beanendpoint
There are two ways to configure the bean endpoint The first is using the fully qualified name of theclass and the second is by passing to the endpoint a reference to an existing bean
Using a Java class
When definining a beanendpoint specifying a Java class name a new instance of this class will becreated for handling a single message exchange
ltbeansltbeans xmlnsbean=httpservicemixapacheorgbean10xmlnsmy=urnorgservicmixdocsexamplesgtgt
ltbeanendpointltbeanendpoint service=myservice endpoint=endpointclass=orgapacheservicemixdocsbeanMyHandlerBeangtgt
ltbeansgtltbeansgt
Using a spring bean
Alternative a reference to an existing bean can be passed to the bean endpoint
Apache ServiceMix 442
3
ltbeansltbeans xmlnsbean=httpservicemixapacheorgbean10gtgtltbeanendpointltbeanendpoint service=testservice endpoint=endpoint bean=listenerBeangtgtltbeanltbean id=listenerBean class=orgapacheservicemixbeanbeansListenerBeangtgt
ltbeansgtltbeansgt
Attention The Bean Endpoint schema allows to set a Bean or a Bean Name The Bean will create asingle instance of the POJO per endpoint whereas the Bean Name will create an instance per request(message exchange)
Endpoint properties
Property Name Type Description
applicationContext orgspringframeworkcontextApplicationContext
Set the SpringApplicationContextwhere the bean canbe found Defaultsto the contextdefined inxbeanxml
bean javalangObjectSet the bean to beused for handlingexchanges
beanClassName javalangString
Set the bean classname to be usedfor handlingexchanges A newinstance will becreated on the flyfor every exchange
beanInfo orgapacheservicemixbeansupportBeanInfo
Set a custom beaninfo object todefine the bean tobe used forhandlingexchanges
beanName javalangString
Set the name of thebean in theapplication contextto be used forhandlingexchanges
beanType javalangClass
Set the bean classto be used forhandlingexchanges A newinstance will becreated on the flyfor every exchange
component orgapacheservicemixbeanBeanComponent
correlationExpression orgapacheservicemixexpressionExpression
Set a customexpression to usefor correlatingexchanges into asingle requesthandled by thesame beaninstance Thedefault expressionuses a correlation
Apache ServiceMix 442
4
ID set on theexchangeproperties
endpoint javalangString The name of theendpoint
interfaceName javaxxmlnamespaceQName
The qualified nameof the interfaceexposed by theendpoint
methodInvocationStrategy orgapacheservicemixbeansupportMethodInvocationStrategy
Set a custominvocation strategyto define how thebean is beinginvoked Thedefaultimplementationtakes someadditionalparameterannotations intoaccount
service javaxxmlnamespaceQNameThe qualified nameof the service theendpoint exposes
serviceEndpoint javaxjbiservicedescServiceEndpoint
MessageExchangeListener
The first kind of POJOs you can deploy implement the MessageExchagneListener interface In sucha case servicemix-bean acts as a replacement of the lightweight container component This leveloffers the most control on the exchange received and sent This is usually used with the injectedDeliveryChannel to send back the exchanges or if the POJOs needs to act as a consumer (iecreating and sending exchanges to other services)
These POJOs are low-level POJOs you need to understand the JBI Api and Message ExchangePatterns to correctly handle incoming exchanges
Note that at this point (v 31) there is no base class that you can inherit to speed you in this processof implementing a POJO to handle JBI exchanges but hopefully it will come in the future
Examples
This example on the right shows the most simple bean When it receives an exchange it will print itto the console and set the status to DONE before sending the exchange back This bean can nothandle InOut exchanges as it does not set any response (an exception would be thrown in such acase)
Apache ServiceMix 442
5
importimport orgapacheservicemixjbilistenerMessageExchangeListener
importimport javaxannotationResourceimportimport javaxjbimessagingDeliveryChannelimportimport javaxjbimessagingExchangeStatusimportimport javaxjbimessagingMessageExchangeimportimport javaxjbimessagingMessagingException
publicpublic classclass ListenerBean implementsimplements MessageExchangeListener
Resourceprivateprivate DeliveryChannel channel
publicpublic voidvoid onMessageExchange(MessageExchange exchange) throwsthrows MessagingException Systemoutprintln(Received exchange + exchange)exchangesetStatus(ExchangeStatusDONE)channelsend(exchange)
This example will handle an InOut exchange and will send back the input as the responseNote that this example would fail if receiving an InOnly exchange as setting a response on anInOnly exchange is not a legal operation
importimport orgapacheservicemixjbilistenerMessageExchangeListenerimportimport orgapacheservicemixjbiutilMessageUtil
importimport javaxannotationResourceimportimport javaxjbimessagingDeliveryChannelimportimport javaxjbimessagingExchangeStatusimportimport javaxjbimessagingMessageExchangeimportimport javaxjbimessagingMessagingException
publicpublic classclass ListenerBean implementsimplements MessageExchangeListener
Resourceprivateprivate DeliveryChannel channel
publicpublic voidvoid onMessageExchange(MessageExchange exchange) throwsthrows MessagingException ifif (exchangegetStatus() == ExchangeStatusACTIVE)
MessageUtiltransferInToOut(exchange exchange)channelsend(exchange)
This is similar example as the one from above (also works only for InOut exchange) but it showshow you can extract message from an exchange in order to process it and send back
Apache ServiceMix 442
6
importimport orgapacheservicemixjbilistenerMessageExchangeListenerimportimport orgapacheservicemixjbiutilMessageUtilimportimport orgapacheservicemixjbijaxpSourceTransformer
importimport javaxannotationResourceimportimport javaxjbimessagingDeliveryChannelimportimport javaxjbimessagingExchangeStatusimportimport javaxjbimessagingMessageExchangeimportimport javaxjbimessagingMessagingExceptionimportimport javaxjbimessagingNormalizedMessageimportimport javaxxmltransformSource
publicpublic classclass ListenerBean implementsimplements MessageExchangeListener
Resourceprivateprivate DeliveryChannel channel
publicpublic voidvoid onMessageExchange(MessageExchange exchange) throwsthrows MessagingException ifif (exchangegetStatus() == ExchangeStatusACTIVE)
NormalizedMessage message = exchangegetMessage(in)Source content = messagegetContent()process content according to your logiceg to access the message body as a String useString body = (newnew SourceTransformer())toString(content)
messagesetContent(content)exchangesetMessage(message out)channelsend(exchange)
Disclaimer
In versions 31 to 312 the ServiceMix Bean component will not handle asynchronous messagescorrectly because the final send of the message marked as DONE back to the NMR will be handled asa consumer message and that fails because there is no corresponding provider message The onlyworkaround is to send the messages synchronously
Note This was resolved in 313 32x and later via SM-1110
MessageExchange dispatching
If the POJO deployed implements the orgapacheservicemixMessageExchangeListener everymessage received for this POJO will be dispatched to the onMessageExchange method
In other cases exchanges in a provider role will be dispatched according to theMethodInvocationStrategy configured on the endpoint The default one try to find the methodaccording to the operation name defined on the exchange If there is only a single method acting asan operation it will always be used
Annotations
The servicemix-bean component can accept different kind of POJOs These POJOs may beannotated to customize their behavior All the following annotations belong to theorgapacheservicemixbean package
Annotation Target Description
Apache ServiceMix 442
7
Callback Method
Content Parameter
Correlation Type
Endpoint TypeThis annotation is mandatory if the bean is automatically searched from a list ofpackages
ExchangeTarget Field
Operation Method
Property Parameter
XPath Parameter
In addition standard annotations can be used
Annotation Target Description
Resource Field
The Resource annotation marks a resource that is needed by the application Currentlythis annotation is only supported on fields of type ComponentContext andDeliveryChannel The component will inject the specified resource when the POJO isinstantiated
PostConstruct MethodThe PostConstruct annotation is used on a method that needs to be executed afterdependency injection is done to perform any initialization
PreDestroy MethodThe PreDestroy annotation is used on methods as a callback notification to signal thatthe instance is in the process of being removed by the container
The following interfaces are part of this API
Interface Description
MessageExchangeListenerWhen the POJO implements this interface all exchanges will be dispatched to theonMessageExchange method
Destination
This interface can be used to define a property on the bean annotated with theExchangeTarget annotation This is a very simple API to send exchanges from aPOJO More complex use cases can use an injected DeliveryChannel directly or tocreate a ServiceMix client
More Examples
bull AnnotatedBean
bull AutoDeployedBean
bull ConsumerBean
bull ListenerBean
bull PlainBean
22 servicemix-camel
Overview
The servicemix-camel component provides support for using Apache Camel to provide a full set ofEnterprise Integration Patterns and flexible routing and transformation in both Java code or SpringXML to route services on the Normalized Message Router
Apache ServiceMix 442
8
Namespace and camel-contextxml
When creating a servicemix-camel service unit we reuse the default Camel namespacehttpcamelapacheorgschemaspring
This is an example camel-contextxml which uses the Spring DSL to define the Camel routes
ltxml version=10 encoding=UTF-8gtltbeansltbeans xmlns=httpwwwspringframeworkorgschemabeans
xmlnsxsi=httpwwww3org2001XMLSchema-instancexsischemaLocation=
httpwwwspringframeworkorgschemabeanshttpwwwspringframeworkorgschemabeansspring-beans-20xsd
httpcamelapacheorgschemaspringhttpcamelapacheorgschemaspringcamel-springxsdgtgt
ltcamelContextltcamelContext xmlns=httpcamelapacheorgschemaspringgtgtltroutegtltroutegt
lt-- route defined in the Spring DSL --gtltroutegtltroutegt
ltcamelContextgtltcamelContextgt
ltbeansgtltbeansgt
It is also possible to use the Java DSL inside a servicemix-camel service unit by referring to thepackage that contains the RouteBuilder classes An example this camel-contextxml file willactivate all routes defined by RouteBuilders in the orgapacheservicemixexamplecamelpackage
ltxml version=10 encoding=UTF-8gtltbeansltbeans xmlns=httpwwwspringframeworkorgschemabeans
xmlnsxsi=httpwwww3org2001XMLSchema-instancexsischemaLocation=
httpwwwspringframeworkorgschemabeanshttpwwwspringframeworkorgschemabeansspring-beans-20xsd
httpcamelapacheorgschemaspringhttpcamelapacheorgschemaspringcamel-springxsdgtgt
ltcamelContextltcamelContext xmlns=httpcamelapacheorgschemaspringgtgtltpackagesgtltpackagesgtorgapacheservicemixexamplescamelltpackagesgtltpackagesgt
ltcamelContextgtltcamelContextgt
ltbeansgtltbeansgt
URI
Camel routes use URIs to interact with the ESB You can use these URIs to expose new endpoints onthe ESB as well as to send message exchanges to existing endpoints
The snippet below automatically exposes a new endpoint to the bus where the service QName isMyService and the endpoint name is MyEndpoint
from(jbiendpointhttpfoobarorgMyServiceMyEndpoint)
When a JBI endpoint appears at the end of a route as in the example below that will send
to(jbiendpointhttpfoobarorgMyServiceMyEndpoint)
The messages sent by this producer endpoint are sent to the already deployed JBI endpoint
Apache ServiceMix 442
9
URI format
jbiserviceserviceNamespace[sep]serviceName[options]jbiendpointserviceNamespace[sep]serviceName[sep]endpointName[options]jbinameendpointName[options]
The separator that should be used in the endpoint URL is
bull (forward slash) if serviceNamespace starts with http
bull (colon) if serviceNamespace starts with urn
You can append query options to the URI in the following format option=valueampption=valueamp
Examples
Using jbiservice
jbiservicehttpfoobarorgMyServicejbiserviceurnfoobarMyService
Using jbiendpoint
jbiendpointurnfoobarMyServiceMyEndpointjbiendpointhttpfoobarorgMyServiceMyEndpoint
Using jbiname
When using jbiname the component uses httpactivemqapacheorgcamelschemajbiendpoint as the default Service QName
jbinameMyEndpoint
URI options
Name Default value Description
mepMEP of theCamelExchange
Allows users to override the MEP set on the Exchange object Validvalues for this option are in-only in-out robust-in-out and in-optional-out
operationValue of thejbioperationheader property
Specifies the JBI operation for the MessageExchange If no value issupplied the JBI binding will use the value of the jbioperation headerproperty
serialization basic
Default value (basic) will check if headers are serializable by looking atthe type setting this option to strict will detect objects that can not beserialized although they implement the Serializable interface Set tonocheck to disable this check altogether note that this should only beused for in-memory transports like SEDAFlow otherwise you can expectto get NotSerializableException thrown at runtime
convertException falsefalse send any exceptions thrown from the Camel route backunmodified
Apache ServiceMix 442
10
true convert all exceptions to a JBI FaultException (can be used to avoidnon-serializable exceptions or to implement generic error handling
Examples
jbiservicehttpfoobarorgMyServicemep=in-out (override the MEP use InOut JBI MessageExchanges)jbiendpointurnfoobarMyServiceMyEndpointmep=in (override the MEP use InOnly JBI MessageExchanges)jbiendpointurnfoobarMyServiceMyEndpointoperation=httpwwwmycompanyorgAddNumbers(overide the operation for the JBI Exchange to httpwwwmycompanyorgAddNumbers)
Example routes
Simple Spring route
This simple Spring route registers a new endpoint on the ESB (service Router endpoint nameorders) The message exchange contents will be logged and then forwarded to another JBI serviceendpoint (service OrderService)
ltbeansltbeans xmlns=httpwwwspringframeworkorgschemabeansxmlnsxsi=httpwwww3org2001XMLSchema-instancexsischemaLocation=
httpwwwspringframeworkorgschemabeanshttpwwwspringframeworkorgschemabeansspring-beans-20xsd
httpcamelapacheorgschemaspringhttpcamelapacheorgschemaspringcamel-springxsdgtgt
ltcamelContextltcamelContext xmlns=httpcamelapacheorgschemaspringgtgtltroutegtltroutegtltfromltfrom uri=jbiendpointurnorgexampleRouterordersgtgtlttoltto uri=logOrderLogginggtgtlttoltto uri=jbiservicehttpservicesexampleorgOrderService gtgt
ltroutegtltroutegtltcamelContextgtltcamelContextgt
ltbeansgtltbeansgt
The same route using the Java DSL
When we implement the same route in the Java DSL we first code our RouteBuilderimplementation
packagepackage orgapacheservicemixexample
importimport orgapachecamelbuilderRouteBuilder
publicpublic classclass JbiRouteBuilder extendsextends RouteBuilder
Overridepublicpublic voidvoid configure() throwsthrows Exception
from(jbiendpointurnorgexampleRouterorders)to(logOrderLogging)to(jbiservicehttpservicesexampleorgOrderService)
In our camel-contextxml file we just refer to the orgapacheservicemixexample packagethat contains our JbiRouteBuilder
Apache ServiceMix 442
11
ltbeansltbeans xmlns=httpwwwspringframeworkorgschemabeansxmlnsxsi=httpwwww3org2001XMLSchema-instancexsischemaLocation=
httpwwwspringframeworkorgschemabeanshttpwwwspringframeworkorgschemabeansspring-beans-20xsd
httpcamelapacheorgschemaspringhttpcamelapacheorgschemaspringcamel-springxsdgtgt
ltcamelContextltcamelContext xmlns=httpcamelapacheorgschemaspringgtgtltroutegtltroutegtltpackageScangtltpackageScangtltpackagegtltpackagegtorgapacheservicemixexampleltpackagegtltpackagegt
ltpackageScangtltpackageScangtltroutegtltroutegt
ltcamelContextgtltcamelContextgt
ltbeansgtltbeansgt
Special considerations
Stream handling
If you are using a stream type as the message body you should be aware that a stream is onlycapable of being read once So if you enable DEBUG logging the body is usually logged and thusread To deal with this Camel has a streamCaching option that can cache the stream enabling youto read it multiple times
from(jbiendpointhttpfoobarorgMyServiceMyEndpoint)streamCaching()to(xslttransformxsl beandoSomething)
Camel will cache large input streams (by default over 64K) in a temp file usingCachedOutputStream When you close the input stream the temp file will be deleted
23 servicemix-cxf-bc
Overview
A JBI compliant HTTPSOAP or JMSSOAP binding component named servicemix-cxf-bc which useapache cxf internally
The main features are
bull JBI compliant Binding Component
bull Usable in a lightweight mode in servicemixxml configuration files
bull SOAP 11 and 12 support
bull MIME attachments
bull Support for all MEPs as consumers or providers
bull SSL support
bull WS-Security support
Apache ServiceMix 442
12
bull WS-Policy support
bull WS-RM support
bull WS-Addressing support
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgcxfbc10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnscxfbc=httpservicemixapacheorgcxfbc10gtgt
lt-- add cxfbcconsumer or cxfbcprovider definitions here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-cxf-bc component defines two endpoints
cxfbcconsumer a server-side cxf endpoint that will consume plain HTTP+SOAP requestsand send them into the NMR to a given JBI endpoint
cxfbcprovider a client-side jbi endpoint which can receive requests from the NMR andsend them to a given url where the service is provided
cxfbcconsumer
Endpoint properties
Property Name Type Description
busCfg javalangString
the location of the CXF configuration fileused to configure the CXF bus This allowsyou to configure features like WS-RM andJMS runtime behavior
delegateToJaas booleanSpecifies if the endpoint delegate toJAASAuthenticationService to do theauthentication
endpoint javalangString The name of the endpoint
features (javalangObject)Specifies the cxf features set for thisendpoint
inFaultInterceptors (javalangObject)a list of beans configuring interceptors thatprocess incoming faults
inInterceptors (javalangObject)a list of beans configuring interceptors thatprocess incoming responses
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposedby the endpoint
locationURI javalangStringthe HTTP address to which requests aresent This value will overide any valuespecified in the WSDL
mtomEnabled boolean Specifies if MTOM attachment support isenabled Default is ltcodegtfalseltcodegt
Apache ServiceMix 442
13
outFaultInterceptors (javalangObject)a list of beans configuring interceptors thatprocess fault messages being returned tothe consumer
outInterceptors (javalangObject)a list of beans configuring interceptors thatprocess requests
properties javautilMap Sets arbitrary properties that are added tothe CXF context at the Endpoint level
providedBus orgapachecxfBus a preconfigured CXF Bus object to useoverrides busCfg
schemaValidationEnabled booleanSpecifies if the endpoint useschemavalidation for the incomingoutgoingmessage
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
synchronous boolean Specifies if the endpoint expects sendmessageExchange by sendSync
targetEndpoint javalangString the name of the endpoint to which requestsare sent
targetInterface javaxxmlnamespaceQName the QName of the interface to whichrequests are sent
targetOperation javaxxmlnamespaceQName the QName of the operation to whichrequests are sent
targetService javaxxmlnamespaceQName the QName of the service to which requestsare sent
targetUri javalangString Set the target serviceendpointinterfaceusing a URI
timeout long the number of second the endpoint will waitfor a response The default is unlimited
useJBIWrapper booleanSpecifies if the JBI wrapper is sent in thebody of the message Default isltcodegttrueltcodegt
useSOAPEnvelope boolean Specifies if the endpoint expects soapmessages when useJBIWrapper is false
wsdl orgspringframeworkcoreioResource the location of the WSDL document definingthe endpoints interface
x509 boolean Specifies if the endpoint use X509Certificate to do the authentication
cxfbcprovider
Endpoint properties
Property Name Type Description
busCfg javalangString
the location of the CXF configuration fileused to configure the CXF bus This allowsyou to configure features like WS-RM andJMS runtime behavior
endpoint javalangString The name of the endpoint
features (javalangObject)Specifies the cxf features set for thisendpoint
inFaultInterceptors (javalangObject)a list of beans configuring interceptors thatprocess incoming faults
inInterceptors (javalangObject)a list of beans configuring interceptors thatprocess incoming requests
Apache ServiceMix 442
14
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposedby the endpoint
locationURI javanetURIthe HTTP address of the exposed serviceThis value will overide any value specified inthe WSDL
mtomEnabled boolean Specifies if MTOM attachment support isenabled Default is ltcodegtfalseltcodegt
outFaultInterceptors (javalangObject)a list of beans configuring interceptors thatprocess fault messages being returned tothe consumer
outInterceptors (javalangObject)a list of beans configuring interceptors thatprocess responses
properties javautilMap Sets arbitrary properties that are added tothe CXF context at the Endpoint level
providedBus orgapachecxfBus a preconfigured CXF Bus object to useoverrides busCfg
schemaValidationEnabled booleanSpecifies if the endpoint useschemavalidation for the incomingoutgoingmessage
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
synchronous booleanSpecifies if the endpoints send messagesynchronously to external server usingunderlying
useJBIWrapper booleanSpecifies if the JBI wrapper is sent in thebody of the message Default isltcodegttrueltcodegt
useSOAPEnvelope boolean Specifies if the endpoint expects soapmessages when useJBIWrapper is false
wsdl orgspringframeworkcoreioResource the location of the WSDL document definingthe endpoints interface
Examples
Configuring the CXF JMS Transport
The ServiceMix CXF binding component also allows using the CXF JMS Transport to send and receivemessages You can use the ltcxffeaturesgt element to add and configure theorgapachecxftransportjmsJMSConfigFeature on the endpoint as in the example below
Apache ServiceMix 442
15
ltcxfbcproviderltcxfbcprovider wsdl=orgapacheservicemixcxfbcwssecurityhello_worldwsdlservice=greeterHelloWorldServiceendpoint=HelloWorldPortProxyinterfaceName=greeterGreeterbusCfg=jms_conduit_configxmlgtgt
lt-- add interceptors here --gt
ltcxfbcfeaturesgtltcxfbcfeaturesgtltbeanltbean class=orgapachecxftransportjmsJMSConfigFeaturegtgt
ltpropertyltproperty name=jmsConfiggtgtltbeanltbean class=orgapachecxftransportjmsJMSConfigurationgtgt
ltpropertyltproperty name=concurrentConsumersgtgtltvaluegtltvaluegt5ltvaluegtltvaluegt
ltpropertygtltpropertygtltpropertyltproperty name=connectionFactorygtgt
ltrefltref bean=myConnectionFactory gtgtltpropertygtltpropertygtltpropertyltproperty name=targetDestinationgtgt
ltvaluegtltvaluegttestjmstransporttextproviderltvaluegtltvaluegtltpropertygtltpropertygtltpropertyltproperty name=useJms11gtgt
ltvaluegtltvaluegtfalseltvaluegtltvaluegtltpropertygtltpropertygt
ltbeangtltbeangtltpropertygtltpropertygt
ltbeangtltbeangtltcxfbcfeaturesgtltcxfbcfeaturesgt
ltcxfbcprovidergtltcxfbcprovidergt
ltamqconnectionFactoryltamqconnectionFactory id=myConnectionFactory brokerURL=vmlocalhostgtgt
The jms_conduit_configxml file specified in the busCfg parameter is optional and can be usedto specify additional JMS transport parameters
ltxml version=10 encoding=UTF-8gtltbeansltbeans xmlns=httpwwwspringframeworkorgschemabeans
xmlnsxsi=httpwwww3org2001XMLSchema-instancexmlnsjms=httpcxfapacheorgtransportsjmsxsischemaLocation=httpcxfapacheorgtransportsjms httpcxfapacheorgschemasconfigurationjmsxsdhttpwwwspringframeworkorgschemabeans httpwwwspringframeworkorgschemabeansspring-beansxsdgtgt
ltjmsconduitltjmsconduit name=httpapacheorghello_world_soap_httpHelloWorldPortjms-conduit abstract=truegtgtltjmsclientConfigltjmsclientConfig clientReceiveTimeout=200000gtgt
ltjmsconduitgtltjmsconduitgt
ltbeansgtltbeansgt
Configuring the CXF HTTP Transport
In order to configure the underlying HTTP transport used by a CXF BC endpoint you can specify anadditional busCfg file as in the example below
Apache ServiceMix 442
16
ltcxfbcproviderltcxfbcprovider wsdl=orgapacheservicemixcxfbcwssecurityhello_worldwsdlservice=greeterHelloWorldServiceendpoint=HelloWorldPortProxyinterfaceName=greeterGreeterbusCfg=http_conduit_configxmlgtgt
lt-- add interceptors and additional CXF features here --gt
ltcxfbcprovidergtltcxfbcprovidergt
The http_conduit_configxml file can then specify the additional CXF configuration Have a lookat this page for an overview of all the options supported by CXF
ltbeansltbeans xmlns=httpwwwspringframeworkorgschemabeansxmlnsxsi=httpwwww3org2001XMLSchema-instancexmlnshttp-conf=httpcxfapacheorgtransportshttpconfigurationxsischemaLocation=httpcxfapacheorgtransportshttpconfiguration
httpcxfapacheorgschemasconfigurationhttp-confxsdhttpwwwspringframeworkorgschemabeanshttpwwwspringframeworkorgschemabeansspring-beansxsdgtgt
lthttp-confconduitlthttp-confconduit name=httpapacheorghello_world_soap_httpHelloWorldPorthttp-conduitgtgtlthttp-confclientlthttp-confclient Connection=Keep-Alive
MaxRetransmits=1AllowChunking=false gtgt
lthttp-confconduitgtlthttp-confconduitgtltbeansgtltbeansgt
24 servicemix-cxf-se
Overview
ServiceMix CXF SE component is a JBI Service Engine exposing (annotated) POJO as services on theJBI BusIt uses Apache CXF internally to perform service invocations and xml marshaling
Features
bull jsr181 annotations
bull jaxb2aegisxmlbeans databinding
bull wsdl auto generation
bull java proxy support
bull MTOM attachments support
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgcxfse10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnscxfse=httpservicemixapacheorgcxfse10gtgt
lt-- add cxfseendpoint definitions here --gt
ltbeansgtltbeansgt
Apache ServiceMix 442
17
Endpoint types
The servicemix-cxf-bc component defines one endpoint type
cxfseendpoint no description yet
cxfseendpoint
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
inFaultInterceptors (javalangObject)a list of beans configuring interceptors that processincoming faults
inInterceptors (javalangObject)a list of beans configuring interceptors that processincoming requests
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by theendpoint
mtomEnabled boolean Specifies if the service can consume MTOM formattedbinary data The default is ltcodegtfalseltcodegt
outFaultInterceptors (javalangObject)a list of beans configuring interceptors that process faultmessages being returned to the consumer
outInterceptors (javalangObject)a list of beans configuring interceptors that processresponse messages
pojo javalangObject a bean configuring the JAX-WS annotated implementationfor the endpoint
pojoEndpoint javaxxmlnamespaceQName Specifies the servicemodel endpoint name generated fromthe pojo The default is ltcodegtnullltcodegt
pojoInterfaceName javaxxmlnamespaceQName Specifies the servicemodel interface name generated fromthe pojo The default is ltcodegtnullltcodegt
pojoService javaxxmlnamespaceQName Specifies the servicemodel service name generated fromthe pojo The default is ltcodegtnullltcodegt
properties javautilMap Specifies a map of properties
service javaxxmlnamespaceQName The qualified name of the service the endpoint exposes
useAegis booleanSpecifies if the endpoint use aegis databinding tomarshallunmarshall message The default isltcodegtfalseltcodegt
useJBIWrapper boolean
Specifies if the endpoint expects to receive the JBI wrapperin the message received from the NMR The default isltcodegttrueltcodegt Ignore the value ofuseSOAPEnvelope if useJBIWrapper is true
useSOAPEnvelope booleanSpecifies if the endpoint expects soap messages whenuseJBIWrapper is false if useJBIWrapper is true then ignoreuseSOAPEnvelope The default is ltcodegttrueltcodegt
useXmlBeans booleanSpecifies if the endpoint use xmlbeans databinding tomarshellunmarshell message The default isltcodegtfalseltcodegt
cxfbcproxy
Endpoint properties
Property Name Type Description
Apache ServiceMix 442
18
componentRegistry javalangObjectAllows injecting a custom componentregistry for looking up the proxyingendpoint
container orgapacheservicemixjbiapiContainer Allows injecting a JBI Container instance(eg for testing purposes)
context javaxjbicomponentComponentContext Allows injecting the ComponentContext
endpoint javalangString The name of the endpoint
factory orgapacheservicemixjbiapiClientFactory Allows injecting a ClientFactory
interfaceName javaxxmlnamespaceQName Specifies the servicemodel interfacename
mtomEnabled booleanSpecifies if the service can consumeMTOM formatted binary data Thedefault is ltcodegtfalseltcodegt
name javalangString
Specifies the JNDI name for looking upthe ClientFactory Defaults toltcodegtjavacompenvjbiClientFactoryltcodegt
propagateSecuritySubject boolean
When set to ltcodegttrueltcodegt thesecurity subject is propagated along tothe proxied endpoint Defaults toltcodegtfalseltcodegt
service javaxxmlnamespaceQName Specifies the servicemodel service name
type javalangClass Specifies the webservice POJO type
useJBIWrapper boolean
Specifies if the endpoint expects toreceive the JBI wrapper in the messagereceived from the NMR The default isltcodegttrueltcodegt Ignore the valueof useSOAPEnvelope if useJBIWrapper istrue
useSOAPEnvelope boolean
Specifies if the endpoint expects soapmessages when useJBIWrapper is falseif useJBIWrapper is true then ignoreuseSOAPEnvelope The default isltcodegttrueltcodegt
25 servicemix-drools
Overview
The ServiceMix Drools component provides JBI integration to the Drools Rules Engine
This Service Engine can be used to deploy a rules set that will implement a router or an actualservice
A router will mostly act as a transparent proxy between the consumer and the target serviceprovider mad will mostly be implemented by the jbiroute(uri) method below This method creates anew exchange identical to the one received by the component and will send it to the specifieddestination You can also send back a Fault if needed A router can also be implemented by usingdirectly the JBI Apis (available with the jbi helper) by using the provided client
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgdrools10 This is an example of an xbeanxml file with a namespace definition with prefix bean
Apache ServiceMix 442
19
ltbeansltbeans xmlnsdrools=httpservicemixapacheorgdrools10gtgt
lt-- add droolsendpoint definitions here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-drools component defines one endpoint type
droolsendpoint no description yet
droolsendpoint
Endpoint properties
Property Name Type Description
assertedObjects (javalangObject)List of additional objects to beinserted into the drools workingmemory for evaluating rules
autoReply booleanWill this endpoint automatically replyto any exchanges not handled by theDrools rulebase
component orgapacheservicemixcommonDefaultComponent
defaultTargetService javaxxmlnamespaceQNameThe default service that theexchange will be sent to if none ofthe rules have handled it
defaultTargetURI javalangStringThe default endpoint URI that theexchange will be sent to if none ofthe rules have handled it
endpoint javalangString The name of the endpoint
globals javautilMapThe global variables that areavailable while evaluating the rulebase
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
namespaceContext javaxxmlnamespaceNamespaceContext The namespace context to use whenevaluating the rules
ruleBase orgdroolsRuleBase Set the rule base to be used forhandling the exchanges
ruleBaseResource orgspringframeworkcoreioResource Specifies the resource location toload the rule base from (drl file)
ruleBaseURL javanetURL Specifies a URL to load the rule basefrom (drl file)
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
su orgapacheservicemixcommonServiceUnit
Apache ServiceMix 442
20
26 servicemix-eip
Overview
The servicemix-eip component is a routing container where different routing patterns can bedeployed as service unitThis component is based on the great Enterprise Integration Patterns book
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgeip10 This is an example of an xbeanxml file with a namespace definition with prefix eip
ltbeansltbeans xmlns=httpwwwspringframeworkorgschemabeansxmlnsxsi=httpwwww3org2001XMLSchema-instancexmlnseip=httpservicemixapacheorgeip10xsischemalocation=httpwwwspringframeworkorgschemabeans httpwwwspringframeworkorgschemabeansspring-beans-25xsdgtgt
lt-- Pipeline example --gtlteippipelinelteippipeline service=testpipeline endpoint=endpointgtgtlteiptransformergtlteiptransformergtlteipexchange-targetlteipexchange-target service=testtransformer gtgt
lteiptransformergtlteiptransformergtlteiptargetgtlteiptargetgtlteipexchange-targetlteipexchange-target service=testtrace gtgt
lteiptargetgtlteiptargetgtlteippipelinegtlteippipelinegtltbeansgtltbeansgt
Endpoint types
The servicemix-eip component defines several endpoint types
eipcontent-based-router Implements the Content-Based Router EIP
eipmessage-filter Implements the Message Filter EIP
eippipeline Implements the Pipeline EIP
eipstatic-recipient-list Implements the Static Recipient List EIP
eipstatic-routing-slip Implements the Static Routing Slip EIP
eipwire-tap Implements the Wire Tap EIP
eipxpath-splitter Uses XPath to split a message
eipsplit-aggregator Aggregates messages that have been split by the xpath-splitter
eipcontent-enricher Implements the Content Enricher EIP
eipresequencer Implements the Resequencer EIP
eipasync-bridge Handles an InOut exchange by correlating to separate InOnlyexchanges
Apache ServiceMix 442
21
In addition this component can use all ServiceMix flows (including clustered and transactionalflows) can be configured to be resilient to crashes and supports full fail-over to another node whenclustered
Content Based Router
ContentBasedRouter can be used for all kind of content-based routingThis pattern implements the Content-Based Router pattern
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
forwardOperation boolean Forward the operation qname whensending the exchange to the target
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a default implementationwill be provided
rules (orgapacheservicemixeipsupportRoutingRule) The list of routing rules
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use If none isexplicitely configured thestoreFactory will be used to createone
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use whencreating a store If no factory isexplicitely defined an in-memoryonly factory will be created
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use for thisendpoint If none is explicitelyconfigured a defaultimplementation will be provided
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to a JBIendpoint that will be used to loadthe WSDL describing this endpointThis can be used when the endpointproxies another endpoint so that thesame WSDL definition will beexposed
wsdlResource orgspringframeworkcoreioResource When specified this spring resourcewill be used to load the WSDL that
Apache ServiceMix 442
22
will be exposed as a description forthis endpoint This property can beused to explicitely define the WSDLto be exposed by this endpoint Thisproperty takes precedence over thewsdlExchangeTarget property
Message Filter
MessageFilter allows filtering incoming JBI exchanges As it drops unwanted messages and in anInOut exchange a response is required MessageFilter and InOut MEPs cannot be used togetherThis pattern implements the Message Filter pattern
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
filter orgapacheservicemixeipsupportPredicate The filter to use on incomingmessages
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a default implementationwill be provided
reportErrors boolean
Indicates if faults and errors fromrecipients should be sent back tothe consumer In such a case onlythe first fault or error received willbe reported Note that if theconsumer is synchronous it will beblocked until all recipientssuccessfully acked the exchange ora fault or error is reported and theexchange will be kept in the storefor recovery
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use If none isexplicitely configured thestoreFactory will be used to createone
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use whencreating a store If no factory isexplicitely defined an in-memoryonly factory will be created
target orgapacheservicemixeipsupportExchangeTarget The main target destination whichwill receive the exchange
Apache ServiceMix 442
23
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use for thisendpoint If none is explicitelyconfigured a defaultimplementation will be provided
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to a JBIendpoint that will be used to loadthe WSDL describing this endpointThis can be used when the endpointproxies another endpoint so that thesame WSDL definition will beexposed
wsdlResource orgspringframeworkcoreioResource
When specified this spring resourcewill be used to load the WSDL thatwill be exposed as a description forthis endpoint This property can beused to explicitely define the WSDLto be exposed by this endpoint Thisproperty takes precedence over thewsdlExchangeTarget property
Pipeline
The Pipeline component is a bridge between an In-Only (or Robust-In-Only) MEP and an In-OutMEP When the Pipeline receives an In-Only MEP it will send the input in an In-Out MEP to thetranformer destination and forward the response in an In-Only MEP to the target destination
The old orgapacheservicemixcomponentsutilPipelineComponent will be deprecated This oneoffers the same feature but can be safely clustered and use in a transactional enviromnent
In the default configuration faults sent by the transformer component are sent back to theconsumer as faults if the exchange MEP supports them or as errors (for InOnly exchanges) Thisbehavior can be changed by setting the sendFaultsToTarget attribute to true in which case faultswill be sent to the target component or by adding a faultsTarget element where faults should besent
Endpoint properties
Property Name Type Description
copyAttachments boolean Should message attachments becopied
copyProperties boolean Should message properties becopied
endpoint javalangString The name of the endpoint
faultsTarget orgapacheservicemixeipsupportExchangeTarget The address of the endpoint to sendfaults to
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a default implementationwill be provided
sendFaultsToTarget boolean
When the faultsTarget is notspecified faults may be sent to thetarget endpoint if this flag is set toltcodegttrueltcodegt
Apache ServiceMix 442
24
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use If none isexplicitely configured thestoreFactory will be used to createone
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use whencreating a store If no factory isexplicitely defined an in-memoryonly factory will be created
target orgapacheservicemixeipsupportExchangeTarget The address of the target endpoint
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use for thisendpoint If none is explicitelyconfigured a defaultimplementation will be provided
transformer orgapacheservicemixeipsupportExchangeTarget The adress of the in-out endpointacting as a transformer
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to a JBIendpoint that will be used to loadthe WSDL describing this endpointThis can be used when the endpointproxies another endpoint so that thesame WSDL definition will beexposed
wsdlResource orgspringframeworkcoreioResource
When specified this spring resourcewill be used to load the WSDL thatwill be exposed as a description forthis endpoint This property can beused to explicitely define the WSDLto be exposed by this endpoint Thisproperty takes precedence over thewsdlExchangeTarget property
Static Recipeint List
The StaticRecipientList component will forward an input In-Only or Robust-In-Only exchange to alist of known recipientsThis component implements the Recipient List pattern with the limitation that the recipient list isstatic
Apache ServiceMix 442
25
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQNameThe qualified name of theinterface exposed by theendpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a defaultimplementation will be provided
recipients (orgapacheservicemixeipsupportExchangeTarget)A list of recipients that will eachreceive a copy of the inputmessage
reportErrors boolean
Indicates if faults and errors fromrecipients should be sent back tothe consumer In such a caseonly the first fault or errorreceived will be reported Notethat if the consumer issynchronous it will be blockeduntil all recipients successfullyacked the exchange or a fault orerror is reported and theexchange will be kept in thestore for recovery
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use Ifnone is explicitely configuredthe storeFactory will be used tocreate one
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use whencreating a store If no factory isexplicitely defined an in-memory only factory will becreated
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use forthis endpoint If none isexplicitely configured a defaultimplementation will be provided
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to aJBI endpoint that will be used toload the WSDL describing thisendpoint This can be used whenthe endpoint proxies anotherendpoint so that the same WSDLdefinition will be exposed
wsdlResource orgspringframeworkcoreioResource
When specified this springresource will be used to load theWSDL that will be exposed as adescription for this endpointThis property can be used toexplicitely define the WSDL to beexposed by this endpoint Thisproperty takes precedence overthe wsdlExchangeTargetproperty
Apache ServiceMix 442
26
Static Routing Slip
A RoutingSlip component can be used to route an incoming In-Out exchange through a series oftarget servicesThis component implements the Routing Slip pattern with the limitation that the routing table isstaticThis component only uses In-Out MEPs and errors or faults sent by targets are reported back to theconsumer thus interrupting the routing process
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQNameThe qualified name of theinterface exposed by theendpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a defaultimplementation will be provided
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use Ifnone is explicitely configuredthe storeFactory will be used tocreate one
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use whencreating a store If no factory isexplicitely defined an in-memory only factory will becreated
targets (orgapacheservicemixeipsupportExchangeTarget)List of target endpoints used inthe RoutingSlip
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use forthis endpoint If none isexplicitely configured a defaultimplementation will be provided
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to aJBI endpoint that will be used toload the WSDL describing thisendpoint This can be used whenthe endpoint proxies another
Apache ServiceMix 442
27
endpoint so that the same WSDLdefinition will be exposed
wsdlResource orgspringframeworkcoreioResource
When specified this springresource will be used to load theWSDL that will be exposed as adescription for this endpointThis property can be used toexplicitely define the WSDL to beexposed by this endpoint Thisproperty takes precedence overthe wsdlExchangeTargetproperty
Wire Tap
A WireTap component can be used to forward a copy of the input message to a listener in a proxyfashionThis component implements the WireTap patternIt can handle all four standard MEPs but will only send an In-Only MEP to the listenerThe originating service must be configured to send messages to the WireTap directlyIn the case of an In-Out MEP this means that the WireTap needs to be configured to send theexchange along to the destination service
Similar to the example above the WireTap can also be used
bull to forward the output message of an exchange using lteipoutListenergt
bull to forward the fault message of an exchange using lteipfaultListenergt
Endpoint properties
Property Name Type Description
copyProperties boolean
If copyProperties isltcodegttrueltcodegt properties onthe in message will be copied to theout fault message before it is sent
endpoint javalangString The name of the endpoint
faultListener orgapacheservicemixeipsupportExchangeTarget The listener destination for faultmessages
inListener orgapacheservicemixeipsupportExchangeTarget The listener destination for inmessages
Apache ServiceMix 442
28
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a default implementationwill be provided
outListener orgapacheservicemixeipsupportExchangeTarget The listener destination for outmessages
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use If none isexplicitely configured thestoreFactory will be used to createone
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use whencreating a store If no factory isexplicitely defined an in-memoryonly factory will be created
target orgapacheservicemixeipsupportExchangeTarget The main target destination whichwill receive the exchange
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use for thisendpoint If none is explicitelyconfigured a defaultimplementation will be provided
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to a JBIendpoint that will be used to loadthe WSDL describing this endpointThis can be used when the endpointproxies another endpoint so that thesame WSDL definition will beexposed
wsdlResource orgspringframeworkcoreioResource
When specified this spring resourcewill be used to load the WSDL thatwill be exposed as a description forthis endpoint This property can beused to explicitely define the WSDLto be exposed by this endpoint Thisproperty takes precedence over thewsdlExchangeTarget property
XPath Splitter
The XPathSplitter component implements the Splitter pattern using an xpath expression to split theincoming xml
Apache ServiceMix 442
29
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
factory javaxxmlxpathXPathFactory
The XPath factory If no factory is explicitelyconfigured a defaut one will be createdusingltcodegtXPathFactorynewInstance()ltcodegt
forwardAttachments boolean Indicates if incoming attachments should beforwarded with the new exchanges
forwardProperties boolean Indicates if properties on the incomingmessage should be forwarded
functionResolver javaxxmlxpathXPathFunctionResolver The function resolver
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposedby the endpoint
lockManager orgapacheservicemixcommonlocksLockManagerThe lock manager to use for this endpoint Ifnone is explicitely specified a defaultimplementation will be provided
namespaceContext javaxxmlnamespaceNamespaceContext The namespace context to use whenevaluating the xpath expression
reportErrors boolean
Indicates if faults and errors from splittedparts should be sent back to the consumerIn such a case only the first fault or errorreceived will be reported Note that if theconsumer is synchronous it will be blockeduntil all parts have been successfully ackedor a fault or error is reported and theexchange will be kept in the store forrecovery
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
store orgapacheservicemixstoreStoreConfigure the store to use If none isexplicitely configured the storeFactory willbe used to create one
storeFactory orgapacheservicemixstoreStoreFactoryThe store factory to use when creating astore If no factory is explicitely defined anin-memory only factory will be created
synchronous boolean Specifies wether exchanges for all parts aresent synchronously or not
target orgapacheservicemixeipsupportExchangeTarget The address of the target endpoint
timerManager orgapacheservicemixtimersTimerManagerThe timer manager to use for this endpointIf none is explicitely configured a defaultimplementation will be provided
variableResolver orgapacheservicemixexpressionMessageVariableResolver
The variable resolver The default one willenable the use of properties on themessage exchange as well as makingsystem properties and environmentproperties available
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to a JBIendpoint that will be used to load the WSDLdescribing this endpoint This can be usedwhen the endpoint proxies another endpointso that the same WSDL definition will beexposed
wsdlResource orgspringframeworkcoreioResource
When specified this spring resource will beused to load the WSDL that will be exposedas a description for this endpoint Thisproperty can be used to explicitely definethe WSDL to be exposed by this endpoint
Apache ServiceMix 442
30
This property takes precedence over thewsdlExchangeTarget property
xpath javalangString The xpath expression used to split the inputmessage
Split Aggregator
The SplitAggregator is an aggregator mainly usefull to collect messages that have been createdusing a splitterIt relies on several properties that should be set on the exchanges (count index correlationId)
Endpoint properties
Content Enricher
With a Content Enricher you can extract additional information from a source and add thisinformation to your message This is useful if the calling service for example extracts a userID andyour target system is only aware of a userName By using the Content-Enricher you could extractthis information from a source system and add this additional information (userName) to yourmessage
lteipcontent-enricherlteipcontent-enricher service=testcontentEnricher endpoint=endpointgtgtlteipenricherTargetgtlteipenricherTargetgtlteipexchange-targetlteipexchange-target service=testadditionalInformationExtracter gtgt
lteipenricherTargetgtlteipenricherTargetgtlteiptargetgtlteiptargetgtlteipexchange-targetlteipexchange-target service=testmyTarget gtgt
lteiptargetgtlteiptargetgtlteipcontent-enrichergtlteipcontent-enrichergt
Apache ServiceMix 442
31
Endpoint properties
Property Name Type Description
copyAttachments boolean
If this is set toltcodegttrueltcodegt messageattachments from the incomingexchange and the enricherexchange will be copied to theoutgoing message exchange Thedefault value isltcodegtfalseltcodegt (do not copymessage atachments)
copyProperties boolean
If this is set toltcodegttrueltcodegt messageproperties from the incomingexchange and the enricherexchange will be copied to theoutgoing message exchange Thedefault value isltcodegtfalseltcodegt (do not copymessage properties)
endpoint javalangString The name of the endpoint
enricherElementName javaxxmlnamespaceQName returns the QName of the resultingroot node
enricherTarget orgapacheservicemixeipsupportExchangeTargetThe target that will receive a copyof the input message and return anaddtitional content
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a default implementationwill be provided
requestElementName javaxxmlnamespaceQNameReturns the QName of the elementwhich contains the IN Messagewithin the response message
resultElementName javaxxmlnamespaceQName
Returns the QName of the elementwhich contains the message whichwas produced by theenricherTarget within the responsemessage
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use If noneis explicitely configured thestoreFactory will be used to createone
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use whencreating a store If no factory isexplicitely defined an in-memoryonly factory will be created
target orgapacheservicemixeipsupportExchangeTarget The target where the enrichedexchanges are sent
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use for thisendpoint If none is explicitelyconfigured a defaultimplementation will be provided
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTargetAn exchange target pointing to aJBI endpoint that will be used toload the WSDL describing this
Apache ServiceMix 442
32
endpoint This can be used whenthe endpoint proxies anotherendpoint so that the same WSDLdefinition will be exposed
wsdlResource orgspringframeworkcoreioResource
When specified this springresource will be used to load theWSDL that will be exposed as adescription for this endpoint Thisproperty can be used to explicitelydefine the WSDL to be exposed bythis endpoint This property takesprecedence over thewsdlExchangeTarget property
Eip Resequencer
A resequencer re-orders incoming In-Only or Robust-In-Only exchanges and sends themsynchronously to a targets service Synchronous sending ensures that messages arrive in correctorder at the target service This component implements the Resequencer pattern
It works on (continuous) streams of message exchanges using a timeout policy Since theresequencer doesnt make batch reads theres no need to know the number of messages to be re-ordered in advance (although a capacity parameter prevents the resequencer from running out ofmemory) If the maximum out-of-sequence time difference between messages in a message streamis known the resequencers timeout parameter should be set to this value (milliseconds) In thiscase it is guaranteed that all elements of a stream are delivered in correct order to the targetservice The lower the timeout value is compared to the out-of-sequence time difference thehigher is the probability for out-of-sequence messages sent by this resequencer Large timeoutvalues should be supported by sufficiently high capacity values
For comparing elements of a sequence the resequencer component can be configured with asequence element comparator A default comparator is provided that compares message exchangesbased on Long sequence numbers This comparator expects the sequence number to be the value ofthe orgapacheservicemixeipsequencenumber property of the exchangess in-NormalizedMessage The name of the property can be customized in the comparator configuration(see below) You may also provide a custom comparator by implementing theSequenceElementComparator interface
Apache ServiceMix 442
33
lteipresequencerlteipresequencerservice=sampleResequencerendpoint=ResequencerEndpointcomparator=comparatorcapacity=100timeout=2000gtgtlteiptargetgtlteiptargetgtlteipexchange-targetlteipexchange-target service=sampleSampleTarget gtgt
lteiptargetgtlteiptargetgtlteipresequencergtlteipresequencergtlt-- Configure default comparator with custom sequence number property --gtlteipdefault-comparatorlteipdefault-comparator id=comparator sequenceNumberKey=seqnumgtgt
A running example can be downloaded from here In this example a custom-coded message sendersends messages in wrong order to the resequencer The resequencer re-orders these messagesand (synchronously) sends them to a file sender-endpoint The file sender-enpoint writes themessages (in proper order) to the workoutput directory
Endpoint properties
Property Name Type Description
capacity int
The capacity of thisresequencer Thecapacity determinesthe maximumnumber of messagethat will be kept inmemory to put themessages back insequence Thisdetermine how fartwo messages canbe in the list ofmessages while stillbeing put back insequence
comparator orgapacheservicemixeipsupportresequenceSequenceElementComparator
The comparatorused to determinethe sequence orderof elements
endpoint javalangString The name of theendpoint
interfaceName javaxxmlnamespaceQName
The qualified nameof the interfaceexposed by theendpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock managerto use for thisendpoint If none isexplicitely specifieda defaultimplementation willbe provided
service javaxxmlnamespaceQNameThe qualified nameof the service theendpoint exposes
store orgapacheservicemixstoreStoreConfigure the storeto use If none isexplicitely
Apache ServiceMix 442
34
configured thestoreFactory will beused to create one
storeFactory orgapacheservicemixstoreStoreFactory
The store factory touse when creating astore If no factoryis explicitelydefined an in-memory onlyfactory will becreated
target orgapacheservicemixeipsupportExchangeTarget
timeout long
Set the timeout ofthis resequencerThis specifies themaximum numberof milliseconds thatcan elapse betweentwo out-of-syncmessages
timerManager orgapacheservicemixtimersTimerManager
The timer managerto use for thisendpoint If none isexplicitelyconfigured adefaultimplementation willbe provided
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange targetpointing to a JBIendpoint that willbe used to load theWSDL describingthis endpoint Thiscan be used whenthe endpointproxies anotherendpoint so that thesame WSDLdefinition will beexposed
wsdlResource orgspringframeworkcoreioResource
When specified thisspring resource willbe used to load theWSDL that will beexposed as adescription for thisendpoint Thisproperty can beused to explicitelydefine the WSDL tobe exposed by thisendpoint Thisproperty takesprecedence over thewsdlExchangeTargetproperty
Async Bridge
The AsyncBridge expects an InOut mep as input It then uses the exchange id of the InOut mep asthe correlation id and creates an InOnly message by copying the input message and sends it to thetarget (with the correlation id set as a property) Next it expects an InOnly to come back with the
Apache ServiceMix 442
35
same correlation id property When this happens the message is copied to the out message of theoriginal exchange and sent back If no response is received during the configured amount of time(timeout property in milliseconds) an error will be sent back to the original consumer
lteipasync-bridgelteipasync-bridgeservice=sampleAsyncBridgeendpoint=AsyncBridgeEndpointlteiptargetgtgtlteipexchange-targetlteipexchange-target service=sampleSampleTarget gtgt
lteiptargetgtlteiptargetgtlteipasync-bridgegtlteipasync-bridgegt
Correlation Id
There is a convention between the AsyncBridge and the target on how the correlation id istransmitted The correlation id can only be transmitted from the AnsycBridge to the target using amessage property The property name can be customized On the other hand the correlation idcoming back from the target could be set in a message property or the message payload TheAsyncBridge could use an Expression to extract the correlation id from the message returning fromthe target
lteipasync-bridgelteipasync-bridgeservice=sampleAsyncBridgeendpoint=AsyncBridgeEndpointresponseCorrIdProperty=correlationIdPropertyresponseCorrId=responseCorrIdExpressiongtgtlteiptargetgtlteiptargetgt
lteipexchange-targetlteipexchange-target service=sampleSampleTarget gtgtlteiptargetgtlteiptargetgt
lteipasync-bridgegtlteipasync-bridgegt
ltbeanltbean id=responseCorrIdExpression class=orgapacheservicemixexpressionJAXPStringXPathExpression gtgtltcontructor-argltcontructor-arg value=my-responsemessagecorrIdgtgt
ltbeangtltbeangt
As you can see from the sample above the responseCorrIdProperty is used to set the name of theproperty that the target will query to get the correlation id sent by the AsyncBridge In other wordsthe target will do something like this to extract the correlation id
String correlationId = exchangegetProperty(correlationIdProperty)
The responseCorrId is set with an instance of type orgapacheservicemixexpressionExpression inthis case the class orgapacheservicemixexpressionJAXPStringXPathExpressionThis expression resolves the location of the correlation id coming back from the target In the aboveexample the expression shows that the correlation id comes as part of the message payload in anattribute called corrId of the my-responsemessage element In a similar manner the classorgapacheservicemixexpressionPropertyExpression could have been used to locate the correlationid in a message property
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
Apache ServiceMix 442
36
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
The lock manager to use for thisendpoint If none is explicitelyspecified a default implementationwill be provided
requestCorrId orgapacheservicemixexpressionExpression
The expression used to compute thecorrelation id used to correlate theresponse and the request The defaultbehavior is to use the exchange id ofthe incoming In-Out exchange as thecorrelation id
responseCorrId orgapacheservicemixexpressionExpression
The expression used to compute thecorrelation id from the responseexchange The value computed by thisexpression must match the one fromthe link setRequestCorrIdexpression The default value is nullbut if no specific expression isconfigured an expression will becreated which will extract theresponse correlation id from thelinksetResponseCorrIdProperty(String)property on the exchange
responseCorrIdProperty javalangStringName of the property used by defaultto compute the correlation id on theresponse exchange
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
store orgapacheservicemixstoreStore
Configure the store to use If none isexplicitely configured thestoreFactory will be used to createone
storeFactory orgapacheservicemixstoreStoreFactory
The store factory to use when creatinga store If no factory is explicitelydefined an in-memory only factorywill be created
target orgapacheservicemixeipsupportExchangeTarget
The target which will be used to sendan In-Only or Robust-In-Onlyexchange to When receiving an In-Out exchange the async bridge willcreate an In-Only request and send itto the specified target It then expectsanother In-Only exchange to comeback as the response which will beset as the Out message on the In-Outexchange This property is mandatoryand must be set to a valid target
timeout long
The timeout property controls theamount of time that the async bridgewill wait for the response after havingsent the request The default value is0 which means that no timeout applyIf set to a non zero value a timer willbe started when after the request issent When the timer expires the In-Out exchange will be sent back withan error status and a linkjavautilconcurrentTimeoutExceptionas the cause of the error The valuerepresents the number of millisecondsto wait
Apache ServiceMix 442
37
timerManager orgapacheservicemixtimersTimerManager
The timer manager to use for thisendpoint If none is explicitelyconfigured a default implementationwill be provided
useRobustInOnly boolean
Boolean flag to control if In-Only orRobust-In-Only exchange should beused when sending the request Thedefault value is ltcodegtfalseltcodegtwhich means that an In-Onlyexchange will be used When using aRobust-In-Only exchange and when afault is received this fault will be sentback to the consumer on the In-Outexchange and the response exchange(if any) would be discarded For bothIn-Only and Robust-In-Only if therequest exchange comes back with anError status this error will beconveyed back to the consumer in thesame way
wsdlExchangeTarget orgapacheservicemixeipsupportExchangeTarget
An exchange target pointing to a JBIendpoint that will be used to load theWSDL describing this endpoint Thiscan be used when the endpointproxies another endpoint so that thesame WSDL definition will beexposed
wsdlResource orgspringframeworkcoreioResource
When specified this spring resourcewill be used to load the WSDL that willbe exposed as a description for thisendpoint This property can be usedto explicitely define the WSDL to beexposed by this endpoint Thisproperty takes precedence over thewsdlExchangeTarget property
Tips
ExchangeTarget
All patterns use the ltexchange-target gt tag to specify the target of a JBI exchangeThis element has the following attributes
Name Type Description
interface QName the QName of the target interface One of service or interface attribute is required
operation QName the QName of the target operation (optional)
service QName the QName of the target service One of service or interface attribute is required
endpoint String the name of the target JBI endpoint only used when service is set
uri String uri used to target the exchange (see URIs)
NamespaceContext
Some patterns use XPath expression To use such expressions on an xml with namespaces youneed to define a NamespaceContext
This NamespaceContext can be referenced by a namespaceContext attribute as shown in theXPathSplitter or MessageFilter examples
Apache ServiceMix 442
38
Predicates
Some patterns uses predicates to test a given JBI exchange The only predicate currentlyimplemented is the XPathPredicate but you can implement your own and deploy it with the serviceunit
Configuring temporary message storage
Many of the pattern implementation need to store MessageExchanges temporarily An example theaggregator will need to keep track of the MessageExchange it is aggregating By default the EIPsuse a plain MemoryStoreFactory to create in-memory stores but there are other options If you setthe timeout property on the MemoryStoreFactory it will evict old object from the in-memorystore to avoid a memory leak You can also use a JDBCStoreFactory to store data in a databaseinstead of in memory
Example to use an in-memory store with timeout for a storing active and closed aggregations in altsplit-aggregatorgt you can do
lteipsplit-aggregatorlteipsplit-aggregator service=testaggregator endpoint=endpointstoreFactory=StoreFactory closedAggregateStoreFactory=StoreFactorygtgt
lteiptargetgtlteiptargetgtlteipexchange-targetlteipexchange-target service=testtrace5 gtgt
lteiptargetgtlteiptargetgtlteipsplit-aggregatorgtlteipsplit-aggregatorgt
ltbeanltbean id=StoreFactory class=orgapacheservicemixstoreMemoryStoreFactorygtgtltpropertyltproperty name=timeout value=120000gtgt lt-- 2 minute timeout --gt
ltbeangtltbeangt
Creating your own patterns
Some classes have been designed to be extensible this includes
bull orgapacheservicemixeipsupportAbstractAggregator
bull orgapacheservicemixeipsupportAbstractSplitter
27 servicemix-exec
Overview
The ServiceMix Exec component is used to invoke commands (executables binaries shellcommands shell scripts etc) The command can be static (defined in the endpoint attributes) ordynamic (provided in the incoming message including arguments)
Namespace and xbeanxml
The namespace URI for the servicemix-exec component is httpservicemixapacheorgexec10 The is an example of ltfilenamegtxbeanxmlltfilenamegt with a namespace definition withprefix exec
Apache ServiceMix 442
39
ltbeansltbeans xmlnsexec=httpservicemixapacheorgexec10gtgt
lt-- add execendpoint definitions here --gt
ltbeansgtltbeansgt
Endpoints types
The ServiceMix Exec component only defines one endpoint called execendpoint
Endpoint execendpoint
Endpoint properties
PropertyName
Type Description
command javalangString
ltpgt This attribute specifies the defaultcommand to use if no is provided in theincoming message ltpgt ltigt nbsp hedefault value is ltcodegtnullltcodegt
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
marshaler orgapacheservicemixexecmarshalerExecMarshalerSupport
ltpgt With this method you can specifya marshaler class which provides thelogic for converting a message into aexecution command This class has toimplement the interface classltcodegtExecMarshalerSupportltcodegtIf you dont specify a marshaler theltcodegtDefaultExecMarshalerltcodegtwill be used ltpgt
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
wsdl orgspringframeworkcoreioResourceltpgt This attribute specifies theabstract WSDL describing the endpointbehavior ltpgt
Abstract WSDL
TODO
How it works
TODO
28 servicemix-file
Overview
The ServiceMix File component provides JBI integration to the file system It can be used to read ampwrite files via URI or to periodically poll directories for new files
Apache ServiceMix 442
40
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgfile10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnsfile=httpservicemixapacheorgfile10gtgt
lt-- add filepoller and filesender definitions here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-file component defines two endpoint type
filepoller Periodically polls a directory for files and sends an exchange for every file
filesender Writes the contents of an exchange to a file
filepoller
Endpoint properties
Property Name Type Description
archive javaioFile Specifies a directory relative to the polling directory to which processed files arearchived
autoCreateDirectory booleanSpecifies if the endpoint should create the target directory if it does not alreadyexist If you set this to ltcodegtfalseltcodegt and the directory does not existthe endpoint will not do anything Default value is ltcodegttrueltcodegt
comparator javautilComparator
Specifies a ltcodegtComparatorltcodegt which will be used to sort File listingbefore starting to process The default is null means no sortingltcodegtComparatorltcodegt objects are implementations ofltcodegtjavautilComparatorltcodegt
component orgapacheservicemixcommonDefaultComponent
concurrentPolling boolean Sets whether more than one poll can be active at a time (true means yes)Default value is ltcodegtfalseltcodegt
delay long Sets the amount of time in milliseconds that the endpoint should wait beforemaking the first poll
deleteFile boolean Specifies if files should be deleted after they are processed Default value isltcodegttrueltcodegt
endpoint javalangString The name of the endpoint
file javaioFileSpecifies the file or directory to be polled If it is a directory all files in thedirectory or its sub-directories will be processed by the endpoint If it is a fileonly files matching the filename will be processed
filter javaioFileFilter Bean defining the class implementing the file filtering strategy This bean mustbe an implementation of the ltcodegtjavaioFileFilterltcodegt interface
firstTime javautilDateSets the date on which the first poll will be executed If a delay is also set usingltcodegtsetDelayltcodegt the delay interval will be added after the datespecified
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
Bean defining the class implementing the file locking strategy This bean mustbe an implementation of theltcodegtorgapacheservicemixlocksLockManagerltcodegt interface By defaultthis will be set to an instances ofltcodegtorgapacheservicemixcommonlocksimplSimpleLockManagerltcodegt
Apache ServiceMix 442
41
marshaler orgapacheservicemixcomponentsutilFileMarshaler
Specifies a ltcodegtFileMarshalerltcodegt object that will marshal file data intothe NMR The default file marshaller can read valid XML dataltcodegtFileMarshalerltcodegt objects are implementations ofltcodegtorgapacheservicemixcomponentsutilFileMarshalerltcodegt
maxConcurrent int How many open exchanges can be pending Default is -1 for unboundedpending exchanges Set to 1n to engage throttling of polled file processing
period long Sets the number of milliseconds between polling attempts
recursive booleanSpecifies if sub-directories are polled if false then the poller will only poll thespecified directory If the endpoint is configured to poll for a specific file ratherthan a directory then this attribute is ignored Default is ltcodegttrueltcodegt
scheduler orgapacheservicemixcommonschedulerScheduler Set a custom Scheduler implementation if you need more fine-grained controlover the polling schedule
service javaxxmlnamespaceQName The qualified name of the service the endpoint exposes
serviceUnit orgapacheservicemixcommonServiceUnit
targetEndpoint javalangString the name of the endpoint to which requests are sent
targetInterface javaxxmlnamespaceQName the QName of the interface to which requests are sent
targetOperation javaxxmlnamespaceQName the QName of the operation to which requests are sent
targetService javaxxmlnamespaceQName the QName of the service to which requests are sent
targetUri javalangString Set the target serviceendpointinterface using a URI
filesender
Endpoint properties
Property Name Type Description
append boolean
Specifies if the endpoint appends data to existing files or if it willoverwrite existing files The default is for the endpoint to overwriteexisting files Setting this to ltcodegttrueltcodegt instructs theendpoint to append data Default value is ltcodegtfalseltcodegt
autoCreateDirectory boolean
Specifies if the endpoint should create the target directory if it doesnot exist If you set this to ltcodegtfalseltcodegt and the directorydoes not exist the endpoint will not do anything Default valueltcodegttrueltcodegt
component orgapacheservicemixfileFileComponent
directory javaioFile Specifies the directory where the endpoint writes files
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by the endpoint
marshaler orgapacheservicemixcomponentsutilFileMarshaler
Specifies a ltcodegtFileMarshalerltcodegt object that will marshalmessage data from the NMR into a file The default file marshaler canwrite valid XML data ltcodegtFileMarshalerltcodegt objects areimplementations ofltcodegtorgapacheservicemixcomponentsutilFileMarshalerltcodegt
overwrite boolean
Specifies if the endpoint overwrites existing files or not The default isfor the endpoint to not overwrite existing files Setting this toltcodegttrueltcodegt instructs the endpoint to overwrite existing filesDefault value is ltcodegtfalseltcodegt
service javaxxmlnamespaceQName The qualified name of the service the endpoint exposes
tempFilePrefix javalangString Specifies a string to prefix to the beginning of generated file names
tempFileSuffix javalangString Specifies a string to append to generated file names
Apache ServiceMix 442
42
29 servicemix-ftp
Overview
The ServiceMix FTP component provides JBI integration to the FTP servers It can be used to read ampwrite files over FTPor to periodically poll directories for new files
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgftp10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnsftp=httpservicemixapacheorgftp10gtgt
lt-- add ftppoller and ftpsender definitions here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-ftp component defines two endpoint type
ftppoller Periodically polls a directory on an FTP server for files and sends anexchange for every file
ftpsender Writes the contents of an exchange to a file on an FTP server
ftppoller
Endpoint properties
Property Name Type Description
archive javanetURISpecifies a directory relative tothe polling directory to whichprocessed files are archived
autoCreateDirectory boolean
Specifies if the endpointshould create the targetdirectory if it does not alreadyexist If you set this toltcodegtfalseltcodegt and thedirectory does not exist theendpoint will not do anythingDefault value isltcodegttrueltcodegt
changeWorkingDirectory boolean
When set toltcodegttrueltcodegt thepoller will do an explicitltcodegtcwdltcodegt into thedirectory to be polled Defaultto ltcodegtfalseltcodegtRecursive polling will not bepossible if this feature isenabled
clientPool orgapacheservicemixftpFTPClientPool Set a custom FTPClientPool Ifthis property has not been set
Apache ServiceMix 442
43
the FTP client pool will becreated based on theinformation provided in theURI
component orgapacheservicemixcommonDefaultComponenttheltcodegtcomponentltcodegtimplementation to use
concurrentPolling boolean
Sets whether more than onepoll can be active at a time(true means yes) Default valueis ltcodegtfalseltcodegt
delay long
Sets the amount of time inmilliseconds that the endpointshould wait before making thefirst poll
deleteFile boolean
Delete the file after it has beensuccesfully processedDefaults toltcodegttrueltcodegt
endpoint javalangString The name of the endpoint
filter javaioFileFilter
Sets the filter to select whichfiles have to be processedWhen not set all files will bepicked up by the poller
firstTime javautilDate
Sets the date on which the firstpoll will be executed If a delayis also set usingltcodegtsetDelayltcodegt thedelay interval will be addedafter the date specified
interfaceName javaxxmlnamespaceQNameThe qualified name of theinterface exposed by theendpoint
lockManager orgapacheservicemixcommonlocksLockManager
Set a custom LockManagerimplementation for keepingtrack of which files are alreadybeing processed The defaultimplementation is a simplein-memory lock managementsystem
marshaler orgapacheservicemixcomponentsutilFileMarshaler
Set a custom FileMarshalerimplementation to control howthe file contents is beingtranslated into a JBI messageThe default implementationreads XML contents from thefile
period longSets the number ofmilliseconds between pollingattempts
recursive boolean
Specifies whethersubdirectories should bepolled Defaults toltcodegttrueltcodegt
scheduler orgapacheservicemixcommonschedulerScheduler
Set a custom Schedulerimplementation if you needmore fine-grained control overthe polling schedule
service javaxxmlnamespaceQName The qualified name of theservice the endpoint exposes
serviceUnit orgapacheservicemixcommonServiceUnit
Apache ServiceMix 442
44
stateless boolean When set toltcodegtfalseltcodegt
targetEndpoint javalangString the name of the endpoint towhich requests are sent
targetInterface javaxxmlnamespaceQName the QName of the interface towhich requests are sent
targetOperation javaxxmlnamespaceQName Set the operation to beinvoked on the target service
targetService javaxxmlnamespaceQName the QName of the service towhich requests are sent
targetUri javalangStringSet the target serviceendpointinterface using aURI
uri javanetURI Configures the endpoint froma URI
ftpsender
Endpoint properties
Property Name Type Description
autoCreateDirectory boolean
Specifies if the endpoint shouldcreate the target directory if itdoes not already exist If you setthis to ltcodegtfalseltcodegt andthe directory does not exist theendpoint will not do anythingDefault value isltcodegttrueltcodegt
checkDuplicates booleanSpecifies whether duplicatesshould be checked Defaults toltcodegttrueltcodegt
clientPool orgapacheservicemixftpFTPClientPool
Set a custom FTPClientPool If thisproperty has not been set the FTPclient pool will be created based onthe information provided in theURI
component orgapacheservicemixftpFtpComponent
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
marshaler orgapacheservicemixcomponentsutilFileMarshaler
Set a custom FileMarshalerimplementation to control how thefile contents is being translatedinto a JBI message The defaultimplementation reads XMLcontents from the file
overwrite boolean
Specifies if a file with the samename already exists on the FTPserver the file should beoverwritten Defaults toltcodegtfalseltcodegt
service javaxxmlnamespaceQName The qualified name of the servicethe endpoint exposes
uniqueFileName javalangStringSets the name used to make aunique name if no file name isavailable on the message
Apache ServiceMix 442
45
uploadPrefix javalangString
Set the file name prefix usedduring upload The prefix will beautomatically removed as soon asthe upload has completed Thisallows other processes to discerncompleted files from files that arebeing uploaded
uploadSuffix javalangString
Set the file name suffix usedduring upload The suffix will beautomatically removed as soon asthe upload has completed Thisallows other processes to discerncompleted files from files that arebeing uploaded
uri javanetURI Configures the endpoint from a URI
Examples
Using ftppool to configure the FTP connections
In order to gain more control over the FTP connection parameters (activepassive timeout ) thatare being used you can define your own FTP connection pool Afterward you can refer to the poolobject from both a sender and poller endpoint
ltxml version=10gtltbeansltbeans xmlnsftp=httpservicemixapacheorgftp10
xmlnssample=urnservicemixexamplegtgt
ltftpsenderltftpsender service=samplesender endpoint=endpointuri=ftplocalhostmyfolderclientPool=clientPoolgtgt
ltftppoolltftppool id=clientPool username=myname password=$ecretdataTimeout=90000 gtgt
ltbeansgtltbeansgt
The table below shows the full list of options offered by ftppool
Property Name Type Description
address javanetInetAddress Set the remote internet address to connect to
binaryMode boolean Use binary mode transfers Defaults toltcodegttrueltcodegt
config orgapachecommonsnetftpFTPClientConfigConfigure a custom FTPClientConfig instanceto allow more fine-grained control over theFTP connections in the pool
controlEncoding javalangStringConfigure the encoding used in the FTPcontrol connections Defaults toltcodegtISO-8859-1ltcodegt
dataTimeout intSpecifies a timeout used on the FTP dataconnection Defaults toltcodegt120000ltcodegt
host javalangString Set the remote host name to connect to
localAddress javanetInetAddress Set the local IP address to be used whenestablishing the connection
localPort int Set the local TCPIP port to be used whenestablishing the connection
Apache ServiceMix 442
46
passiveMode boolean Use passive mode FTP transfers Defaults toltcodegtfalseltcodegt
password javalangString Set the password for logging into the FTPserver
pool orgapachecommonspoolObjectPool Set a custom ObjectPool instance to use forthe connection pooling
port int Set the remote port number to connect to
username javalangString Set the login to use to access the FTP server
If you need even more fine-grained control over the FTP connections or the way the payloads arebeing handled have a look at the Camel FTP component which offers a lot of options out of thebox but also allows setting any property on its underlying Commons NET FTPClient andFTPClientConfig instances
210 servicemix-http
Overview
ServiceMix ships with a JBI compliant HTTPSOAP binding component named servicemix-http
Here are the main features
bull JBI compliant Binding Component
bull Usable in a lightweight mode in servicemixxml configuration files
bull Integrated HTTP server based on Jetty 6
bull HTTP Client using Jakarta Commons HTTP Client
bull Highly performant and scalable using Jetty 6 continuations
bull SOAP 11 and 12 support
bull MIME attachments
bull WS-Addressing support
bull WSDL based and XBean based deployments
bull Support for all MEPs as consumers or providers
bull SSL support
bull WS-Security support
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorghttp10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnshttp=httpservicemixapacheorghttp10gtgt
lt-- add httpconsumer httpsoap-consumerhttpprovider and http soapprovider definitions here --gt
ltbeansgtltbeansgt
Apache ServiceMix 442
47
Endpoint types
The servicemix-http component defines four endpoint type
httpconsumer This endpoint allows you to expose a service in the ESB to the outsideworld over HTTP Whenever it receives an HTTP request it will interact with the configuredservices on the ESB to provide the HTTP response
httpsoap-consumer Similar to httpconsumer but specifically geared towards handingSOAP requests and responses
httpprovider This endpoint allows you to access remote services from within the ESBIt will perform an external HTTP request whenever it receives a JBI MessageExchange
httpsoap-provider Similar to httpprovider but specifically geared towardsperforming SOAP requests
It also provides one additional legacy endpoints which are still available to ease migration fromServiceMix 3
httpendpoint (Deprecated) Legacy endpoint capable to acting as a consumer orprovider based on the configuration
httpendpoint
Endpoint properties
Property Name Type Description
authMethod javalangString
a stringnaming thescheme usedforauthenticatingusers
basicAuthentication orgapacheservicemixhttpBasicAuthCredentials
authenticationdata for usingbasic HTTPauthentication
binding javaxwsdlextensionsExtensibilityElement
defaultMep javanetURI
defaultOperation javaxxmlnamespaceQName
description orgw3cdomDocument
dynamic boolean
endpoint javalangString The name ofthe endpoint
interfaceName javaxxmlnamespaceQName
The qualifiedname of theinterfaceexposed bythe endpoint
locationURI javalangString
the URI towhich aproviderendpointsendsrequests
Apache ServiceMix 442
48
policies (javalangObject)
proxy orgapacheservicemixhttpProxyParameters
configurationused toestablish aproxy forsending HTTPrequests Thisconfigurationoverrides thatwhich is set atthecomponentlevel
responseContentTypeCheck boolean
Specifies if thehttp providerchecks theresponsecontent typefor the
role javalangString
HTTPendpoints canbe eitherconsumers orprovidersSpecifying
roleAsString javalangString
service javaxxmlnamespaceQName
The qualifiedname of theservice theendpointexposes
soap boolean
soapAction javalangString
soapVersion javalangString
ssl orgapacheservicemixhttpSslParameters
a beancontaining theSSLconfigurationproperties
synchronous boolean
targetEndpoint javalangString
targetInterfaceName javaxxmlnamespaceQName
targetService javaxxmlnamespaceQName
timeout int
the number ofmillisecondsbefore theendpointtimes out Thedefault valueis 0 whichmeans that theendpoint willnever timeout
wantContentTypeHeaderFromExchangeIntoHttpRequest boolean
Specifies if theHTTP providerwill copy theHTTP requestheaders intothe JBI
wsdlResource orgspringframeworkcoreioResource
Apache ServiceMix 442
49
httpconsumer
Endpoint properties
Property Name Type Description
authMethod javalangString a string naming the schemeused for authenticating users
component orgapacheservicemixcommonDefaultComponent
defaultMep javanetURIa URI representing theendpoints default MEP Thedefault is
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQNameThe qualified name of theinterface exposed by theendpoint
locationURI javalangString the URI at which the endpointlistens for requests
marshaler orgapacheservicemixhttpendpointsHttpConsumerMarshalerthe bean used to marshalHTTP messages The defaultis a
service javaxxmlnamespaceQName The qualified name of theservice the endpoint exposes
serviceUnit orgapacheservicemixcommonServiceUnit
ssl orgapacheservicemixhttpSslParameters a bean containing the SSLconfiguration properties
targetEndpoint javalangString the name of the endpoint towhich requests are sent
targetInterface javaxxmlnamespaceQName the QName of the interface towhich requests are sent
targetOperation javaxxmlnamespaceQName the QName of the operationto which requests are sent
targetService javaxxmlnamespaceQName the QName of the service towhich requests are sent
targetUri javalangStringSet the target serviceendpointinterface using aURI
timeout longthe timeout is specified inmilliseconds The defaultvalue is 0 which
httpprovider
Endpoint properties
Property Name Type Description
clientSoTimeout int
the number ofmilliseconds theendpoint will blockwhile attempting toread a request Thedefault value is 60000Setting this to 0specifies that theendpoint will nevertimeout
Apache ServiceMix 442
50
component orgapacheservicemixcommonDefaultComponent
credentials javalangString The authenticationcredentials
endpoint javalangString The name of theendpoint
expectGzippedResponse boolean
If true the accept-encoding http headerwill be set to gzip andthe response will beun-gzipped
gzipRequest boolean
If true the requestcontent will be gzippedand sent over the wireThe content-encodinghttp header will also beset to gzip
interfaceName javaxxmlnamespaceQNameThe qualified name ofthe interface exposedby the endpoint
locationURI javalangStringthe URI to which theendpoint sendsrequests
marshaler orgapacheservicemixhttpendpointsHttpProviderMarshaler
the bean used tomarshal HTTPmessages The defaultis a
principal javalangString The authenticationprincipal
providerExpirationTime int
the number ofmilliseconds to wait fora response beforeexpiring
proxyHost javalangString the host name of theHTTP proxy
proxyPassword javalangStringthe password for theHTTP proxyauthentication
proxyPort intthe host port of theHTTP proxy (defaultsto 80)
proxyUsername javalangStringthe user name for theHTTP proxyauthentication
service javaxxmlnamespaceQNameThe qualified name ofthe service theendpoint exposes
serviceUnit orgapacheservicemixcommonServiceUnit
ssl orgapacheservicemixhttpSslParameters the SSL parameters
httpsoap-consumer
Endpoint properties
Property Name Type Description
authMethod javalangString a string naming the schemeused for authenticating users
Apache ServiceMix 442
51
component orgapacheservicemixcommonDefaultComponent
defaultMep javanetURIa URI representing theendpoints default MEP Thedefault is
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQNameThe qualified name of theinterface exposed by theendpoint
locationURI javalangString the URI at which the endpointlistens for requests
marshaler orgapacheservicemixhttpendpointsHttpConsumerMarshalerthe bean used to marshalHTTP messages The defaultis a
policies (orgapacheservicemixsoapapiPolicy)a list of interceptors that willprocess messages
service javaxxmlnamespaceQName The qualified name of theservice the endpoint exposes
serviceUnit orgapacheservicemixcommonServiceUnit
soapVersion javalangStringSpecifies the SOAP version touse when generating a wsdlbinding for
ssl orgapacheservicemixhttpSslParameters a bean containing the SSLconfiguration properties
targetEndpoint javalangString the name of the endpoint towhich requests are sent
targetInterface javaxxmlnamespaceQName the QName of the interface towhich requests are sent
targetOperation javaxxmlnamespaceQName the QName of the operationto which requests are sent
targetService javaxxmlnamespaceQName the QName of the service towhich requests are sent
targetUri javalangStringSet the target serviceendpointinterface using aURI
timeout longthe timeout is specified inmilliseconds The defaultvalue is 0 which
useJbiWrapper booleanSpecifies if the JBI wrapper issent in the body of themessage Default is
validateWsdl boolean
Specifies if the WSDL ischecked for WSI-BPcompliance Default isltcodegttrueltcodegt
wsdl orgspringframeworkcoreioResourcethe URL of the WSDLdocument defining theendpoints messages
httpsoap-provider
Endpoint properties
Property Name Type Description
clientSoTimeout intthe number ofmilliseconds theendpoint will block
Apache ServiceMix 442
52
while attempting toread a request Thedefault value is 60000Setting this to 0specifies that theendpoint will nevertimeout
component orgapacheservicemixcommonDefaultComponent
credentials javalangString The authenticationcredentials
endpoint javalangString The name of theendpoint
expectGzippedResponse boolean
If true the accept-encoding http headerwill be set to gzip andthe response will beun-gzipped
gzipRequest boolean
If true the requestcontent will be gzippedand sent over the wireThe content-encodinghttp header will also beset to gzip
interfaceName javaxxmlnamespaceQNameThe qualified name ofthe interface exposedby the endpoint
locationURI javalangStringthe URI to which theendpoint sendsrequests
marshaler orgapacheservicemixhttpendpointsHttpProviderMarshaler
the bean used tomarshal HTTPmessages The defaultis a
policies (orgapacheservicemixsoapapiPolicy)a list of interceptorsthat will processmessages
principal javalangString The authenticationprincipal
providerExpirationTime int
the number ofmilliseconds to wait fora response beforeexpiring
proxyHost javalangString the host name of theHTTP proxy
proxyPassword javalangStringthe password for theHTTP proxyauthentication
proxyPort intthe host port of theHTTP proxy (defaultsto 80)
proxyUsername javalangStringthe user name for theHTTP proxyauthentication
service javaxxmlnamespaceQNameThe qualified name ofthe service theendpoint exposes
serviceUnit orgapacheservicemixcommonServiceUnit
ssl orgapacheservicemixhttpSslParameters the SSL parameters
Apache ServiceMix 442
53
useJbiWrapper boolean
Specifies if the JBIwrapper is sent in thebody of the messageDefault is
validateWsdl boolean
Specifies if the WSDL ischecked for WSI-BPcompliance Default isltcodegttrueltcodegt
wsdl orgspringframeworkcoreioResourcethe URL of the WSDLdocument defining theendpoints messages
211 servicemix-jms
Overview
ServiceMix ships with a JBI compliant JMS binding component named servicemix-jms
Here are the main features
bull JBI compliant Binding Component
bull Usable in a lightweight mode in servicemixxml configuration files
bull SOAP 11 and 12 support
bull MIME attachments
bull WS-Addressing support
bull WSDL based and XBean based deployments
bull Support for all MEPs as consumers or providers
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgjms10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnsjms=httpservicemixapacheorgjms10gtgt
lt-- add jmsconsumer jmssoap-consumer jmsjca-consumerjmsprovider jmssoap-provider and jmsjca-provider definitions here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-jms component defines six endpoint type
jmsconsumer This endpoint allows you to expose a service in the ESB to the outsideworld over JMS Whenever it receives a JMS message it will interact with the configuredservices on the ESB
jmssoap-consumer Similar to jmsconsumer but specifically geared towards handingSOAP requests and responses
Apache ServiceMix 442
54
jmsjca-consumer Similar to jmsconsumer but adds the possibility of using a JCAresource adapter
jmsprovider This endpoint allows you to access remote services from within the ESB Itwill send a JMS message whenever it receives a JBI MessageExchange
jmssoap-provider Similar to jmsprovider but specifically geared towardsperforming SOAP requests
jmsjca-provider Similar to jmsprovider but adds the possibility of using a JCAresource adapter
It also provides one additional legacy endpoints which are still available to ease migration fromServiceMix 3
jmsendpoint (Deprecated) Legacy endpoint capable to acting as a consumer orprovider based on the configuration
jmsendpoint
Endpoint properties
Property Name Type Description
activationSpec javaxresourcespiActivationSpec The ActivationSpec to use on a JCAconsumer endpoint
bootstrapContext javaxresourcespiBootstrapContext The BootstrapContext to use for a JCAconsumer endpoint
connectionFactory javaxjmsConnectionFactory A configured ConnectionFactory touse on this endpoint
defaultMep javanetURI
defaultOperation javaxxmlnamespaceQName
description orgw3cdomDocument
destination javaxjmsDestination A configured Destination to use onthis endpoint
destinationStyle javalangString
Specifies the destination type usedwith the jmsProviderDestinationNameCan be ltcodegtqueueltcodegt orltcodegttopicltcodegt
dynamic boolean
endpoint javalangString The name of the endpoint
initialContextFactory javalangString The class name of the JNDIInitialContextFactory to use
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
jmsProviderDestinationName javalangString
The name of the destination createdby a call toltcodegtSessioncreateQueueltcodegtorltcodegtSessioncreateTopicltcodegtThis property is used whenltcodegtdestinationltcodegt andltcodegtjndiDestinationNameltcodegtare both ltcodegtnullltcodegt
jmsProviderReplyToName javalangStringThe name of the reply destinationcreated by a call toltcodegtSessioncreateQueueltcodegt
Apache ServiceMix 442
55
orltcodegtSessioncreateTopicltcodegtThis property is used whenltcodegtjndiReplyToNameltcodegt isltcodegtnullltcodegt A temporaryqueue will be used if a replyTo is notprovided
jndiConnectionFactoryName javalangString
The name of the JMSConnectionFactory to lookup in JNDIUsed ifltcodegtconnectionFactoryltcodegt isltcodegtnullltcodegt
jndiDestinationName javalangString
The name of the JMS Destination tolookup in JNDI Used ifltcodegtdestinationltcodegt isltcodegtnullltcodegt
jndiProviderURL javalangString The provider URL used to create theJNDI context
jndiReplyToName javalangString
The name of the JMS Reply-todestination to lookup in JNDI If thisproperty is not set a temporaryreplyTo queue is used
marshaler orgapacheservicemixjmsJmsMarshaler
Specifies the class implementing thelogic for marshaling and unmarshalingmessages between the JMS destinationand the endpoint Defaults toltcodegtDefaultJmsMarshalerltcodegt
needJavaIdentifiers booleanIndicates if the JMS properties used bythe endpoint need to be speccompliant
policies (javalangObject)
processorName javalangString
Specifies the processor family to usefor this endpoint Can be ltulgtltligtltcodegtmultiplexingltcodegt(default)ltligtltligtltcodegtstandardltcodegtltligtltligtltcodegtjcaltcodegtltligt ltulgt
resourceAdapter javaxresourcespiResourceAdapter The ResourceAdapter to use on a JCAconsumer endpoint
role javalangString
Specifies the role of this endpointEndpoints can beltcodegtconsumerltcodegt orltcodegtproviderltcodegt
roleAsString javalangString
rollbackOnError boolean Indicates if the JBI exchange is rolledback if an error is encountered
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
soap boolean
soapVersion javalangString
store orgapacheservicemixstoreStoreSpecifies a persistent data store tohold pending exchanges for theendpoint
storeFactory orgapacheservicemixstoreStoreFactorySpecifies the factory used to createpresistent data stores for thisendpoint
synchronous boolean
Indicates if a JCA consumer endpointsends the JBI exchange synchronouslyor asynchronously This changes thetransaction boundary
Apache ServiceMix 442
56
targetEndpoint javalangString
targetInterfaceName javaxxmlnamespaceQName
targetService javaxxmlnamespaceQName
useMsgIdInResponse boolean
Indicates whether the message id ofthe request message should be usedas the correlation id in the responseor the correlation id of the request
wsdlResource orgspringframeworkcoreioResource
jmsconsumer
Endpoint properties
Property Name Type Description
cacheLevel int
Specifies the level of caching allowed by thelistener Valid values are 0 through 3 Thevalues map to the following ltulgt ltligt0 -ltcodegtCACHE_NONEltcodegtltligt ltligt1 -ltcodegtCACHE_CONNECTIONltcodegtltligtltligt2 -ltcodegtCACHE_SESSIONltcodegtltligt ltligt3- ltcodegtCACHE_CONSUMERltcodegtltligtltulgt The default isltcodegtCACHE_NONEltcodegtltbrgt Thisproperty only effects consumers whoseltcodegtlistenerTypeltcodegt property is setto ltcodegtdefaultltcodegt
clientId javalangStringSpecifies the JMS client id for a sharedltcodegtConnectionltcodegt created andused by this listener
component orgapacheservicemixcommonDefaultComponent
concurrentConsumers int
Specifies the number of concurrentconsumers created by the listener Thisproperty is only used for consumers whoseltcodegtlistenerTypeltcodegt property is setto either ltcodegtsimpleltcodegt orltcodegtdefaultltcodegt
connectionFactory javaxjmsConnectionFactorySpecifies theltcodegtConnectionFactoryltcodegt used bythe endpoint
destination javaxjmsDestination Specifies the JMS ltcodegtDestinationltcodegtused to receive messages
destinationChooser orgapacheservicemixjmsendpointsDestinationChooser Specifies a class implementing logic forchoosing reply destinations
destinationName javalangString
Specifies a string identifying the JMSdestination used to recieve messages Thedestination is resolved using theltcodegtDesitinationResolverltcodegt
destinationResolver orgspringframeworkjmssupportdestinationDestinationResolver
Specifies the class implementing logic forconverting strings into destinations Thedefault isltcodegtDynamicDestinationResolverltcodegt
durableSubscriptionName javalangString Specifies the name used to register thedurable subscription
endpoint javalangString The name of the endpoint
exceptionListener javaxjmsExceptionListener Specifies anltcodegtExceptionListenerltcodegt to notify
Apache ServiceMix 442
57
in case of a ltcodegtJMSExceptionltcodegt isthrown by the registered message listener orthe invocation infrastructure
idleTaskExecutionLimit int
Specifies the limit for idle executions of areceive task not having received any messagewithin its execution If this limit is reachedthe task will shut down and leave receiving toother executing tasks (in case of dynamicscheduling see themaxConcurrentConsumers setting) Withineach task execution a number of messagereception attempts (according to themaxMessagesPerTask setting) will each waitfor an incoming message (according to thereceiveTimeout setting) If all of thosereceive attempts in a given task returnwithout a message the task is considered idlewith respect to received messages Such atask may still be rescheduled however onceit reached the specifiedidleTaskExecutionLimit it will shut down (incase of dynamic scaling) Raise this limit ifyou encounter too frequent scaling up anddown With this limit being higher an idleconsumer will be kept around longeravoiding the restart of a consumer once anew load of messages comes in Alternativelyspecify a higher maxMessagePerTask andor receiveTimeout value which will also leadto idle consumers being kept around for alonger time (while also increasing the averageexecution time of each scheduled task)
jmsprovider
Endpoint properties
Property Name Type Description
connectionFactory javaxjmsConnectionFactorySpecifies theltcodegtConnectionFactoryltcodegt used bythe endpoint
deliveryMode intSpecifies the JMS delivery mode used for thereply Defaults to(2)(ltcodegtPERSISTENTltcodegt)
destination javaxjmsDestination Specifies the JMS ltcodegtDestinationltcodegtused to send messages
destinationChooser orgapacheservicemixjmsendpointsDestinationChooserSpecifies a class implementing logic forchoosing the destination used to sendmessages
destinationName javalangString
Specifies a string identifying the JMSdestination used to send messages Thedestination is resolved using theltcodegtDesitinationResolverltcodegt
destinationResolver orgspringframeworkjmssupportdestinationDestinationResolver
Specifies the class implementing logic forconverting strings into destinations Thedefault isltcodegtDynamicDestinationResolverltcodegt
endpoint javalangString The name of the endpoint
Apache ServiceMix 442
58
explicitQosEnabled booleanSpecifies if the QoS values specified for theendpoint are explicitly used when a messagesis sent The default is ltcodegtfalseltcodegt
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposedby the endpoint
jms102 boolean Determines if the provider used JMS 102compliant APIs
marshaler orgapacheservicemixjmsendpointsJmsProviderMarshaler
Specifies the class implementing the messagemarshaler The message marshaller isresponsible for marshalling andunmarshalling JMS messages The default isltcodegtDefaultProviderMarshalerltcodegt
messageIdEnabled boolean
Specifies if your endpoint requires JMSmessage IDs Setting theltcodegtmessageIdEnabledltcodegt propertyto ltcodegtfalseltcodegt causes the endpointto call its message producersltcodegtsetDisableMessageID() ltcodegt witha value of ltcodegttrueltcodegt The JMSbroker is then given a hint that it does notneed to generate message IDs or add them tothe messages from the endpoint The JMSbroker can choose to accept the hint orignore it
messageTimestampEnabled boolean
Specifies if your endpoints requires timestamps on its messages Setting theltcodegtmessageTimeStampEnabledltcodegtproperty to ltcodegtfalseltcodegt causes theendpoint to call its message producersltcodegtsetDisableMessageTimestamp()ltcodegt method with a value ofltcodegttrueltcodegt The JMS broker is thengiven a hint that it does not need to generatemessage IDs or add them to the messagesfrom the endpoint The JMS broker canchoose to accept the hint or ignore it
preserveMessageQos boolean
Specifies whether we want to send messageusing the QoS settings specified on themessage instead in order to preservemessage QoS The default isltcodegtfalseltcodegt
priority int Specifies the priority assigned to the JMSmessages Defaults to 4
pubSubDomain boolean
Specifies if the destination is a topicltcodegttrueltcodegt means the destinationis a topic ltcodegtfalseltcodegt means thedestination is a queue
pubSubNoLocal boolean
Specifies if messages published by thelisteners ltcodegtConnectionltcodegt aresuppressed The default isltcodegtfalseltcodegt
receiveTimeout long Specifies the timeout for receiving a messagein milliseconds
replyDestination javaxjmsDestination
Sets the reply destination This JMSdestination will be used as the defaultdestination for the response messages whenusing an InOut JBI exchange It will be used ifthe ltcodegtreplyDestinationChooserltcodegtdoes not return any value
replyDestinationChooser orgapacheservicemixjmsendpointsDestinationChooserSpecifies a class implementing logic forchoosing the destination used to recievereplies
Apache ServiceMix 442
59
replyDestinationName javalangString
Sets the name of the reply destination Thisproperty will be used to create theltcodegtreplyDestinationltcodegt using theltcodegtdestinationResolverltcodegt whenthe endpoint starts if theltcodegtreplyDestinationltcodegt has notbeen set
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
store orgapacheservicemixstoreStore
Sets the store used to store JBI exchangesthat are waiting for a response JMS messageThe store will be automatically created if notset
storeFactory orgapacheservicemixstoreStoreFactory
Sets the store factory used to create thestore If none is set a linkMemoryStoreFactory will be created and usedinstead
timeToLive long Specifies the number of milliseconds amessage is valid
jmssoap-consumer
Endpoint properties
Property Name Type Description
cacheLevel int
Specifies the level of caching allowed by thelistener Valid values are 0 through 3 Thevalues map to the following ltulgt ltligt0 -ltcodegtCACHE_NONEltcodegtltligt ltligt1 -ltcodegtCACHE_CONNECTIONltcodegtltligtltligt2 -ltcodegtCACHE_SESSIONltcodegtltligt ltligt3- ltcodegtCACHE_CONSUMERltcodegtltligtltulgt The default isltcodegtCACHE_NONEltcodegtltbrgt Thisproperty only effects consumers whoseltcodegtlistenerTypeltcodegt property is setto ltcodegtdefaultltcodegt
clientId javalangStringSpecifies the JMS client id for a sharedltcodegtConnectionltcodegt created andused by this listener
component orgapacheservicemixcommonDefaultComponent
concurrentConsumers int
Specifies the number of concurrentconsumers created by the listener Thisproperty is only used for consumers whoseltcodegtlistenerTypeltcodegt property is setto either ltcodegtsimpleltcodegt orltcodegtdefaultltcodegt
connectionFactory javaxjmsConnectionFactorySpecifies theltcodegtConnectionFactoryltcodegt used bythe endpoint
destination javaxjmsDestination Specifies the JMS ltcodegtDestinationltcodegtused to receive messages
destinationChooser orgapacheservicemixjmsendpointsDestinationChooser Specifies a class implementing logic forchoosing reply destinations
destinationName javalangString
Specifies a string identifying the JMSdestination used to recieve messages Thedestination is resolved using theltcodegtDesitinationResolverltcodegt
Apache ServiceMix 442
60
destinationResolver orgspringframeworkjmssupportdestinationDestinationResolver
Specifies the class implementing logic forconverting strings into destinations Thedefault isltcodegtDynamicDestinationResolverltcodegt
durableSubscriptionName javalangString Specifies the name used to register thedurable subscription
endpoint javalangString The name of the endpoint
exceptionListener javaxjmsExceptionListener
Specifies anltcodegtExceptionListenerltcodegt to notifyin case of a ltcodegtJMSExceptionltcodegt isthrown by the registered message listener orthe invocation infrastructure
idleTaskExecutionLimit int
Specifies the limit for idle executions of areceive task not having received any messagewithin its execution If this limit is reachedthe task will shut down and leave receiving toother executing tasks (in case of dynamicscheduling see themaxConcurrentConsumers setting) Withineach task execution a number of messagereception attempts (according to themaxMessagesPerTask setting) will each waitfor an incoming message (according to thereceiveTimeout setting) If all of thosereceive attempts in a given task returnwithout a message the task is considered idlewith respect to received messages Such atask may still be rescheduled however onceit reached the specifiedidleTaskExecutionLimit it will shut down (incase of dynamic scaling) Raise this limit ifyou encounter too frequent scaling up anddown With this limit being higher an idleconsumer will be kept around longeravoiding the restart of a consumer once anew load of messages comes in Alternativelyspecify a higher maxMessagePerTask andor receiveTimeout value which will also leadto idle consumers being kept around for alonger time (while also increasing the averageexecution time of each scheduled task)
jmssoap-provider
Endpoint properties
Property Name Type Description
connectionFactory javaxjmsConnectionFactorySpecifies theltcodegtConnectionFactoryltcodegt used bythe endpoint
deliveryMode intSpecifies the JMS delivery mode used for thereply Defaults to(2)(ltcodegtPERSISTENTltcodegt)
destination javaxjmsDestination Specifies the JMS ltcodegtDestinationltcodegtused to send messages
destinationChooser orgapacheservicemixjmsendpointsDestinationChooserSpecifies a class implementing logic forchoosing the destination used to sendmessages
destinationName javalangString Specifies a string identifying the JMSdestination used to send messages The
Apache ServiceMix 442
61
destination is resolved using theltcodegtDesitinationResolverltcodegt
destinationResolver orgspringframeworkjmssupportdestinationDestinationResolver
Specifies the class implementing logic forconverting strings into destinations Thedefault isltcodegtDynamicDestinationResolverltcodegt
endpoint javalangString The name of the endpoint
explicitQosEnabled booleanSpecifies if the QoS values specified for theendpoint are explicitly used when a messagesis sent The default is ltcodegtfalseltcodegt
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposedby the endpoint
jms102 boolean Determines if the provider used JMS 102compliant APIs
marshaler orgapacheservicemixjmsendpointsJmsProviderMarshaler
Specifies the class implementing the messagemarshaler The message marshaller isresponsible for marshalling andunmarshalling JMS messages The default isltcodegtDefaultProviderMarshalerltcodegt
messageIdEnabled boolean
Specifies if your endpoint requires JMSmessage IDs Setting theltcodegtmessageIdEnabledltcodegt propertyto ltcodegtfalseltcodegt causes the endpointto call its message producersltcodegtsetDisableMessageID() ltcodegt witha value of ltcodegttrueltcodegt The JMSbroker is then given a hint that it does notneed to generate message IDs or add them tothe messages from the endpoint The JMSbroker can choose to accept the hint orignore it
messageTimestampEnabled boolean
Specifies if your endpoints requires timestamps on its messages Setting theltcodegtmessageTimeStampEnabledltcodegtproperty to ltcodegtfalseltcodegt causes theendpoint to call its message producersltcodegtsetDisableMessageTimestamp()ltcodegt method with a value ofltcodegttrueltcodegt The JMS broker is thengiven a hint that it does not need to generatemessage IDs or add them to the messagesfrom the endpoint The JMS broker canchoose to accept the hint or ignore it
policies (orgapacheservicemixsoapapiPolicy)Specifies an array of interceptors used toprocess SOAP messages
preserveMessageQos boolean
Specifies whether we want to send messageusing the QoS settings specified on themessage instead in order to preservemessage QoS The default isltcodegtfalseltcodegt
priority int Specifies the priority assigned to the JMSmessages Defaults to 4
pubSubDomain boolean
Specifies if the destination is a topicltcodegttrueltcodegt means the destinationis a topic ltcodegtfalseltcodegt means thedestination is a queue
pubSubNoLocal boolean
Specifies if messages published by thelisteners ltcodegtConnectionltcodegt aresuppressed The default isltcodegtfalseltcodegt
Apache ServiceMix 442
62
receiveTimeout long Specifies the timeout for receiving a messagein milliseconds
replyDestination javaxjmsDestination
Sets the reply destination This JMSdestination will be used as the defaultdestination for the response messages whenusing an InOut JBI exchange It will be used ifthe ltcodegtreplyDestinationChooserltcodegtdoes not return any value
replyDestinationChooser orgapacheservicemixjmsendpointsDestinationChooserSpecifies a class implementing logic forchoosing the destination used to recievereplies
replyDestinationName javalangString
Sets the name of the reply destination Thisproperty will be used to create theltcodegtreplyDestinationltcodegt using theltcodegtdestinationResolverltcodegt whenthe endpoint starts if theltcodegtreplyDestinationltcodegt has notbeen set
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
store orgapacheservicemixstoreStore
Sets the store used to store JBI exchangesthat are waiting for a response JMS messageThe store will be automatically created if notset
storeFactory orgapacheservicemixstoreStoreFactory
Sets the store factory used to create thestore If none is set a linkMemoryStoreFactory will be created and usedinstead
timeToLive long Specifies the number of milliseconds amessage is valid
useJbiWrapper booleanSpecifies if the endpoint expects SOAPmessages to be wrapped in the JBI wrapperDefaults to ltcodegttrueltcodegt
validateWsdl boolean Specifies if the WSDL is checked WSI-BPcompliance Defaults to ltcodegttrueltcodegt
wsdl orgspringframeworkcoreioResource Specifies the WSDL document describing theservices interface
jmsjca-consumer
Endpoint properties
Property Name Type Description
activationSpec javaxresourcespiActivationSpec Specifies the activation information neededby the endpoint
bootstrapContext javaxresourcespiBootstrapContext
Specifies theltcodegtBootStrapContextltcodegt used tostart the resource adapter If this property isnot set a defaultltcodegtBootstrpContextltcodegt will becreated
connectionFactory javaxjmsConnectionFactorySpecifies theltcodegtConnectionFactoryltcodegt used bythe endpoint
destinationChooser orgapacheservicemixjmsendpointsDestinationChooser Specifies a class implementing logic forchoosing reply destinations
destinationResolver orgspringframeworkjmssupportdestinationDestinationResolver Specifies the class implementing logic forconverting strings into destinations The
Apache ServiceMix 442
63
default isltcodegtDynamicDestinationResolverltcodegt
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposedby the endpoint
jms102 booleanSpecifies if the consumer uses JMS 102compliant APIs Defaults toltcodegtfalseltcodegt
marshaler orgapacheservicemixjmsendpointsJmsConsumerMarshaler
Specifies the class implementing the messagemarshaler The message marshaller isresponsible for marshalling andunmarshalling JMS messages The default isltcodegtDefaultConsumerMarshalerltcodegt
pubSubDomain boolean
Specifies if the destination is a topicltcodegttrueltcodegt means the destinationis a topic ltcodegtfalseltcodegt means thedestination is a queue
replyDeliveryMode intSpecifies the JMS delivery mode used for thereply Defaults to2(ltcodegtPERSISTENTltcodegt)
replyDestination javaxjmsDestination
Specifies the JMS ltcodegtDestinationltcodegtfor the replies If this value is not set theendpoint will use theltcodegtdestinationChooserltcodegt propertyor the ltcodegtreplyDestinationNameltcodegtproperty to determine the desitination to use
replyDestinationName javalangString
Specifies the name of the JMS destination touse for the reply The actual JMS destinationis resolved using theltcodegtDestinationResolverltcodegtspecified by theltcodegtdestinationResolverltcodegtproperty
replyExplicitQosEnabled booleanSpecifies if the QoS values specified for theendpoint are explicitly used when the reply issent The default is ltcodegtfalseltcodegt
replyPriority int Specifies the JMS message priority of thereply Defaults to 4
replyProperties javautilMap Specifies custom properties to be placed inthe replys JMS header
replyTimeToLive long Specifies the number of milliseconds the replymessage is valid The default is unlimited
resourceAdapter javaxresourcespiResourceAdapter Specifies the resource adapter used for theendpoint
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
stateless booleanSpecifies if the consumer retains stateinformation about the message exchangewhile it is in process
store orgapacheservicemixstoreStore
Specifies the persistent store used to store JBIexchanges that are waiting to be processedThe store will be automatically created if notset and the endpointsltcodegtstatelessltcodegt property is set toltcodegtfalseltcodegt
storeFactory orgapacheservicemixstoreStoreFactory
Specifies the store factory used to create thestore If none is set and the endpointsltcodegtstatelessltcodegt property is set toltcodegtfalseltcodegt a link
Apache ServiceMix 442
64
MemoryStoreFactory will be created and usedinstead
synchronous boolean
Specifies if the consumer will block whilewaiting for a response This means theconsumer can only process one message at atime Defaults to ltcodegttrueltcodegt
targetEndpoint javalangString the name of the endpoint to which requestsare sent
targetInterface javaxxmlnamespaceQName the QName of the interface to which requestsare sent
targetOperation javaxxmlnamespaceQName the QName of the operation to whichrequests are sent
targetService javaxxmlnamespaceQName the QName of the service to which requestsare sent
targetUri javalangString Set the target serviceendpointinterfaceusing a URI
useMessageIdInResponse javalangBoolean
Specifies if the request messages ID is usedas the replys correlation ID The defaultbehavior is to use the requests correlation IDSetting this to ltcodegttrueltcodegt meansthe requests message ID will be used instead
212 servicemix-mail
Overview
he ServiceMix Mail component provides support for receiving and sending mails via the enterpriseservice bus
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgmail10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnsmail=httpservicemixapacheorgmail10gtgt
lt-- add mailpoller and mailsender definitions here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-mail component defines two endpoint type
mailpoller Connect to a POP3 or IMAP server and send a MessageExchange for everymail
mailsender Connect to an SMTP server and send a mail for every JBI MessageExchangeit receives
Apache ServiceMix 442
65
mailpoller
Endpoint properties
Property Name Type Description
concurrentPolling boolean Sets whether more than one poll can be active at a time (true means yes) Defaultvalue is ltcodegtfalseltcodegt
connection javalangString
ltpgtSpecifies the connection URI used to connect to a mail server ltbr gtltbr gtltbgtltugtTemplatesltugtltbgt ltbr gtnbsp igtltrotocolgtltsergtltostgtltortgtltoldergtpassword=ltasswordgtigt ltbr
gtltbgt nbsp nbsp nbspORltbgtltbrgtnbsp igtltrotocolgtltostgtltortgtltoldergtuser=ltsergtpassword=ltasswordgtigt
ltbr gtltbr gt ltbgtltugtDetailsltugtltbgtltbr gtltbrgt lttable border=0cellpadding=0 cellspacing=0gt lttrgt lttd width=40align=leftgtltbgtltugtNameltugtltbgtlttdgt lttd width=60align=leftgtltbgtltugtDescriptionltugtltbgtlttdgt lttrgt lttrgtlttdgtprotocollttdgt lttdgtthe protocol to use (example pop3 or imap)lttdgtlttrgt lttrgt lttdgtuserlttdgt lttdgtthe user name used to log into an accountlttdgtlttrgt lttrgt lttdgthostlttdgt lttdgtthe name or ip address of the mail serverlttdgtlttrgt lttrgt lttdgtportlttdgt lttdgtthe port number to use (optional)lttdgt lttrgtlttrgt lttdgtfolderlttdgt lttdgtthe folder to poll from (optional)lttdgt lttrgt lttrgtlttdgtpasswordlttdgt lttdgtthe password for the loginlttdgt lttrgt lttablegtltbrgt ltbgtltugtExamplesltugtltbgtltbr gtnbsp igtimaplheinimapserver143INBOXpassword=mypassltigtltbr gtnbsp igtpop3pop3server
INBOXuser=memyhomeorgpassword=mypassltigtltpgt ltigt nbsp he defaultvalue is ltbgtnullltbgtltigtltbrgtltbrgt
customProperties javautilMap
ltpgtSpecifies a ltcodegtjavautilMapltcodegt which may contain additionalproperties for the connection ltbrgt ltbrgtltbgtltugtExample for disabling TOP forPOP3 headersltugtltbgtltbr gt igtltbgtkeyltbgt mailpop3disabletopltigt ltbrgt igtltbgtvalueltbgt trueltigtltpgt ltigt nbsp he default value isltbgtnullltbgtltigtltbrgtltbrgt
customTrustManagers javalangString
ltpgtSpecifies one or more trust manager classes separated by a semicolon(ltbgtltbgt)ltbrgt These classes have to implement theltcodegtTrustmanagerltcodegt interface and need to provide an empty defaultconstructor to be validltbrgtltbr gt If you want to accept all security certificateswithout a check you may consider using the ltcodegtDummyTrustManagerltcodegtclass It is actually only an empty stub without any checking logic ltbrgtltbgtButbe aware that this will be a security risk in production environments ltbgtltpgtltigt nbsp he default value is ltbgtnullltbgtltigtltbrgtltbrgt
debugMode boolean
ltpgtSpecifies if the JavaMail is run in ltcodegtDEBUGltcodegt mode This meansthat while connecting to server and processing mails a detailed log is written todebug output ltbr gt This mode is very handy if you are experiencing problemswith your mail server connection and you want to find out what is going wrong incommunication with the server ltbr gtltbr gt nbsp bgttrueltbgt - ltigtthe debugmode is ltbgtenabledltbgtltigt ltbr gt nbsp bgtfalseltbgt - ltigtthe debug modeis ltbgtdisabledltbgtltigtltpgt ltigt nbsp he default value isltbgtfalseltbgtltigtltbrgtltbrgt
delay long Sets the amount of time in milliseconds that the endpoint should wait beforemaking the first poll
deleteProcessedMessages boolean
ltpgtThis flag is used to indicate what happens to a processed mail polled from amail folder If it is set to ltcodegttrueltcodegt the mail will be deleted after it wassent into the bus successfully If set to ltcodegtfalseltcodegt the mail will resideinside the mail folder but will be marked as already seenltbrgt If the sending ofthe mail results in an error the mail will not be deleted marked and reprocessedon next run of the polling cycleltpgt ltigt nbsp he default value isltbgtfalseltbgtltigt
endpoint javalangString The name of the endpoint
firstTime javautilDate Sets the date on which the first poll will be executed If a delay is also set usingltcodegtsetDelayltcodegt the delay interval will be added after the date specified
Apache ServiceMix 442
66
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by the endpoint
marshaler orgapacheservicemixmailmarshalerAbstractMailMarshaler
ltpgtWith this method you can specify a marshaler class which provides the logicfor converting a mail into a normalized message This class has to extend theabstract class ltcodegtAbstractMailMarshalerltcodegt or an extending class If youdont specify a marshaler the ltcodegtDefaultMailMarshalerltcodegt will beusedltpgt
maxFetchSize int
ltpgtThis sets the maximum amount of mails to process within one polling cycle Ifthe maximum amount is reached all other mails in unseen state will beskippedltpgt ltigt nbsp he default value is ltbgt-1(unlimited)ltbgtltigtltbrgtltbrgt
period long Sets the number of milliseconds between polling attempts
processOnlyUnseenMessages boolean
ltpgtThis flag is used to indicate whether all mails are polled from a mail folder oronly the unseen mails are processedltbrgtltbr gt If it is set toltbgtltcodegttrueltcodegtltbgt only the unseen mails will be processedltbr gt Ifit is set to ltbgtltcodegtfalseltcodegtltbgt all mails will be processedltbrgtltpgtltigt nbsp he default value is ltbgttrueltbgtltigtltbrgtltbrgt
scheduler orgapacheservicemixcommonschedulerScheduler Set a custom Scheduler implementation if you need more fine-grained control overthe polling schedule
service javaxxmlnamespaceQName The qualified name of the service the endpoint exposes
storage orgapacheservicemixstoreStore
ltpgtSpecifies a ltcodegtorgapacheservicemixstoreStoreltcodegt object whichwill be used for storing the identifications of already processed messagesltbrgtltbgtThis store is only used with the POP3 protocol and if unseen mails areprocessed onlyltbgtltpgt ltigt nbsp he default value isltbgtnullltbgtltigtltbrgtltbrgt
targetEndpoint javalangString the name of the endpoint to which requests are sent
targetInterface javaxxmlnamespaceQName the QName of the interface to which requests are sent
targetOperation javaxxmlnamespaceQName the QName of the operation to which requests are sent
targetService javaxxmlnamespaceQName the QName of the service to which requests are sent
targetUri javalangString Set the target serviceendpointinterface using a URI
mailsender
Endpoint properties
Property Name Type Description
connection javalangString
ltpgtSpecifies the connection URI used to connect to a mail server ltbr gtltbr gtltbgtltugtTemplatesltugtltbgt ltbr gtnbsp igtltrotocolgtltsergtltostgtltortgtltoldergtpassword=ltasswordgtigt ltbr
gtltbgt nbsp nbsp nbspORltbgtltbrgtnbsp igtltrotocolgtltostgtltortgtltoldergtuser=ltsergtpassword=ltasswordgtigt
ltbr gtltbr gt ltbgtltugtDetailsltugtltbgtltbr gtltbrgt lttable border=0cellpadding=0 cellspacing=0gt lttrgt lttd width=40align=leftgtltbgtltugtNameltugtltbgtlttdgt lttd width=60align=leftgtltbgtltugtDescriptionltugtltbgtlttdgt lttrgt lttrgtlttdgtprotocollttdgt lttdgtthe protocol to use (example pop3 or imap)lttdgtlttrgt lttrgt lttdgtuserlttdgt lttdgtthe user name used to log into an accountlttdgtlttrgt lttrgt lttdgthostlttdgt lttdgtthe name or ip address of the mail serverlttdgtlttrgt lttrgt lttdgtportlttdgt lttdgtthe port number to use (optional)lttdgt lttrgtlttrgt lttdgtfolderlttdgt lttdgtthe folder to poll from (optional)lttdgt lttrgt lttrgtlttdgtpasswordlttdgt lttdgtthe password for the loginlttdgt lttrgt lttablegtltbrgt ltbgtltugtExampleltugtltbgtltbr gtnbsp igtsmtplheinmyserverpassword=myPassltigtltbr gtltpgt
ltigt nbsp he default value is ltbgtnullltbgtltigtltbrgtltbrgt
customProperties javautilMap
ltpgtSpecifies a ltcodegtjavautilMapltcodegt which may contain additionalproperties for the connection ltbrgt ltbrgtltbgtltugtExample for disabling TOP forPOP3 headersltugtltbgtltbr gt igtltbgtkeyltbgt mailpop3disabletopltigt ltbrgt igtltbgtvalueltbgt trueltigtltpgt ltigt nbsp he default value isltbgtnullltbgtltigtltbrgtltbrgt
Apache ServiceMix 442
67
customTrustManagers javalangString
ltpgtSpecifies one or more trust manager classes separated by a semicolon(ltbgtltbgt)ltbrgt These classes have to implement theltcodegtTrustmanagerltcodegt interface and need to provide an empty defaultconstructor to be validltbrgtltbr gt If you want to accept all security certificateswithout a check you may consider using the ltcodegtDummyTrustManagerltcodegtclass It is actually only an empty stub without any checking logic ltbrgtltbgtButbe aware that this will be a security risk in production environments ltbgtltpgtltigt nbsp he default value is ltbgtnullltbgtltigtltbrgtltbrgt
debugMode boolean
ltpgtSpecifies if the JavaMail is run in ltcodegtDEBUGltcodegt mode This meansthat while connecting to server and processing mails a detailed log is written todebug output ltbr gt This mode is very handy if you are experiencing problemswith your mail server connection and you want to find out what is going wrong incommunication with the server ltbr gtltbr gt nbsp bgttrueltbgt - ltigtthe debugmode is ltbgtenabledltbgtltigt ltbr gt nbsp bgtfalseltbgt - ltigtthe debug modeis ltbgtdisabledltbgtltigtltpgt ltigt nbsp he default value isltbgtfalseltbgtltigtltbrgtltbrgt
endpoint javalangString The name of the endpoint
ignoreMessageProperties (javalangObject)
ltpgtSpecifies a ltcodegtjavautilListltcodegt which may contain messageproperties to skip ltbrgt ltbrgtltbgtltugtExample for skipping all kind ofaddresses from the normalized messageltugtltbgtltbr gt igtltbgtvalueltbgtorgapacheservicemixmailtoltigt ltbr gt igtltbgtvalueltbgtorgapacheservicemixmailccltigt ltbr gt igtltbgtvalueltbgtorgapacheservicemixmailbccltigt ltbr gt igtltbgtvalueltbgtorgapacheservicemixmailfromltigt ltbr gt igtltbgtvalueltbgtorgapacheservicemixmailreplytoltigt ltbr gtltpgt ltigt nbsp he default valueis ltbgtnullltbgtltigtltbrgtltbrgt
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by the endpoint
marshaler orgapacheservicemixmailmarshalerAbstractMailMarshaler
ltpgtWith this method you can specify a marshaler class which provides the logicfor converting a normalized message into a mail This class has to extend theabstract class ltcodegtAbstractMailMarshalerltcodegt or an extending class If youdont specify a marshaler the ltcodegtDefaultMailMarshalerltcodegt will beusedltpgt
receiver javalangString ltpgtSpecifies the receiver address(es) of the mail which is being sentltpgtltigt nbsp he default value is ltbgtnullltbgtltigtltbrgtltbrgt
sender javalangString ltpgtSpecifies the sender address of the mail which is being sentltpgtltigt nbsp he default value is ltbgtno-replylocalhostltbgtltigtltbrgtltbrgt
service javaxxmlnamespaceQName The qualified name of the service the endpoint exposes
213 servicemix-osworkflow
Overview
The ServiceMix OSWorkflow component provides workflow functionality to the ESB You can specifyone or more workflows and its processing will start when a valid message is received
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgosworkflow10 This is an example of an xbeanxml file with a namespace definition with prefixbean
ltbeansltbeans xmlnsosworkflow=httpservicemixapacheorgosworkflow10gtgt
lt-- add osworkflowendpoint here --gt
ltbeansgtltbeansgt
Apache ServiceMix 442
68
Endpoint types
The servicemix-osworkflow component defines a single endpoint type
osworkflowendpoint The endpoint will receive messages from the NMR and will thenstart the processing of the workflow
osworkflowendpoint
Endpoint properties
PropertyName
Type Description
action int The initial action to trigger in the workflow
caller javalangString The caller user name to be used when executing the workflow
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by the endpoint
service javaxxmlnamespaceQName The qualified name of the service the endpoint exposes
workflowName javalangString The name of the workflow to be used for handling theexchange
214 servicemix-quartz
Overview
The servicemix-quartz component is a standard JBI Service Engine able to schedule and trigger jobsusing the great Quartz scheduler
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgquartz10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnsosworkflow=httpservicemixapacheorgquartz10gtgt
lt-- add quartzendpoint here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-quartz component defines a single endpoint type
quartzendpoint The quartz endpoint can be used to fire message exchanges at a given(recurrent) time
Apache ServiceMix 442
69
quartzendpoint
Endpoint properties
Property Name Type Description
calendars javautilMapA map with linkorgquartzCalendar instances todefine the trigger schedule
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
jobDetail orgquartzJobDetail Set a custom JobDetail bean to beused in the triggered events
marshaler orgapacheservicemixquartzsupportQuartzMarshalerSet a custom marshaler class totranslate the JobDetail informationinto a normalized message
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
targetEndpoint javalangString the name of the endpoint to whichrequests are sent
targetInterface javaxxmlnamespaceQName the QName of the interface to whichrequests are sent
targetOperation javaxxmlnamespaceQName the QName of the operation to whichrequests are sent
targetService javaxxmlnamespaceQName the QName of the service to whichrequests are sent
targetUri javalangString Set the target serviceendpointinterface using a URI
trigger orgquartzTriggerA single link orgquartzTriggerinstance to define the triggerschedule
triggers (javalangObject)
A list of of link orgquartzTriggerinstances to allow configuringmultiple schedules for the sameendpoint
215 servicemix-saxon
Overview
The servicemix-saxon component is a standard JBI Service Engine for XSLT XQuery Thiscomponent is based on Saxon and supports XSLT 20 and XPath 20 and XQuery 10
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgsaxon10 This is an example of xbeanxml file with a namespace definition with prefix saxon
ltbeansltbeans xmlnssaxon=httpservicemixapacheorgsaxon 10gtgt
lt-- add saxonxslt saxonxquery or saxonproxy definitions here --gt
ltbeansgtltbeansgt
Apache ServiceMix 442
70
Endpoint types
The servicemix-saxon component defines these endpoints
bull saxonxslt Translates the in message content using XSLT to send back the translatedcontent in the out message
bull saxonproxy Acts as a proxy for an endpoint translating the message passed tofrom theendpoint using XSLT
bull saxonxquery Use xquery to extract parts of the XML
Endpoint saxonxslt
The XSLT endpoint can be used to apply an XSLT stylesheet to the incoming exchange and willreturn the transformed result as the output message
ltsaxonxsltltsaxonxslt service=testxslt endpoint=endpointresource=classpathtransformxsl gtgt
Endpoint properties
Property Name Type Description
configuration netsfsaxonConfiguration Additional configuration for theSaxon XSL-TXQuery processor
copyAttachments boolean
Copy attachments into theresulting normalized messageDefaults toltcodegttrueltcodegt
copyProperties boolean
Copy properties into theresulting normalized messageDefaults toltcodegttrueltcodegt
copySubject boolean
Copy the security subject intothe resulting normalizedmessage Defaults toltcodegttrueltcodegt
endpoint javalangString The name of the endpoint
expression orgapacheservicemixexpressionExpressionExpression to dynamicallydetermine the stylesheet to usefor processing the exchange
interfaceName javaxxmlnamespaceQNameThe qualified name of theinterface exposed by theendpoint
parameters javautilMapAdd parameter names andvalues that are available duringXSLXQuery processing
reload boolean
Sets whether the endpointshould reload the resource eachtime it is used A value ofltcodegttrueltcodegt willensure that the resource is notcached which can be useful ifthe resource is updatedregularly and is stored outsideof the service unit
Apache ServiceMix 442
71
resource orgspringframeworkcoreioResource Spring Resource for the XSL-Tstylesheet or XQuery file to use
result javalangStringThe output result type possiblevalues are dom bytes stringDefaults to dom
service javaxxmlnamespaceQName The qualified name of theservice the endpoint exposes
sourceTransformer orgapacheservicemixjbijaxpSourceTransformerSet a SourceTransformerinstance to use for handlingXML conversions
transformerFactory javaxxmltransformTransformerFactory
Set a transform factory eg forinjecting a custom transformerconfiguration orimplementation
useDomSourceForContent javalangBoolean
Convert the message bodySource into a DOMSourceDefaults toltcodegtfalselttruegt
useDomSourceForXslt boolean
Convert the XSL-T stylesheetSource into a DOMSourceDefaults toltcodegttruelttruegt
wsdlResource orgspringframeworkcoreioResourceResource referring to the WSDLresource that defines thisendpoint
Mandatory properties
The endpoint requires one of these two properties to be specified
Attribute Type description
resource (Spring resource) the spring resource pointing to the XSLT stylesheet
expression (ServiceMix expression) expression used to dynamically load the stylesheet
Optional properties
Attribute Type description
wsdlResource (Spring resource)if set the wsdl will be retrieved from the given Springresource
transformerFactory(TransformerFactorydefaults to the Saxonimplementation)
TraX factory to create transformers
configuration (Saxon configuration) Saxon configuration object
result (String defaults to dom)Allows specifying the output result type possiblevalues are dom bytes string
copyAttachmentscopyProperties andcopySubject
(default to true Configure to copy message attachments properties andsecurity subject over to the result message
useDomSourceForXslt (defaults to truewhen set to true forces the transformation of the xsltstylesheet into a DOM document before giving it to thetransformer
useDomSourceForContent (defaults to false)when set to true forces the transformation of theincoming JBI message into a DOM document beforegiving it to the transformer
Apache ServiceMix 442
72
parameters a Map containing additional parameters to give to thetransformation engine
Using properties and parameters
All properties defined on the JBI exchange and input JBI message will be available for use inside theXSLT stylesheet as parameters
In addition to those properties and the one specified in the parameters property on the endpointthe following objects are also available
bull exchange the JBI exchange
bull in the input JBI NormalizedMessage
bull component the XsltEndpoint instance being called
Below is an example that demonstrates how the properties of the exchange and normalizedmessage can be accessed from inside the xslt
ltxml version=10 encoding=windows-1253gtltxslstylesheetltxslstylesheet xmlnsxsl=httpwwww3org1999XSLTransform version=20
xmlnsclass=httpsaxonsfnetjava-typexmlnsme=javajavaxjbimessagingMessageExchangexmlnsnm=javajavaxjbimessagingNormalizedMessagegtgt
ltxsloutputltxsloutput method=xml indent=yes encoding=ISO-8859-1gtgtltxslparamltxslparam name=exchange as=classjavaxjbimessagingMessageExchangegtgtltxslparamltxslparam name=in as=classjavaxjbimessagingNormalizedMessagegtgt
ltxsltemplateltxsltemplate match=gtgtltmessagegtltmessagegt
lt-- The value of messageId will be read from thr property MSG_ID of the in NormalizedMessage --gtltmessageIdgtltmessageIdgt
ltxslvalue-ofltxslvalue-of select=nmgetProperty($in MSG_ID)gtgtltmessageIdgtltmessageIdgt
ltmessagegtltmessagegtltxslstylesheetgtltxslstylesheetgt
All those parameters can be accessed using XSLT standard ways using ltxslparamgt
Endpoint saxonproxy
One common use case is the need to transform a request coming from a service and send it toanother service and do the same with the response A simple example is the need to translate therequest and responses between two SOAP endpoints Such a use case could be implemented usingtwo XSLT endpoints and an EIP StaticRoutingSlip However there are some drawbacks as theoperation is lost in the process and a static routing slip can not be used to process InOnlyexchanges
ltsaxonproxyltsaxonproxy service=testproxy endpoint=endpointresource=classpathtransform-inxsloutResource=classpathtransform-outxslfaultResource=classpathtransform-faultxslgtgt
ltsaxontargetgtltsaxontargetgtltsaxonexchange-targetltsaxonexchange-target service=testecho gtgt
ltsaxontargetgtltsaxontargetgtltsaxonproxygtltsaxonproxygt
Apache ServiceMix 442
73
Endpoint properties
Property Name Type Description
configuration netsfsaxonConfiguration Additional configuration for the Saxon XSL-TXQueryprocessor
copyAttachments boolean Copy attachments into the resulting normalized messageDefaults to ltcodegttrueltcodegt
copyProperties boolean Copy properties into the resulting normalized messageDefaults to ltcodegttrueltcodegt
copySubject boolean Copy the security subject into the resulting normalizedmessage Defaults to ltcodegttrueltcodegt
endpoint javalangString The name of the endpoint
expression orgapacheservicemixexpressionExpression Expression to dynamically determine the stylesheet to usefor processing the exchange
faultResource orgspringframeworkcoreioResource Spring Resource for the XSL-T stylesheet or XQuery file touse for transforming the fault message
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by theendpoint
outResource orgspringframeworkcoreioResource Spring Resource for the XSL-T stylesheet or XQuery file touse for transforming the out message
parameters javautilMap Add parameter names and values that are available duringXSLXQuery processing
reload boolean
Sets whether the endpoint should reload the resource eachtime it is used A value of ltcodegttrueltcodegt will ensurethat the resource is not cached which can be useful if theresource is updated regularly and is stored outside of theservice unit
resource orgspringframeworkcoreioResource Spring Resource for the XSL-T stylesheet or XQuery file touse
result javalangString The output result type possible values are dom bytesstring Defaults to dom
service javaxxmlnamespaceQName The qualified name of the service the endpoint exposes
sourceTransformer orgapacheservicemixjbijaxpSourceTransformer Set a SourceTransformer instance to use for handling XMLconversions
store orgapacheservicemixstoreStore
Configure a custom Store implementation to storecorrelation information Usually a store factory isconfigured instead of a store Defaults to linkorgapacheservicemixstorememoryMemoryStore
storeFactory orgapacheservicemixstoreStoreFactoryConfigure a custom StoreFactory implementation to storecorrelation information Defaults to linkorgapacheservicemixstorememoryMemoryStoreFactory
target orgapacheservicemixsaxonsupportExchangeTarget Set the target endpoint that is being proxied by theltcodegtxsltproxyltcodegt endpoint
transformerFactory javaxxmltransformTransformerFactory Set a transform factory eg for injecting a customtransformer configuration or implementation
useDomSourceForContent javalangBoolean Convert the message body Source into a DOMSourceDefaults to ltcodegtfalselttruegt
useDomSourceForXslt boolean Convert the XSL-T stylesheet Sources into a DOMSourceDefaults to ltcodegttruelttruegt
wsdlResource orgspringframeworkcoreioResource Resource referring to the WSDL resource that defines thisendpoint
Apache ServiceMix 442
74
Mandatory properties
Depending on the MEP you have to set one or more XSL stylesheets to be used for converting themessage payloads
Attribute Type Description
resource Springresource
the XSLT stylesheet used to transform the input message
outResource Springresource
the XSLT stylesheet used to transform the output message
faultResource Springresource
the XSLT stylesheet used to transform the fault message
expression ServiceMixexpression
used to dynamically load the stylesheet If set it will prevail against allresource outResource and faultResource attributes
You also have to specify the target service that should be invoked from this endpoint
bull target ExchangeTarget that specifies the target service for the proxy endpoint
Optional properties
Attribute Type Description
wsdlResource Spring resourceif set the wsdl will beretrieved from the given(Spring resource)
transformerFactory (defaults to theSaxon implementation) TraXTransformerFactory to create transformers
configuration (Saxon configuration)
result(defaults to dom) Allows specifyingthe output result type possible valuesare dom bytes string
copyAttachmentscopyProperties andcopySubject
Endpoint saxonxquery
The XQuery endpoint can be used to apply a selected XQuery to the input document
ltsaxonxqueryltsaxonxquery service=testxquery endpoint=endpointresource=classpathqueryxq gtgt
Endpoint properties
Property Name Type Description
configuration netsfsaxonConfiguration Additional configuration for the SaxonXSL-TXQuery processor
copyAttachments booleanCopy attachments into the resultingnormalized message Defaults toltcodegttrueltcodegt
copyProperties booleanCopy properties into the resultingnormalized message Defaults toltcodegttrueltcodegt
Apache ServiceMix 442
75
copySubject booleanCopy the security subject into theresulting normalized messageDefaults to ltcodegttrueltcodegt
endpoint javalangString The name of the endpoint
expression orgapacheservicemixexpressionExpressionExpression to dynamically determinethe stylesheet to use for processing theexchange
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
outputProperties javautilProperties
Configure serialization properties inJAXP format if the result is to beserialized This parameter can bedefaulted to null
parameters javautilMapAdd parameter names and values thatare available during XSLXQueryprocessing
query javalangString Configure the XQuery expression toevaluate
reload boolean
Sets whether the endpoint shouldreload the resource each time it isused A value of ltcodegttrueltcodegtwill ensure that the resource is notcached which can be useful if theresource is updated regularly and isstored outside of the service unit
resource orgspringframeworkcoreioResource Spring Resource for the XSL-Tstylesheet or XQuery file to use
result javalangStringThe output result type possible valuesare dom bytes string Defaults todom
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
sourceTransformer orgapacheservicemixjbijaxpSourceTransformer Set a SourceTransformer instance touse for handling XML conversions
wsdlResource orgspringframeworkcoreioResource Resource referring to the WSDLresource that defines this endpoint
Mandatory properties
You need to specify one of query resource or expression
Attribute Type Description
query String containing the inlined XQuery expression
resource Spring resource resource pointing to the XQuery
expression ServiceMix expression expression to dynamically load the xquery
Optional properties
Attribute Type Description
wsdlResource (Springresource)
WSDL describing the endpoint
outputProperties Map Saxon specific output properties
configuration (Saxonconfiguration)
Saxon configuration object
Apache ServiceMix 442
76
result(defaults todom)
Allows specifying the output result type possible values aredom bytes string
copyAttachmentscopyProperties andcopySubject
(default totrue)
Configure to copy message attachments properties andsecurity subject over to the result message
Sample configurations
Dynamic stylesheet selection (saxonxslt)
This endpoint configuration will dynamically load the XSL-T resource that is specified in thexsltsource property on the NormalizedMessage
ltsaxonxsltltsaxonxslt service=testxslt-dynamic endpoint=endpointgtgtltsaxonexpressiongtltsaxonexpressiongtltbeanltbean class=orgapacheservicemixexpressionPropertyExpressiongtgtltpropertyltproperty name=property value=xsltsource gtgt
ltbeangtltbeangtltsaxonexpressiongtltsaxonexpressiongt
ltsaxonxsltgtltsaxonxsltgt
Using parameters in the XSL-T stylesheet (saxonxslt)
You can define a Map of parameters on the saxonxslt endpoint
ltsaxonxsltltsaxonxslt service=testxslt-params endpoint=endpointresource=classpathparameter-testxslgtgt
ltpropertyltproperty name=parametersgtgtltmapgtltmapgtltentryltentry key=stringParam value=cheeseyCheesegtgtltentryltentry key=integerParamgtgtltbeanltbean class=javalangIntegergtgtltconstructor-argltconstructor-arg index=0 value=4002gtgt
ltbeangtltbeangtltentrygtltentrygt
ltmapgtltmapgtltpropertygtltpropertygt
ltsaxonxsltgtltsaxonxsltgt
In the XSL file you can access the parameter values with ltxslparamgt You can also accessheaders on the NormalizedMessage (like eg orgapacheservicemixfile) with the same syntax
ltxslstylesheetltxslstylesheet xmlnsxsl=httpwwww3org1999XSLTransform version=10gtgtltxslparamltxslparam name=stringParamgtgtltxslparamltxslparam name=integerParamgtgtltxslparamltxslparam name=orgapacheservicemixfile gtgt
ltxslstylesheetgtltxslstylesheetgt
Apache ServiceMix 442
77
Inlined XQuery and specific output configuration (saxonxquery)
ltsaxonxqueryltsaxonxquery service=testxquery-inline endpoint=endpointgtgtltsaxonquerygtltsaxonquerygt
for $x in bookstorebookwhere $xprice gt 30return $xtitle
ltsaxonquerygtltsaxonquerygtltsaxonoutputPropertiesgtltsaxonoutputPropertiesgtltsaxonpropertyltsaxonproperty key=httpsaxonsfnetwrap-result-sequencegtgtyesltsaxonpropertygtltsaxonpropertygt
ltsaxonoutputPropertiesgtltsaxonoutputPropertiesgtltsaxonxquerygtltsaxonxquerygt
Dynamic XQuery selection (saxonxquery)
This endpoint configuration will dynamically load the XQuery resource that is specified in thexquerysource property on the NormalizedMessage
ltsaxonxqueryltsaxonxquery service=testxquery-dynamic endpoint=endpointgtgtltsaxonexpressiongtltsaxonexpressiongtltbeanltbean class=orgapacheservicemixexpressionPropertyExpressiongtgtltpropertyltproperty name=property value=xquerysource gtgt
ltbeangtltbeangtltsaxonexpressiongtltsaxonexpressiongt
ltsaxonxquerygtltsaxonxquerygt
216 servicemix-scripting
Overview
The ServiceMix Scripting component provides support for processing scripts using JSR-223compliant scripting languages
The component is currently shipping with
bull Groovy (156)
bull JRuby (112)
bull Rhino JavaScript (17R1)
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgscripting10 This is an example of an xbeanxml file with a namespace definition with prefixbean
ltbeansltbeans xmlnsscripting=httpservicemixapacheorgscripting10gtgt
lt-- add scriptingendpoint here --gt
ltbeansgtltbeansgt
Apache ServiceMix 442
78
Endpoint types
The servicemix-scripting component defines a single endpoint type
scriptingendpoint The scripting endpoint can be used to use scripts to handleexchanges or send new exchanges
scriptingendpoint
Endpoint properties
Property Name Type Description
bindings javautilMap
A Map with additionalvariables that are madeavailable during scriptexecution
copyAttachments booleanCopy the attachments into theout message Defaults toltcodegttrueltcodegt
copyProperties booleanCopy the properties into theout message Defaults toltcodegttrueltcodegt
disableOutput boolean
Set this flag to true toltcodegttrueltcodegt to avoidsending back a responsemessage Defaults toltcodegtfalseltcodegt
endpoint javalangString The name of the endpoint
interfaceName javaxxmlnamespaceQNameThe qualified name of theinterface exposed by theendpoint
language javalangString
The scripting language to beused Defaults toltcodegtautodetectltcodegt todetermine the language by thescript file extension
logResourceBundle javalangStringThe resource bundle to usewhen logginginternationalized messages
marshaler orgapacheservicemixscriptingScriptingMarshalerSupport
Custom marshalerimplementation to handlestartupshutdown loading thescript code and registeringadditional user beans
script orgspringframeworkcoreioResource Spring Resource referring tothe script location
scriptLogger javautilloggingLogger returns the script logger
service javaxxmlnamespaceQName The qualified name of theservice the endpoint exposes
targetEndpoint javalangStringTarget endpoint for the outputexchange that is created bythe script
targetInterface javaxxmlnamespaceQNameTarget interface for the outputexchange that is created bythe script
Apache ServiceMix 442
79
targetOperation javaxxmlnamespaceQNameTarget operation for theoutput exchange that iscreated by the script
targetService javaxxmlnamespaceQNameTarget service for the outputexchange that is created bythe script
targetUri javalangString
URI for configuring targetserviceendpointinterface forthe exchange that is createdby the script
217 servicemix-snmp
Overview
The ServiceMix SNMP component provides support for receiving SNMP events via the enterpriseservice bus by using the SNMP4J library
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgsnmp10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnssnmp=httpservicemixapacheorgsnmp10gtgt
lt-- add snmppoller or snmpsender definitions here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-snmp component defines two endpoint types
snmppoller Periodically polls a device status using SNMP and sends the OIDs as a JBIMessageExchange
snmptrap-consumer Consumes an SNMP trap message and sends the OIDs as a JBIMessageExchange
snmppoller
Endpoint properties
Property Name Type Description
address javalangString
ltpgtSpecifies the connection URI used to connectto a snmp capable device ltbr gtltbr gtltbgtltugtTemplateltugtltbgt ltbr gtnbsp igtltrotocolgtltostgtltortgtigt ltbr gtltbr gt
ltbgtltugtDetailsltugtltbgtltbr gtltbrgt lttableborder=0 cellpadding=0 cellspacing=0gtlttrgt lttd width=40align=leftgtltbgtltugtNameltugtltbgtlttdgt lttdwidth=60align=leftgtltbgtltugtDescriptionltugtltbgtlttdgt
Apache ServiceMix 442
80
lttrgt lttrgt lttdgtprotocollttdgt lttdgtthe protocolto use (udp or tcp)lttdgt lttrgt lttrgtlttdgthostlttdgt lttdgtthe name or ip address ofthe snmp capable devicelttdgt lttrgt lttrgtlttdgtportlttdgt lttdgtthe port number touselttdgt lttrgt lttablegt ltbrgtltbgtltugtExampleltugtltbgtltbr gtnbsp igtudp1921682122161ltigtltpgt
ltigt nbsp he default value isltbgtnullltbgtltigtltbrgtltbrgt
concurrentPolling booleanSets whether more than one poll can be active at atime (true means yes) Default value isltcodegtfalseltcodegt
delay long Sets the amount of time in milliseconds that theendpoint should wait before making the first poll
endpoint javalangString The name of the endpoint
firstTime javautilDate
Sets the date on which the first poll will beexecuted If a delay is also set usingltcodegtsetDelayltcodegt the delay interval will beadded after the date specified
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by theendpoint
marshaler orgapacheservicemixsnmpmarshalerSnmpMarshalerSupport
ltpgtSpecifies a marshaler class which provides thelogic for converting a snmp response into anormalized message This class has to implementthe ltcodegtSnmpMarshalerSupportltcodegtinterface If you dont specify a marshaler theltcodegtDefaultSnmpMarshalerltcodegt will beusedltpgt
oids (javalangObject)
ltpgtSpecifies a reference to a list of OID valueswhich will be used for the snmp request You havetwo possibilities how to specify the value ltbrgtltbr gt igta) referencing to a file containing alist of OID values separated by a line feedltbrgt nbsp nbsporltbrgt igtb) defining a coma(ltbgtltbgt) separated list of OID values ltbrgtltbr gt ltbgtltugtExamplesltugtltbgtltbr gtnbsp igta) oids=classpathmyOidstxtltbr gtnbsp nbsp nbsp ids=filehomelheinsnmp
device_aoidstxtltbrgt ltbr gt nbsp igtb)oids=136121130 1361212532151 1361212535111 13612143511111ltigtltpgt ltigt nbsp hedefault value is ltbgtnullltbgtltigtltbrgtltbrgt
period long Sets the number of milliseconds between pollingattempts
retries intltpgtSpecifies the connection retriesltpgtltigt nbsp he default value isltbgt2ltbgtltigtltbrgtltbrgt
scheduler orgapacheservicemixcommonschedulerSchedulerSet a custom Scheduler implementation if youneed more fine-grained control over the pollingschedule
service javaxxmlnamespaceQName The qualified name of the service the endpointexposes
snmpCommunity javalangStringltpgtSpecifies the snmp community to useltpgtltigt nbsp he default value isltbgtpublicltbgtltigtltbrgtltbrgt
snmpVersion intltpgtSpecifies the snmp protocol version touseltpgt ltigt nbsp he default value is ltbgt0(version 1)ltbgtltigtltbrgtltbrgt
Apache ServiceMix 442
81
targetEndpoint javalangString the name of the endpoint to which requests aresent
targetInterface javaxxmlnamespaceQName the QName of the interface to which requests aresent
targetOperation javaxxmlnamespaceQName the QName of the operation to which requests aresent
targetService javaxxmlnamespaceQName the QName of the service to which requests aresent
targetUri javalangString Set the target serviceendpointinterface using aURI
timeout intltpgtSpecifies the connection time out inmillisecondsltpgt ltigt nbsp he default value isltbgt1500ltbgtltigtltbrgtltbrgt
vfstrap-consumer
Endpoint properties
218 servicemix-validation
Overview
The ServiceMix Validation component provides schema validation of documents using JAXP 13 andXMLSchema or RelaxNG
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgvalidation10 This is an example of an xbeanxml file with a namespace definition with prefixbean
ltbeansltbeans xmlnsscripting=httpservicemixapacheorgvalidation10gtgt
lt-- add validationendpoint here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-validation component defines a single endpoint type
validationendpoint Validates the incoming XML message - can be configured to failthe exchange or to send validation errors back to the sender in the message body
validationendpoint
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
Apache ServiceMix 442
82
errorHandlerFactory orgapacheservicemixvalidationhandlerMessageAwareErrorHandlerFactorySet a custom error handler to deal withvalidation errors Defaults to altcodegtCountingErrorHandlerFactoryltcodegt
handlingErrorMethod javalangString
Configure how validation errors should behandled Default value isltcodegtFAULT_JBIltcodegt ltdlgtltdtgtltcodegtFAULT_JBIltcodegtltdtgt ltddgtAjbi exception is thrown on validation errors(depending on used MEP)ltddgtltdtgtltcodegtFAULT_FLOWltcodegtltdtgtltddgtThe validation result will be sent in out fault message (depending on used MEP)ltddgtltdlgt
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposedby the endpoint
noNamespaceSchemaResource orgspringframeworkcoreioResource Set the validation schema to be used when nonamespace is specified
schema javaxxmlvalidationSchema Set the validation schema instance
schemaLanguage javalangStringSet the validation schema language Defaultsto ltcodegthttpwwww3org2001XMLSchemaltcodegt
schemaResource orgspringframeworkcoreioResource Set the validation schema as a SpringResource
schemaSource javaxxmltransformSource Set the validation schema as an XML Source
service javaxxmlnamespaceQName The qualified name of the service the endpointexposes
219 servicemix-vfs
Overview
The ServiceMix VFS component provides support for reading from and writing to virtual file systemsvia the enterprise service bus by using the Apache commons-vfs library
Namespace and xbeanxml
The namespace URI for the servicemix-bean JBI component is httpservicemixapacheorgvfs10 This is an example of an xbeanxml file with a namespace definition with prefix bean
ltbeansltbeans xmlnsvfs=httpservicemixapacheorgvfs10gtgt
lt-- add vfspoller or vfssender here --gt
ltbeansgtltbeansgt
Endpoint types
The servicemix-vfs component defines two endpoint types
vfspoller Periodically polls a directory on one of the VFS-supported file systems forfiles and sends an exchange for every file
vfssender Writes the contents of an exchange to a file on one of the VFS-supported filesystems
Apache ServiceMix 442
83
vfspoller
Endpoint properties
Property Name Type Description
comparator javautilComparator Specifies a ltcodegtComparatorltcodegt object
component orgapacheservicemixcommonDefaultComponent the default component
concurrentExchange boolean
concurrentPolling boolean Sets whether more than one poll can be active at a time (true means yes)Default value is ltcodegtfalseltcodegt
delay long Sets the amount of time in milliseconds that the endpoint should wait beforemaking the first poll
deleteFile boolean Specifies if files should be deleted after they are processed Default value isltcodegttrueltcodegt
endpoint javalangString The name of the endpoint
fileSystemManager orgapachecommonsvfsFileSystemManager sets the file system manager
firstTime javautilDateSets the date on which the first poll will be executed If a delay is also set usingltcodegtsetDelayltcodegt the delay interval will be added after the datespecified
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by the endpoint
lockManager orgapacheservicemixcommonlocksLockManager
Bean defining the class implementing the file locking strategy This bean mustbe an implementation of theltcodegtorgapacheservicemixlocksLockManagerltcodegt interface By defaultthis will be set to an instances ofltcodegtorgapacheservicemixcommonlocksimplSimpleLockManagerltcodegt
marshaler orgapacheservicemixcomponentsutilFileMarshaler
Specifies a ltcodegtFileMarshalerltcodegt object that will marshal file data intothe NMR The default file marshaller can read valid XML dataltcodegtFileMarshalerltcodegt objects are implementations ofltcodegtorgapacheservicemixcomponentsutilFileMarshalerltcodegt
path javalangString
Specifies a String object representing the path of the filefolder to be polled
Examplesbull filehomelheinpollFolderbull zipfilehomelheinpollFoldermyFilezipbull jarhttpwwwmyhostcomfilesExamplesjarbull jarlibclassesjarMETA-INFmanifestmfbull targzhttpanyhostdirmytartargzmytartarpathintar
READMEtxtbull tgzfileanyhostdirmytartgzsomepathsomefilebull gzmygzfilegzbull httpmyusernamesomehostindexhtmlbull webdavsomehost8080distbull ftpmyusernamemypasswordsomehostpubdownloads
somefiletgzbull sftpmyusernamemypasswordsomehostpubdownloads
somefiletgzbull smbsomehosthomebull tmpdirsomefiletxtbull respathinclasspathimagepngbull ramanypathtofiletxtbull mimefileyourpathmailanymailmimefilenamepdf
Apache ServiceMix 442
84
vfssender
Endpoint properties
Property Name Type Description
endpoint javalangString The name of the endpoint
fileSystemManager orgapachecommonsvfsFileSystemManager sets the file system manager
interfaceName javaxxmlnamespaceQName The qualified name of the interface exposed by the endpoint
marshaler orgapacheservicemixcomponentsutilFileMarshaler
Specifies a ltcodegtFileMarshalerltcodegt object that will marshal filedata into the NMR The default file marshaller can read valid XML dataltcodegtFileMarshalerltcodegt objects are implementations ofltcodegtorgapacheservicemixcomponentsutilFileMarshalerltcodegt
path javalangString
Specifies a String object representing the path of the filefolder to bepolled
Examplesbull filehomelheinpollFolderbull zipfilehomelheinpollFoldermyFilezipbull jarhttpwwwmyhostcomfilesExamplesjarbull jarlibclassesjarMETA-INFmanifestmfbull targzhttpanyhostdirmytartargzmytartarpathin
tarREADMEtxtbull tgzfileanyhostdirmytartgzsomepathsomefilebull gzmygzfilegzbull httpmyusernamesomehostindexhtmlbull webdavsomehost8080distbull ftpmyusernamemypasswordsomehostpubdownloads
somefiletgzbull sftpmyusernamemypasswordsomehostpub
downloadssomefiletgzbull smbsomehosthomebull tmpdirsomefiletxtbull respathinclasspathimagepngbull ramanypathtofiletxtbull mimefileyourpathmailanymailmimefilenamepdf
220 servicemix-wsn2005
Overview
The servicemix-wsn2005 is a standard JBI Service Engine which implements the WS-Notificationspecification from Oasis
221 servicemix-xmpp
Overview
The ServiceMix XMPP component is used to communicate with XMPP (Jabber) servers through the JBIbus
Apache ServiceMix 442
85
xmppreceiver
Endpoint properties
Property Name Type Description
createAccount boolean
ltpgtSpecify here if you want to createan account for the user if the user iscurrently not existing on the XMPPserverltpgt
endpoint javalangString The name of the endpoint
filter orgjivesoftwaresmackfilterPacketFilterltpgtHere you can define altcodegtPacketFilterltcodegt to use forfiltering XMPP packets
host javalangStringltpgtWith that method you can specifythe host name of the XMPP server ashostname or ip addressltpgt
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
login boolean
ltpgtHere you can specify if the usershould login to the server or not Notlogging in means that endpoint itselfwill be created but it will beinactiveltpgt
marshaler orgapacheservicemixxmppmarshalerXMPPMarshalerSupport
ltpgtWith this method you can specify amarshaler class which provides thelogic for converting an xmpp messageinto a normalized message This classhas to implement the interfaceltcodegtXMPPMarshalerSupportltcodegtor another class which implements it Ifyou dont specify a marshaler theltcodegtDefaultXMPPMarshalerltcodegtwill be usedltpgt
password javalangString ltpgtThis method sets the password forconnecting to the XMPP serverltpgt
port int
ltpgtThis method will set the portnumber for the XMPP connection Ifnothing is defined the default XMPPport number 5222 will be usedltpgt
proxyHost javalangString
ltpgtHere you can specify the hostnameor ip address of a proxy to be used toconnect to the XMPP server If you dontdefine this no proxy is usedltpgt
proxyPass javalangString
ltpgtIf your proxy needs authenticationyou can specify here the user passwordLeave this undefined if your proxy doesnot need authenticationltpgt
proxyPort javalangString
ltpgtHere you can specify the port ofthe proxy server If you do not definethis the default port (3128) will beused
proxyType javalangString
ltpgtHere you can specify the type ofproxy you have Possible values areltcodegtNONEltcodegtltcodegtHTTPltcodegtltcodegtSOCKS4ltcodegtltcodegtSOCKS5ltcodegt
proxyUser javalangString ltpgtIf your proxy needs authenticationyou can specify here the user name
Apache ServiceMix 442
86
Leave this undefined if your proxy doesnot need authenticationltpgt
resource javalangString
ltpgtSpecify here the resource string tosubmit to the XMPP server Usually youdefine the identifier of the XMPP clienthereltpgt
room javalangStringltpgtSpecify here an optional room tojoin If set the user will join that roomand listens to messages thereltpgt
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
targetEndpoint javalangString the name of the endpoint to whichrequests are sent
targetInterface javaxxmlnamespaceQName the QName of the interface to whichrequests are sent
targetOperation javaxxmlnamespaceQName the QName of the operation to whichrequests are sent
targetService javaxxmlnamespaceQName the QName of the service to whichrequests are sent
targetUri javalangString Set the target serviceendpointinterface using a URI
user javalangString
ltpgtThis method if used to specify theuser name to use for connecting to theXMPP server It is not required that thisuser already exists but if not then theserver should allow registration of newusers and this user should not alreadyexist with another passwordltpgt
xmppsender
Endpoint properties
PropertyName
Type Description
createAccount boolean
ltpgtSpecify here if you want to createan account for the user if the user iscurrently not existing on the XMPPserverltpgt
endpoint javalangString The name of the endpoint
host javalangStringltpgtWith that method you can specifythe host name of the XMPP server ashostname or ip addressltpgt
interfaceName javaxxmlnamespaceQName The qualified name of the interfaceexposed by the endpoint
login boolean
ltpgtHere you can specify if the usershould login to the server or not Notlogging in means that endpoint itselfwill be created but it will beinactiveltpgt
marshaler orgapacheservicemixxmppmarshalerXMPPMarshalerSupport
ltpgtWith this method you can specify amarshaler class which provides thelogic for converting an xmpp messageinto a normalized message This classhas to implement the interfaceltcodegtXMPPMarshalerSupportltcodegtor another class which implements it Ifyou dont specify a marshaler the
Apache ServiceMix 442
87
ltcodegtDefaultXMPPMarshalerltcodegtwill be usedltpgt
participant javalangString
ltpgtSpecify here an optional participantto send messages to You have todefine a room or participant in order tohave send function workingltpgt
password javalangString ltpgtThis method sets the password forconnecting to the XMPP serverltpgt
port int
ltpgtThis method will set the portnumber for the XMPP connection Ifnothing is defined the default XMPPport number 5222 will be usedltpgt
proxyHost javalangString
ltpgtHere you can specify the hostnameor ip address of a proxy to be used toconnect to the XMPP server If you dontdefine this no proxy is usedltpgt
proxyPass javalangString
ltpgtIf your proxy needs authenticationyou can specify here the user passwordLeave this undefined if your proxy doesnot need authenticationltpgt
proxyPort javalangString
ltpgtHere you can specify the port ofthe proxy server If you do not definethis the default port (3128) will beused
proxyType javalangString
ltpgtHere you can specify the type ofproxy you have Possible values areltcodegtNONEltcodegtltcodegtHTTPltcodegtltcodegtSOCKS4ltcodegtltcodegtSOCKS5ltcodegt
proxyUser javalangString
ltpgtIf your proxy needs authenticationyou can specify here the user nameLeave this undefined if your proxy doesnot need authenticationltpgt
resource javalangString
ltpgtSpecify here the resource string tosubmit to the XMPP server Usually youdefine the identifier of the XMPP clienthereltpgt
room javalangStringltpgtSpecify here an optional room tojoin If set the user will join that roomand listens to messages thereltpgt
service javaxxmlnamespaceQName The qualified name of the service theendpoint exposes
user javalangString
ltpgtThis method if used to specify theuser name to use for connecting to theXMPP server It is not required that thisuser already exists but if not then theserver should allow registration of newusers and this user should not alreadyexist with another passwordltpgt
Apache ServiceMix 442
88
- Introduction to JBI
- What is JBI
- Message Exchange Patterns
- JBI API
- JBI Components
- servicemix-bean
- Overview
- Namespace and xbeanxml
- Endpoint types
- Endpoint beanendpoint
- Using a Java class
- Using a spring bean
- Endpoint properties
- MessageExchangeListener
- Examples
- Disclaimer
- MessageExchange dispatching
- Annotations
- More Examples
- servicemix-camel
- Overview
- Namespace and camel-contextxml
- URI
- URI format
- Examples
- Using jbiservice
- Using jbiendpoint
- Using jbiname
- URI options
- Examples
- Example routes
- Simple Spring route
- The same route using the Java DSL
- Special considerations
- Stream handling
- servicemix-cxf-bc
- Overview
- Namespace and xbeanxml
- Endpoint types
- cxfbcconsumer
- Endpoint properties
- cxfbcprovider
- Endpoint properties
- Examples
- Configuring the CXF JMS Transport
- Configuring the CXF HTTP Transport
- servicemix-cxf-se
- Overview
- Namespace and xbeanxml
- Endpoint types
- cxfseendpoint
- Endpoint properties
- cxfbcproxy
- Endpoint properties
- servicemix-drools
- Overview
- Namespace and xbeanxml
- Endpoint types
- droolsendpoint
- Endpoint properties
- servicemix-eip
- Overview
- Namespace and xbeanxml
- Endpoint types
- Content Based Router
- Endpoint properties
- Message Filter
- Endpoint properties
- Pipeline
- Endpoint properties
- Static Recipeint List
- Endpoint properties
- Static Routing Slip
- Endpoint properties
- Wire Tap
- Endpoint properties
- XPath Splitter
- Endpoint properties
- Split Aggregator
- Endpoint properties
- Content Enricher
- Endpoint properties
- Eip Resequencer
- Endpoint properties
- Async Bridge
- Correlation Id
- Endpoint properties
- Tips
- ExchangeTarget
- NamespaceContext
- Predicates
- Configuring temporary message storage
- Creating your own patterns
- servicemix-exec
- Overview
- Namespace and xbeanxml
- Endpoints types
- Endpoint execendpoint
- Endpoint properties