org.mule.api.service
Interface Service

All Superinterfaces:
Disposable, Initialisable, Lifecycle, MuleContextAware, NamedObject, Serializable, Startable, Stoppable
All Known Implementing Classes:
AbstractService, DirectService, JcaService, PipelineService, SedaService

public interface Service
extends Serializable, Lifecycle, MuleContextAware, NamedObject

Service is the internal representation of a Mule Managed service. It is responsible for managing the interaction of events to and from the service as well as managing pooled resources.


Field Summary
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Method Summary
 void dispatchEvent(MuleEvent event)
          Makes an asynchronous event call to the service.
 Component getComponent()
          Returns the Component that is a invoked by a Service for each incoming MuleEvent routed on by the InboundRouterCollection.
 ExceptionListener getExceptionListener()
          The exception strategy to use to handle exceptions in the Mule component.
 InboundRouterCollection getInboundRouter()
          Inbound Routers control how events are received by a service.
 String getInitialState()
          Returns the initial state of this service
 Model getModel()
          Returns the name of the model that this descriptor is registered with.
 MuleContext getMuleContext()
           
 OutboundRouterCollection getOutboundRouter()
          Outbound Routers control how events are published by a service once.
 ResponseRouterCollection getResponseRouter()
          Response Routers control how events are returned in a request/response call.
 ServiceStatistics getStatistics()
          Returns the Service statistics.
 boolean isPaused()
          True if the service is in a paused state, false otherwise
 boolean isStarted()
          Determines whether this service has been started
 void pause()
          Pauses event processing for a single Mule Service.
 void resume()
          Resumes a single Mule Service that has been paused.
 MuleMessage sendEvent(MuleEvent event)
          Makes a synchronous event call to the service.
 void setComponent(Component component)
          Sets the Component that is a invoked by a Service for each incoming MuleEvent routed on by the InboundRouterCollection.
 void setExceptionListener(ExceptionListener listener)
          The exception strategy to use to handle exceptions in the Mule component.
 void setInboundRouter(InboundRouterCollection router)
          Inbound Routers control how events are received by a service.
 void setInitialState(String state)
          Sets the initial state of this service
 void setModel(Model model)
          Sets the Model name that this descriptor is registered within.
 void setOutboundRouter(OutboundRouterCollection router)
          Outbound Routers control how events are published by a service once.
 void setResponseRouter(ResponseRouterCollection router)
          Response Routers control how events are returned in a request/response call.
 
Methods inherited from interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Startable
start
 
Methods inherited from interface org.mule.api.lifecycle.Stoppable
stop
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 
Methods inherited from interface org.mule.api.context.MuleContextAware
setMuleContext
 
Methods inherited from interface org.mule.api.NamedObject
getName, setName
 

Method Detail

dispatchEvent

void dispatchEvent(MuleEvent event)
                   throws MuleException
Makes an asynchronous event call to the service.

Parameters:
event - the event to consume
Throws:
MuleException - if the event fails to be processed

sendEvent

MuleMessage sendEvent(MuleEvent event)
                      throws MuleException
Makes a synchronous event call to the service. This event will be consumed by the service and a result returned.

Parameters:
event - the event to consume
Returns:
a MuleMessage containing the resulting message and properties
Throws:
MuleException - if the event fails to be processed

isStarted

boolean isStarted()
Determines whether this service has been started

Returns:
true is the service is started and ready to receive events

pause

void pause()
           throws MuleException
Pauses event processing for a single Mule Service. Unlike stop(), a paused service will still consume messages from the underlying transport, but those messages will be queued until the service is resumed.

Throws:
MuleException

resume

void resume()
            throws MuleException
Resumes a single Mule Service that has been paused. If the service is not paused nothing is executed.

Throws:
MuleException

isPaused

boolean isPaused()
True if the service is in a paused state, false otherwise

Returns:
True if the service is in a paused state, false otherwise

getExceptionListener

ExceptionListener getExceptionListener()
The exception strategy to use to handle exceptions in the Mule component.

Returns:
the exception strategy to use. If none has been set a default will be used.

getInboundRouter

InboundRouterCollection getInboundRouter()
Inbound Routers control how events are received by a service. If no router is set. A default will be used that uses the inboundProvider set on his descriptor.

Returns:
the inbound router for this service. This will always return a valid router.
See Also:
InboundRouterCollection

getOutboundRouter

OutboundRouterCollection getOutboundRouter()
Outbound Routers control how events are published by a service once. the event has been processed. If no router is set. A default will be used that uses the outboundProvider set on his descriptor to route the event.

Returns:
the outbound router for this service
See Also:
OutboundRouterCollection

getResponseRouter

ResponseRouterCollection getResponseRouter()
Response Routers control how events are returned in a request/response call. It can be use to aggregate response events before returning, thus acting as a Join in a forked process. This can be used to make request/response calls a lot more efficient as independent tasks can be forked, execute concurrently and then join before the request completes

Returns:
the response router for this service
See Also:
ResponseRouterCollection

getInitialState

String getInitialState()
Returns the initial state of this service

Returns:
the initial state of this service

getModel

Model getModel()
Returns the name of the model that this descriptor is registered with.

Returns:
the name of the model that this descriptor is registered with or null if this descriptor has not been registered with a model yet

setExceptionListener

void setExceptionListener(ExceptionListener listener)
The exception strategy to use to handle exceptions in the Mule component.

Parameters:
listener - the exception strategy to use. If none has been set or argument is null a default

setInboundRouter

void setInboundRouter(InboundRouterCollection router)
Inbound Routers control how events are received by a service. If no router is set. A default will be used that uses the inboundProvider set on his descriptor.

Parameters:
router - the inbound router for this service
See Also:
InboundRouterCollection

setOutboundRouter

void setOutboundRouter(OutboundRouterCollection router)
Outbound Routers control how events are published by a service once. the event has been processed. If no router is set. A default will be used that uses the outboundProvider set on his descriptor to route the event.

Parameters:
router - the outbound router for this service
See Also:
OutboundRouterCollection

setResponseRouter

void setResponseRouter(ResponseRouterCollection router)
Response Routers control how events are returned in a request/response call. It can be use to aggregate response events before returning, thus acting as a Join in a forked process. This can be used to make request/response calls a lot more efficient as independent tasks can be forked, execute concurrently and then join before the request completes

Parameters:
router - the response router for this service
See Also:
ResponseRouterCollection

setInitialState

void setInitialState(String state)
Sets the initial state of this service

Parameters:
state - the initial state of this service
See Also:
org.mule.ImmutableMuleDescriptor#INITIAL_STATE_STARTED, org.mule.ImmutableMuleDescriptor#INITIAL_STATE_STOPPED, org.mule.ImmutableMuleDescriptor#INITIAL_STATE_PAUSED

setModel

void setModel(Model model)
Sets the Model name that this descriptor is registered within.

Parameters:
modelName - name of the model

getComponent

Component getComponent()
Returns the Component that is a invoked by a Service for each incoming MuleEvent routed on by the InboundRouterCollection.

Returns:

setComponent

void setComponent(Component component)
Sets the Component that is a invoked by a Service for each incoming MuleEvent routed on by the InboundRouterCollection.

Parameters:
component -

getStatistics

ServiceStatistics getStatistics()
Returns the Service statistics. This provides Service router and component statistics.

Returns:

getMuleContext

MuleContext getMuleContext()


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.