Class MethodSubscription

java.lang.Object
COM.TIBCO.hawk.talon.MethodInvocation
COM.TIBCO.hawk.talon.MethodSubscription
All Implemented Interfaces:
Serializable

public class MethodSubscription extends MethodInvocation
This class is used to represent a method subscription.

A MethodSubscription is similar to a MethodInvocation but is used to subscribe to method results.

A MethodSubscription should be constructed in accordance with the MethodDescriptor of the target method.

You can use either of two constructors to build a MethodSubscription depending on whether you are creating a subscription for a synchronous or asynchronous method. (See MethodDescriptor.isAsync() )

The constructor for synchronous method subscriptions requires an interval parameter. It is used to specify a desired subscription service rate. Subscriptions made of synchronous methods will use this value as a hint to determine how often to deliver data to service a subscription. Most microagents will usually enforce a minimum rate which will be used if the supplied value is below their minimum.

The constructor for asynchronous method subscriptions does not accept an interval parameter. Asynchronous methods deliver data at a rate determined by the microagent, typically, whenever it is available.

See Also:
  • Constructor Details

    • MethodSubscription

      public MethodSubscription(String methodName, DataElement[] args, long interval)
      Used to construct method subscriptions for synchronous methods
      Parameters:
      methodName - The name of the method
      args - An array of DataElement objects representing the arguments of the method. The names and values of these elements should correspond to what was described in the MethodDescriptor for this method. They must be serializable types.
      interval - The desired subscription service rate in milliseconds. Must be greater than zero.
    • MethodSubscription

      public MethodSubscription(String methodName, DataElement[] args)
      Used to construct method subscriptions for asynchronous methods
      Parameters:
      methodName - The name of the method
      args - An array of DataElement objects representing the arguments of the method. The names and values of these elements should correspond to what was described in the MethodDescriptor for this method. They must be serializable types.
  • Method Details

    • getInterval

      public long getInterval()
      Returns the subscription interval of subscriptions constructed for synchronous methods.
      Returns:
      The subscription interval
      Throws:
      IllegalStateException - If isAsync() returns true
    • isAsync

      public boolean isAsync()
      Returns true if this object was built with the constructor for asynchronous method subscriptions.
    • equals

      public boolean equals(Object obj)
      Compares this object against the specified object.

      Two MethodSubscription objects are equal if they have the same interval, method name and equalent argument lists.

      Overrides:
      equals in class MethodInvocation
      Returns:
      true if the two objects are equal.
    • hashCode

      public int hashCode()
      Returns a hashcode for this Integer.
      Overrides:
      hashCode in class MethodInvocation
      Returns:
      a hash code value for this object.
    • toString

      public String toString()
      Returns a string representation of this MethodSubscription
      Overrides:
      toString in class MethodInvocation