1 /* 2 * $Id: MessageRequesting.java 10489 2008-01-23 17:53:38Z dfeist $ 3 * -------------------------------------------------------------------------------------- 4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com 5 * 6 * The software in this package is published under the terms of the CPAL v1.0 7 * license, a copy of which has been included with this distribution in the 8 * LICENSE.txt file. 9 */ 10 11 package org.mule.api.transport; 12 13 import org.mule.api.MuleMessage; 14 15 /** 16 * Defines generic methods for receiving events. 17 * The exact behaviour of the action is defined by the implementing class. 18 * 19 * @see org.mule.api.endpoint.ImmutableEndpoint 20 * @see MessageRequester 21 */ 22 public interface MessageRequesting 23 { 24 25 long REQUEST_WAIT_INDEFINITELY = 0; 26 long REQUEST_NO_WAIT = -1; 27 28 /** 29 * Make a specific request to the underlying transport 30 * 31 * @param timeout the maximum time the operation should block before returning. 32 * The call should return immediately if there is data available. If 33 * no data becomes available before the timeout elapses, null will be 34 * returned 35 * @return the result of the request wrapped in a MuleMessage object. Null will be 36 * returned if no data was avaialable 37 * @throws Exception if the call to the underlying protocal causes an exception 38 */ 39 MuleMessage request(long timeout) throws Exception; 40 41 }