View Javadoc
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.client;
8   
9   import org.mule.api.MuleException;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.endpoint.InboundEndpoint;
12  import org.mule.api.endpoint.OutboundEndpoint;
13  
14  import java.util.Map;
15  
16  /**
17   * Extends {@link MuleClient} adding methods that allow the use of an endpoint
18   * instance.
19   */
20  public interface LocalMuleClient extends MuleClient
21  {
22  
23      /**
24       * Sends an event synchronously to a endpointUri via a Mule server and a
25       * resulting message is returned.
26       * 
27       * @param endpoint
28       * @param payload the object that is the payload of the event
29       * @param messageProperties any properties to be associated with the payload. In
30       *            the case of Jms you could set the JMSReplyTo property in these
31       *            properties.
32       * @return A return message, this could be <code>null</code> if the the
33       *         components invoked explicitly sets a return as <code>null</code>.
34       * @throws org.mule.api.MuleException
35       */
36      MuleMessage process(OutboundEndpoint endpoint, Object payload, Map<String, Object> messageProperties)
37          throws MuleException;
38  
39      /**
40       * Sends an event synchronously to a endpointUri via a Mule server and a
41       * resulting message is returned.
42       * 
43       * @param endpoint
44       * @param message the Message for the event
45       * @return A return message, this could be <code>null</code> if the the
46       *         components invoked explicitly sets a return as <code>null</code>.
47       * @throws org.mule.api.MuleException
48       */
49      MuleMessage process(OutboundEndpoint endpoint, MuleMessage message) throws MuleException;
50  
51      /**
52       * Will receive an event from an endpointUri determined by the URL.
53       * 
54       * @param endpoint the Mule URL used to determine the destination and transport
55       *            of the message
56       * @param timeout how long to block waiting to receive the event, if set to 0 the
57       *            receive will not wait at all and if set to -1 the receive will wait
58       *            forever
59       * @return the message received or <code>null</code> if no message was received
60       * @throws org.mule.api.MuleException
61       */
62      MuleMessage request(InboundEndpoint endpoint, long timeout) throws MuleException;
63  
64      /**
65       * Will register the specified processor as a listener for the inbound endpoint.
66       * This may be implemented by subscription or polling depending on the transport
67       * implementation
68       * 
69       * @param endpoint
70       * @param processor
71       * @throws MuleException
72       */
73      // void receive(InboundEndpoint endpoint, MessageProcessor processor) throws
74      // MuleException;
75  
76  }