@ComponentProfile(summary="Specify the next branch based on the jettyURI and method", tag="service,jetty,branching", branchSelector=true) public class JettyRoutingService extends BranchingServiceImp
BranchingServiceCollection
to branch based on the jetty URI and method.
Takes the metadata values associated with CoreConstants.HTTP_METHOD
and JettyConstants.JETTY_URI
and 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.
log
Constructor and Description |
---|
JettyRoutingService() |
JettyRoutingService(java.lang.String defaultServiceId,
java.util.List<JettyRouteSpec> specs) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
java.lang.String |
getDefaultServiceId() |
java.util.List<JettyRouteSpec> |
getRoutes() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setDefaultServiceId(java.lang.String id)
Set the default service id if there are no matches.
|
void |
setRoutes(java.util.List<JettyRouteSpec> r) |
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
isBranching
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
public JettyRoutingService()
public JettyRoutingService(java.lang.String defaultServiceId, java.util.List<JettyRouteSpec> specs)
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
start
in class ServiceImp
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
stop
in class ServiceImp
protected void closeService()
closeService
in class ServiceImp
public java.util.List<JettyRouteSpec> getRoutes()
public void setRoutes(java.util.List<JettyRouteSpec> r)
public java.lang.String getDefaultServiceId()
public void setDefaultServiceId(java.lang.String id)
id
-