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