Class JettyRoutingService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.BranchingServiceImp
-
- com.adaptris.core.http.jetty.JettyRoutingService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Specify the next branch based on the jettyURI and method", tag="service,jetty,branching", branchSelector=true) public class JettyRoutingService extends BranchingServiceImpUse as part of aBranchingServiceCollectionto branch based on the jetty URI and method.Takes the metadata values associated with
CoreConstants.HTTP_METHODandJettyConstants.JETTY_URIand matches them against a list of configured routes. If a route matches the URI and the http method (if specified) then the next service id is set appropriately.In the adapter configuration file this class is aliased as jetty-routing-service which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description JettyRoutingService()JettyRoutingService(java.lang.String defaultServiceId, java.util.List<JettyRouteSpec> specs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseService()voiddoService(AdaptrisMessage msg)Apply the service to the message.java.lang.StringgetDefaultServiceId()java.util.List<JettyRouteSpec>getRoutes()protected voidinitService()voidprepare()Prepare for initialisation.voidsetDefaultServiceId(java.lang.String id)Set the default service id if there are no matches.voidsetRoutes(java.util.List<JettyRouteSpec> r)voidstart()Starts the component.voidstop()Stop the component-
Methods inherited from class com.adaptris.core.BranchingServiceImp
isBranching
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
-
-
-
Constructor Detail
-
JettyRoutingService
public JettyRoutingService()
-
JettyRoutingService
public JettyRoutingService(java.lang.String defaultServiceId, java.util.List<JettyRouteSpec> specs)
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
Description copied from interface:ServiceApply the service to the message.
- Parameters:
msg- theAdaptrisMessageto process- Throws:
ServiceException- wrapping any underlyingExceptions
-
prepare
public void prepare() throws CoreExceptionDescription copied from interface:ComponentLifecycleExtensionPrepare for initialisation.- Throws:
CoreException
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
start
public void start() throws CoreExceptionDescription copied from interface:ComponentLifecycleStarts the component.Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer, calling start will begin message delivery.- Specified by:
startin interfaceComponentLifecycle- Overrides:
startin classServiceImp- Throws:
CoreException- wrapping any underlyingExceptions
-
stop
public void stop()
Description copied from interface:ComponentLifecycleStop the componentA stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer, calling stop will pause message delivery. Throwing aRuntimeExceptionmay cause unintended consequences- Specified by:
stopin interfaceComponentLifecycle- Overrides:
stopin classServiceImp
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
getRoutes
public java.util.List<JettyRouteSpec> getRoutes()
-
setRoutes
public void setRoutes(java.util.List<JettyRouteSpec> r)
-
getDefaultServiceId
public java.lang.String getDefaultServiceId()
-
setDefaultServiceId
public void setDefaultServiceId(java.lang.String id)
Set the default service id if there are no matches.- Parameters:
id-
-
-