flex.messaging.services
Interface Service

All Superinterfaces:
Manageable
All Known Implementing Classes:
flex.messaging.services.AbstractService

public interface Service
extends Manageable

The MessageBroker has endpoints on one end and services on the other. The Service interface defines the contract between the MessageBroker and all Service implementations.


Method Summary
 Destination getDestination(Message message)
          Retrieves the destination in this service for which the given message is intended.
 String getId()
          Returns the id for the service.
 MessageBroker getMessageBroker()
          All services must be managed by a single MessageBroker, and must be capable of returning a reference to that broker.
 flex.messaging.config.ServiceSettings getSettings()
          Returns the settings used to initialize the service.
 boolean isSupportedMessage(Message message)
          Determines whether this Service is capable of handling a given Message instance.
 boolean isSupportedMessageType(String messageClassName)
          Determines whether this Service is capable of handling messages of a given type.
 Object serviceCommand(CommandMessage message)
          Handles a command routed to the service by the MessageBroker.
 Object serviceMessage(Message message)
          Handles a message routed to the service by the MessageBroker.
 void setId(String id)
          Sets the id for the service.
 void start()
          Performs any startup actions necessary after the service has been added to the broker.
 void stop()
          Performs any actions necessary before removing the service from the broker.
 
Methods inherited from interface flex.management.Manageable
getControl, isManaged, setControl, setManaged
 

Method Detail

getId

public String getId()
Returns the id for the service.

Returns:
The id for the service.

setId

public void setId(String id)
Sets the id for the service.

Parameters:
id - The id for the service.

getMessageBroker

public MessageBroker getMessageBroker()
All services must be managed by a single MessageBroker, and must be capable of returning a reference to that broker. This broker is used when a service wishes to push a message to one or more endpoints managed by the broker.

Returns:
broker The MessageBroker instance which manages this service

getDestination

public Destination getDestination(Message message)
Retrieves the destination in this service for which the given message is intended.


serviceMessage

public Object serviceMessage(Message message)
Handles a message routed to the service by the MessageBroker.

Parameters:
message - The message sent by the MessageBroker

serviceCommand

public Object serviceCommand(CommandMessage message)
Handles a command routed to the service by the MessageBroker. Usually these are commands sent by one of the endpoints.

Parameters:
message - The message sent by the MessageBroker

isSupportedMessage

public boolean isSupportedMessage(Message message)
Determines whether this Service is capable of handling a given Message instance.


isSupportedMessageType

public boolean isSupportedMessageType(String messageClassName)
Determines whether this Service is capable of handling messages of a given type.


getSettings

public flex.messaging.config.ServiceSettings getSettings()
Returns the settings used to initialize the service. Adapters and destinations may wish to look for service-level default properties from these settings.

Returns:
The settings used to initialize the service.

start

public void start()
Performs any startup actions necessary after the service has been added to the broker.


stop

public void stop()
Performs any actions necessary before removing the service from the broker.



Copyright © 2006 Adobe Systems Inc. All Rights Reserved. (Updated August 2, 2006)