All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bridge.component.IMessageFeature Maven / Gradle / Ivy

Go to download

Jadex bridge is a base package for kernels and platforms, i.e., it is used by both and provides commonly used interfaces and classes for active components and their management.

There is a newer version: 4.0.267
Show newest version
package jadex.bridge.component;

import java.util.Map;

import jadex.bridge.IComponentIdentifier;
import jadex.bridge.IInputConnection;
import jadex.bridge.IOutputConnection;
import jadex.commons.future.IFuture;

/**
 *  Feature for sending messages and handling incoming messages via handlers.
 */
public interface IMessageFeature
{
	/**
	 *  Send a message.
	 *  @param message	The message.
	 *  @param receiver	The message receiver(s). At least one required unless given in message object (e.g. FipaMessage).
	 *  
	 */
	public IFuture sendMessage(Object message, IComponentIdentifier... receiver);
	
	/**
	 *  Send a message.
	 *  @param message	The message.
	 *  @param addheaderfields Additional header fields.
	 *  @param receiver	The message receiver(s). At least one required unless given in message object (e.g. FipaMessage).
	 *  
	 */
	public IFuture sendMessage(Object message, Map addheaderfields, IComponentIdentifier... receiver);
	
	/**
	 *  Send a message and wait for a reply.
	 *  
	 *  @param receiver	The message receiver.
	 *  @param message	The message.
	 *  
	 *  @return The reply.
	 */
	// Todo: intermediate future with multiple receivers?
	public IFuture sendMessageAndWait(IComponentIdentifier receiver, Object message);
	
	/**
	 *  Send a message and wait for a reply.
	 *  
	 *  @param receiver	The message receiver.
	 *  @param message	The message.
	 *  @param timeout	The reply timeout.
	 *  
	 *  @return The reply.
	 */
	// Todo: intermediate future with multiple receivers?
	public IFuture sendMessageAndWait(IComponentIdentifier receiver, Object message, Long timeout);
	
	/**
	 *  Send a message reply.
	 *  @param receivedmessageid	ID of the received message that is being replied to.
	 *  @param message	The reply message.
	 *  
	 */
	public IFuture sendReply(IMsgHeader header, Object message);
	
	/**
	 *  Add a message handler.
	 *  @param  The handler.
	 */
	public void addMessageHandler(IMessageHandler handler);
	
	/**
	 *  Remove a message handler.
	 *  @param handler The handler.
	 */
	public void removeMessageHandler(IMessageHandler handler);
	
	/**
	 *  Create a virtual output connection.
	 *  @param sender The sender.
	 *  @param receiver The receiver.
	 *  @param nonfunc The nonfunc props.
	 */
	public IFuture createOutputConnection(IComponentIdentifier sender, IComponentIdentifier receiver, Map nonfunc);

	/**
	 *  Create a virtual input connection.
	 *  @param sender The sender.
	 *  @param receiver The receiver.
	 *  @param nonfunc The nonfunc props.
	 */
	public IFuture createInputConnection(IComponentIdentifier sender, IComponentIdentifier receiver, Map nonfunc);
}