Class MamaSubscription


  • public class MamaSubscription
    extends java.lang.Object
    • Constructor Detail

      • MamaSubscription

        public MamaSubscription()
        The constructor allocates the underlying C subscription.
    • Method Detail

      • createSubscription

        public void createSubscription​(MamaSubscriptionCallback callback,
                                       MamaQueue queue,
                                       MamaSource source,
                                       java.lang.String symbol,
                                       java.lang.Object closure)
        Create and activate subscription. This is effectively a pair of calls to mamaSubscription_setup() and mamaSubscription_activate().
        Parameters:
        callback - The object implementing the callback functions.
        queue - The MamaQueue.
        source - The MamaSource identifying the publisher for this symbol.
        symbol - The symbol name.
        closure - The closure will be passed to subsequent callback invocations for this subscription.
      • createDictionarySubscription

        public MamaDictionary createDictionarySubscription​(MamaDictionaryCallback callback,
                                                           MamaQueue queue,
                                                           MamaSource source)
        Create a dictionary subscription using default values for the timeout and number of retries.
        Parameters:
        callback - The object implementing the callback functions, this can also be an instance of MamaSubscriptionCallbackEx to be notified when the subscription has been destroyed.
        queue - The MamaQueue.
        source - The MamaSource identifying the publisher for this symbol.
      • createDictionarySubscription

        public MamaDictionary createDictionarySubscription​(MamaDictionaryCallback callback,
                                                           MamaQueue queue,
                                                           MamaSource source,
                                                           double timeout,
                                                           int retries)
        Create a dictionary subscription using default values for the timeout and number of retries.
        Parameters:
        callback - The object implementing the callback functions.
        queue - The MamaQueue.
        source - The MamaSource identifying the publisher for this symbol.
        timeout - The timeout value in seconds.
        retries - The number of retries.
      • createSnapshotSubscription

        public void createSnapshotSubscription​(MamaSubscriptionCallback callback,
                                               MamaQueue queue,
                                               MamaSource source,
                                               java.lang.String symbol,
                                               java.lang.Object closure)
        Create a snapshot subscription for initial value only (no updates). This function is equivalent to mamaSubscription_create () with svcLevel set to MAMA_SERVICE_LEVEL_SNAPSHOT and default arguments for type, svcLevelOpt, requiresInitial, retries, timeout.
        Parameters:
        callback - The object implementing the callback functions.
        queue - The MamaQueue.
        source - The MamaSource identifying the publisher for this symbol.
        symbol - The symbol name.
        closure - The closure will be passed to subsequent callback invocations for this subscription.
      • getClosure

        public java.lang.Object getClosure()
        This function returns the closure supplied to the createSubscription function.
        Returns:
        The closure object.
      • getPointerVal

        public long getPointerVal()
        This function returns the pointer to the underlying C subscription.
        Returns:
        The pointer.
      • getSource

        public MamaSource getSource()
        Return the source associated with the subscription.
        Returns:
        The MamaSource object.
      • getState

        public MamaSubscriptionState getState()
        This function returns the current state of the subscription as one of the MamaSubscriptionState instances, see this class for more information.
        Returns:
        The MamaSubscriptionState that represents the current state of the subscription.
      • setupSubscription

        public void setupSubscription​(MamaSubscriptionCallback callback,
                                      MamaQueue queue,
                                      MamaSource source,
                                      java.lang.String symbol,
                                      java.lang.Object closure)
        Setup a basic subscription without marketdata semantics. Note that activate must still be called.
        Parameters:
        callback - The object implementing the callback functions.
        queue - The MamaQueue.
        source - The MamaSource identifying the publisher for this symbol.
        symbol - The symbol name.
        closure - The closure will be passed to subsequent callback invocations for this subscription.
      • setAppDataType

        public void setAppDataType​(MamaMdDataType type)
      • setDebugLevel

        public void setDebugLevel​(java.util.logging.Level level)
      • setMessageQualifierFilter

        public void setMessageQualifierFilter​(MamaMsgQualifier qualifier)
      • getMessageQualifierFilter

        public MamaMsgQualifier getMessageQualifierFilter()
      • activate

        public void activate()
        Activate a subscription that has been set up by calling MamaSubscription.setup. Subscription creation actually occurs on the throttle queue. An individual subscription cannot be assumed to be fully created until its onCreate() callback has been successfully invoked. The subscription rate can be governed via the MamaTransport.setOutboundThrottle () function. Any subscription properties should be set prior to calling this function.
      • deactivate

        public void deactivate()
        Deactivate a subscription. The subscription can be reactivated if desired using MamaSubscription.activate(). Note that the subscription will not be fully deactivated until the onDestroy callback is received.
      • deallocate

        public void deallocate()
        De-allocates the underlying C subscription. This can be used to reduce time during finalization.
      • destroy

        public void destroy()
        This function will destroy the subscription, it must be called from the same thread that is processing the queue for the subscription. Use destroyEx to destroy the subscription from any thread. Note that the subscription will not be fully destroyed until the onDestroy callback is received.
      • destroyEx

        public void destroyEx()
        This function will destroy the subscription and can be called from any thread. Note that the subscription will not be fully destroyed until the onDestroy callback is received. To destroy from the dispatching thread the destroy function should be used in preference.
      • getReceivedInitial

        public boolean getReceivedInitial()
        Get whether we have received an Initial.
        Returns:
        True if an initial has been received.
      • getSubscSource

        public java.lang.String getSubscSource()
        Return the source for this subscription.
        Returns:
        The source string.
      • getSymbol

        public java.lang.String getSymbol()
        Return the symbol for this subscription.
        Returns:
        The symbol string.
      • getTimeout

        public double getTimeout()
        To return the subscription timeout.
        Returns:
        The timeout in seconds.
      • isActive

        public boolean isActive()
        Returns whether the subscription is valid, note that this function has been deprecated, use mamaSubscription_getState instead.
        Returns:
        whether the subscription is valid.
      • isValid

        public boolean isValid()
        Returns whether the subscription is valid, note that this function has been deprecated, use mamaSubscription_getState instead.
        Returns:
        whether the subscription is valid.
      • setRequiresInitial

        public void setRequiresInitial​(boolean value)
        Set whether subscriptoin requires initial value.
        Parameters:
        value - True if the subscription needs an initial.
      • setTimeout

        public void setTimeout​(double timeout)
        Set the timeout for this subscription.
        Parameters:
        timeout - The timeout in seconds.
      • getItemClosure

        public java.lang.Object getItemClosure()
      • getPreInitialCacheSize

        public int getPreInitialCacheSize()
      • getRecoverGaps

        public boolean getRecoverGaps()
      • getRequiresInitital

        public boolean getRequiresInitital()
      • getRetries

        public int getRetries()
      • getServiceLevel

        public short getServiceLevel()
      • getServiceLevelOptions

        public long getServiceLevelOptions()
      • setPreInitialCacheSize

        public void setPreInitialCacheSize​(int size)
      • setItemClosure

        public void setItemClosure​(java.lang.Object closure)
      • setRecoverGaps

        public void setRecoverGaps​(boolean recover)
      • setServiceLevel

        public void setServiceLevel​(short level,
                                    long options)
      • setRetries

        public void setRetries​(int retries)