org.ow2.petals.jbi.messaging.routing
Class RouterServiceImpl

java.lang.Object
  extended by org.ow2.petals.jbi.messaging.routing.RouterServiceImpl
All Implemented Interfaces:
RouterService, TransportListener

public class RouterServiceImpl
extends java.lang.Object
implements RouterService, TransportListener

Routes messages to their destinations. Performs an itinerary resolution, adding for example a transformation service before delivering the message to its recipient, and perform an address resolution, finding the endpoint satisfying the the destination information (finding an endpoint for a specified service). Resolutions are based on defined rules.

Author:
alouis - EBM WebSourcing, chamerling - EBM WebSourcing, rnaudin - EBM WebSourcing

Field Summary
 
Fields inherited from interface org.ow2.petals.jbi.messaging.routing.RouterService
DEFAULT_PLATFORM_STRATEGY, DEFAULT_POLICY, DEFAULT_STANDALONE_STRATEGY, FAST_POLICY, PROPERTY_ROUTER_CONSUMER_NOACK, PROPERTY_ROUTER_PROVIDER_LINKTYPE, PROPERTY_ROUTER_PROVIDER_NOACK, PROPERTY_ROUTER_QOS, PROPERTY_ROUTER_SEND_ATTEMPT, PROPERTY_ROUTER_SEND_DELAY, PROPERTY_ROUTER_TIMETOLIVE, RELIABLE_POLICY, SECURE_POLICY
 
Constructor Summary
RouterServiceImpl()
           
 
Method Summary
 void addComponent(ComponentContext componentContext)
          Inform that a component is installing.
 void exchangeSent(org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator)
          The Message Exchange has been sent.
 void modifiedSALifeCycle(java.util.List<ServiceUnitLifeCycle> serviceUnitLifeCycles)
          Inform that a SA life-cycle has changed its state.
 void onExchange(org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator)
          Receive a Message Exchange.
 org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper receive(ComponentContext componentContext, long timeoutMS)
          Ask to receive a message from MNR and return it.
 void removeComponent(ComponentContext componentContext)
          Inform that a component is uninstalling.
 void send(ComponentContext source, org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator)
          Send the message into the NMR.
 void sendSync(ComponentContext source, org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator, long timeout)
          Send the message synchronously into the NMR.
protected  void start()
          start the router.
protected  void stop()
          stop the router.
 void stopTraffic()
          Prepare the stopping of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouterServiceImpl

public RouterServiceImpl()
Method Detail

addComponent

public void addComponent(ComponentContext componentContext)
                  throws RoutingException
Description copied from interface: RouterService
Inform that a component is installing. The Router must inform its Transporters about the component installation.

Specified by:
addComponent in interface RouterService
Parameters:
componentContext - The component context
Throws:
RoutingException - impossible to add the component

exchangeSent

public void exchangeSent(org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator)
Description copied from interface: TransportListener
The Message Exchange has been sent.

Specified by:
exchangeSent in interface TransportListener

modifiedSALifeCycle

public void modifiedSALifeCycle(java.util.List<ServiceUnitLifeCycle> serviceUnitLifeCycles)
Description copied from interface: RouterService
Inform that a SA life-cycle has changed its state.

Specified by:
modifiedSALifeCycle in interface RouterService

onExchange

public void onExchange(org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator)
Description copied from interface: TransportListener
Receive a Message Exchange.

Specified by:
onExchange in interface TransportListener

receive

public org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper receive(ComponentContext componentContext,
                                                                            long timeoutMS)
                                                                     throws RoutingException
Description copied from interface: RouterService
Ask to receive a message from MNR and return it.

Specified by:
receive in interface RouterService
Parameters:
componentContext - The source component context MUST be non null
timeoutMS - parameter which represents
  • The time to wait if greater than 0
  • A non blocking call if equal to 0
  • Infinite Blocking call if less than 0
Returns:
The message exchange decorator retrieved from the Transporter
Throws:
RoutingException - impossible to receive the message

removeComponent

public void removeComponent(ComponentContext componentContext)
                     throws RoutingException
Description copied from interface: RouterService
Inform that a component is uninstalling. The Router must inform its Transporters about the component uninstallation.

Specified by:
removeComponent in interface RouterService
Parameters:
componentContext - The component context
Throws:
RoutingException - impossible to remove the component

send

public void send(ComponentContext source,
                 org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator)
          throws RoutingException
Description copied from interface: RouterService
Send the message into the NMR.

Specified by:
send in interface RouterService
Parameters:
source - the source component context
exchangeDecorator - the MessageExchangeWrapper
Throws:
RoutingException - impossible to send the message

sendSync

public void sendSync(ComponentContext source,
                     org.ow2.petals.jbi.messaging.exchange.MessageExchangeWrapper exchangeDecorator,
                     long timeout)
              throws RoutingException
Description copied from interface: RouterService
Send the message synchronously into the NMR.

Specified by:
sendSync in interface RouterService
Parameters:
source - the source component context
exchangeDecorator - the MessageExchangeWrapper
Throws:
RoutingException - impossible to process a synchronous send

stopTraffic

public void stopTraffic()
Description copied from interface: RouterService
Prepare the stopping of the component. It means that all ongoing message traffic must terminate during the method invocation and all new message traffic is rejected.

Specified by:
stopTraffic in interface RouterService

start

protected void start()
              throws RoutingException
start the router.

Throws:
RoutingException - impossible to start the router

stop

protected void stop()
             throws RoutingException
stop the router.

Throws:
RoutingException


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.