/*
 * Created on May 11, 2007
 * 
 * (C) Copyright TANDBERG Television Ltd.
 */

package com.tandbergtv.workflow.comm.routing;

import java.util.List;

import com.tandbergtv.workflow.comm.IDestination;
import com.tandbergtv.workflow.message.IMessage;
import com.tandbergtv.workflow.message.WorkflowMessage;

/**
 * Routing Service interface to send messages to and from the Workflow System.
 * 
 * @author Vijay Silva
 */
public interface IRoutingService
{
	/**
	 * Delivers the incoming message to the Workflow System after the message has been successfully
	 * transformed by the Adaptor to the WPCL Message format. The Message payload must contain a
	 * WPCL message.
	 * 
	 * @param message
	 *            The Message to send to the Workflow System.
	 * 
	 * @return The response generated by the Workflow System when processing the incoming message.
	 * 
	 * @throws CommunicationException
	 *             Exception when handling the incoming message
	 */
	IMessage send(IMessage message) throws CommunicationException;

	/**
	 * Transmits the outgoing Workflow Message via the Adaptor, and processes the transformed
	 * response from the Adaptor into the WPCL WorkflowMessage response.
	 * 
	 * @param message
	 *            The Workflow Message to transmit from the Workflow System.
	 * @param destinations
	 *            The list of destinations to send the message to.
	 * 
	 * @return The WorkflowMessage response
	 * 
	 * @throws CommunicationException
	 *             Exception transmitting the outgoing message
	 */
	WorkflowMessage send(WorkflowMessage message, List<IDestination> destinations)
			throws CommunicationException;
}
