*
* @throws Exception
*/
@Bean
public ServiceManagerComponent serviceManager() throws Exception {
ServiceManagerComponent sm = new ServiceManagerComponent(common.camelContext());
// Instantiate delegate listener to receive incoming messages.
ServiceManagerEventListener delegateListener = this.serviceManagerDelegateListener(sm);
// Inject a dispatcher into the listener in case it needs to send
// a message to another component
// delegateListener.setDuccEventDispatcher(serviceManagerTransport.duccEventDispatcher(common.orchestratorStateUpdateEndpoint, sm.getContext()));
// Set context so SM can send state when it wants to (not on timer)
sm.setTransportConfiguration(serviceManagerTransport.duccEventDispatcher(common.smStateUpdateEndpoint, sm.getContext()),
common.smStateUpdateEndpoint);
//delegateListener.setDuccEventDispatcher(serviceManagerTransport.duccEventDispatcher(common.orchestratorAbbreviatedStateUpdateEndpoint, sm.getContext()));
//
// Inject Camel Router that will delegate messages to Service Manager delegate listener
// TODO Not used? OR state messages - incoming
// sm.getContext().addRoutes(this.routeBuilderForIncomingRequests(common.orchestratorStateUpdateEndpoint, delegateListener));
// OR abbreviated state messages - incoming
sm.getContext().addRoutes(this.routeBuilderForIncomingRequests(common.orchestratorAbbreviatedStateUpdateEndpoint, delegateListener));
// API requests - incoming
//sm.getContext().addRoutes(this.routeBuilderForApi(common.smRequestEndpoint, delegateListener));
sm.getContext().addRoutes(this.routeBuilderForJetty(sm.getContext(), delegateListener));
// TODO Not used - timer to send state. We now send whenever we get an OR heartbeat.
//sm.getContext().addRoutes(this.routeBuilderForSMStatePost(sm, common.smStateUpdateEndpoint, Integer.parseInt(common.smStatePublishRate)));
return sm;
}