eneter.messaging.endpoints.rpc
Interface IRpcClient<TServiceInterface>

Type Parameters:
TServiceInterface - Interface exposed by the service.
All Superinterfaces:
IAttachableDuplexOutputChannel

public interface IRpcClient<TServiceInterface>
extends IAttachableDuplexOutputChannel

Client which can use Remote Procedure Calls (note: it also works with .NET). RpcClient acts as a proxy providing the communication functionality allowing a client to call methods exposed by the service.


Method Summary
 java.lang.Object callRemoteMethod(java.lang.String methodName, java.lang.Object[] args)
          Calls a method in the service.
 Event<DuplexChannelEventArgs> connectionClosed()
          Event raised when the connection with the service is closed.
 Event<DuplexChannelEventArgs> connectionOpened()
          Event raised when the connection with the service is open.
 TServiceInterface getProxy()
          Returns service proxy instance.
 void subscribeRemoteEvent(java.lang.String eventName, EventHandler<?> eventHandler)
          Subscribes to an event from the service.
 void unsubscribeRemoteEvent(java.lang.String eventName, EventHandler<?> eventHandler)
          Unsubscribes from the event in the service.
 
Methods inherited from interface eneter.messaging.infrastructure.attachable.IAttachableDuplexOutputChannel
attachDuplexOutputChannel, detachDuplexOutputChannel, getAttachedDuplexOutputChannel, isDuplexOutputChannelAttached
 

Method Detail

connectionOpened

Event<DuplexChannelEventArgs> connectionOpened()
Event raised when the connection with the service is open.

Returns:

connectionClosed

Event<DuplexChannelEventArgs> connectionClosed()
Event raised when the connection with the service is closed.

Returns:

getProxy

TServiceInterface getProxy()
Returns service proxy instance.

Returns:
service proxy implementing the service interface.

subscribeRemoteEvent

void subscribeRemoteEvent(java.lang.String eventName,
                          EventHandler<?> eventHandler)
                          throws java.lang.Exception
Subscribes to an event from the service. You can use this method for subscribing if you do not want to use the service proxy.

Parameters:
eventName - event name.
eventHandler - event handler that will handle events.
Throws:
java.lang.Exception

unsubscribeRemoteEvent

void unsubscribeRemoteEvent(java.lang.String eventName,
                            EventHandler<?> eventHandler)
                            throws java.lang.Exception
Unsubscribes from the event in the service. You can use this method for unsubscribing if you do not want to use the service proxy.

Parameters:
eventName - event name.
eventHandler - event handler that shall be unsubscribed.
Throws:
java.lang.Exception

callRemoteMethod

java.lang.Object callRemoteMethod(java.lang.String methodName,
                                  java.lang.Object[] args)
                                  throws java.lang.Exception
Calls a method in the service. You can use this method if you do not want to use the service proxy.

Parameters:
methodName - name of the method that shall be called.
args - method arguments.
Returns:
return value. It returns null if the method returns void.
Throws:
java.lang.Exception