org.fuin.jmsmvc4swing.jms
Class MethodResultReceiver

java.lang.Object
  extended by org.fuin.jmsmvc4swing.jms.MethodResultReceiver
All Implemented Interfaces:
javax.jms.MessageListener

public abstract class MethodResultReceiver
extends Object
implements javax.jms.MessageListener

Base class for receivers of a method result.


Constructor Summary
MethodResultReceiver(JmsJndiEnvironment env, String topicName, String methodName, long id, ControllerResultListener listener)
          Constructor.
 
Method Summary
 void cancel()
          Cancels the subscription.
protected abstract  void handleResult(Data result)
          Call the concrete message result receiver.
 boolean isCancelled()
          Checks if the subscription was already cancelled or finished.
 void onMessage(javax.jms.Message message)
          
 void subscribe()
          Start subscription to the predefined topic and with the appropriate selector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodResultReceiver

public MethodResultReceiver(JmsJndiEnvironment env,
                            String topicName,
                            String methodName,
                            long id,
                            ControllerResultListener listener)
Constructor.

Parameters:
env - Environment to use.
topicName - Name of the topic (defined by the controller) to send to.
methodName - Name of the method that was called (used for creating the message properties).
id - Unique id of the method call.
listener - Listener to be informed if messages arrive.
Method Detail

subscribe

public final void subscribe()
Start subscription to the predefined topic and with the appropriate selector.


onMessage

public final void onMessage(javax.jms.Message message)

Specified by:
onMessage in interface javax.jms.MessageListener

isCancelled

public final boolean isCancelled()
Checks if the subscription was already cancelled or finished.

Returns:
If the subscription is already closed TRUE else FALSE.

cancel

public final void cancel()
Cancels the subscription.


handleResult

protected abstract void handleResult(Data result)
Call the concrete message result receiver.

Parameters:
result - Data received.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.