cgl.imr.client
Class ClientCall

java.lang.Object
  extended by cgl.imr.client.ClientCall
All Implemented Interfaces:
Subscribable, Runnable

public class ClientCall
extends Object
implements Subscribable, Runnable

A utility class to send/receive messages using pub-sub infrastructure.


Constructor Summary
ClientCall()
           
 
Method Summary
 void close()
           
 void onEvent(byte[] message)
          This method is called when a message is available.
 void run()
           
 List<byte[]> sendReceive(String pubTopic, String subTopic, byte[] data)
          This method acts as the request-response invocation using pub/sub First, it subscribe to the response topic, and send the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientCall

public ClientCall()
           throws TwisterException
Throws:
TwisterException
Method Detail

close

public void close()
           throws TwisterException
Throws:
TwisterException

onEvent

public void onEvent(byte[] message)
Description copied from interface: Subscribable
This method is called when a message is available. Here we only expect a set of bytes format from the pub-sub service. Any pub-sub event specific information is not passed inside i-MapRedcue framework.

Specified by:
onEvent in interface Subscribable

run

public void run()
Specified by:
run in interface Runnable

sendReceive

public List<byte[]> sendReceive(String pubTopic,
                                String subTopic,
                                byte[] data)
                         throws TwisterException
This method acts as the request-response invocation using pub/sub First, it subscribe to the response topic, and send the request. Caller can specify the number of responses expected.

Parameters:
pubTopic - - Topic to send data.
subTopic - - Topic to receive data.
data - - Data to be sent.
Returns:
List of received byte[]s corresponding to incomming messags.
Throws:
TwisterException


For comments and suggestions please send e-mail to