/// <summary> /// Set the subscription type for the subscription being created. /// If not called the subscription type defaults to MAMA_SUBSC_TYPE_NORMAL. /// See mamaSubscriptionType enum for valid values. /// </summary> /// <param name="type"> /// The type to set. /// </param> public void setSubscriptionType(mamaSubscriptionType type) { // Verify that the native subscription has been allocated EnsurePeerCreated(); // Call the native layer to set the subscription type CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setSubscriptionType(NativeHandle, (int)type)); }
/// <summary> /// Set the timeout for this subscription. The timeout is used for requesting recaps. /// </summary> /// <param name="timeout"> /// The timeout value in seconds. /// </param> public void setTimeout(double timeout) { // Verify that the subscription has been allocated EnsurePeerCreated(); // Call the native layer to set the timeout CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setTimeout(NativeHandle, timeout)); }
/// <summary> /// Set the number of retries when requesting recaps. /// </summary> /// <param name="retries"> /// The number of retries. /// </param> public void setRetries(int retries) { // Verify that the native subscription has been allocated EnsurePeerCreated(); // Call the native layer to set the number of retries CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setRetries(NativeHandle, retries)); }
/// <summary> /// Set the service level and an passes an optional service level parameter. This method must be invoked before create(). /// </summary> /// <param name="svcLevel"> /// The service level to set. /// </param> /// <param name="serviceLevelOpt"> /// The service level options. /// </param> public void setServiceLevel(mamaServiceLevel svcLevel, int serviceLevelOpt) { // Verify that the native subscription has been allocated EnsurePeerCreated(); // Call the native layer to set the service level CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setServiceLevel(NativeHandle, (int)svcLevel, serviceLevelOpt)); }
/// <summary> /// Set the number of messages to cache for each symbol before the initial /// value arrives. This allows the subscription to recover when the initial /// value arrives late (after a subsequent trade or quote already arrived). /// For group subscription, a separate cache is used for each group member. /// The default is 10. /// </summary> /// <param name="cacheSize"> /// The cache size to set. /// </param> public void setPreInitialCacheSize(int cacheSize) { // Verify that the native subscription has been allocated EnsurePeerCreated(); // Call the native layer to set the cache size CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setPreIntitialCacheSize(NativeHandle, cacheSize)); }
/// <summary> /// Deactivate an active subscription. /// The onDestroy callback will be invoked whenever the subscription has been fully deactivated. /// </summary> public void deactivate() { // Verify that the native subscription has been allocated EnsurePeerCreated(); // Call the native layer CheckResultCode(SubscriptionNativeMethods.mamaSubscription_deactivate(NativeHandle)); }
/// <summary> /// Whether an initial value is required for the specified subscription. /// This only applies to market data subscriptions and not to basic subscriptions. /// Default value of true indicating that initial values are required. /// </summary> /// <param name="requiresInitial"> /// True if the subscription requires an initial. /// </param> public void setRequiresInitial(bool requiresInitial) { // Verify that the native subscription has been allocated EnsurePeerCreated(); // Convert the boolean to an integer value for the native call int requiresInit = requiresInitial ? 1 : 0; // Call the native layer CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setRequiresInitial(NativeHandle, requiresInit)); }
/// <summary> /// If this flag is set then the subscription will attempt to recover from a /// sequence number gap. /// </summary> /// <param name="recover"> /// True to attempt recovery. /// </param> public void setRecoverGaps(bool recover) { // Verify that the native subscription has been allocated EnsurePeerCreated(); // Convert the boolean argument into an integer for the native call int recoverGaps = recover ? 1 : 0; // Call the native layer to set the flag CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setRecoverGaps(NativeHandle, recoverGaps)); }
/// <summary> /// Return the initial value cache size. /// </summary> /// <returns> /// The cache size. /// </returns> public int getPreInitialCacheSize() { // Verify that the native subscription has been allocated EnsurePeerCreated(); int cacheSize = 0; // Call the native layer CheckResultCode(SubscriptionNativeMethods.mamaSubscription_getPreIntitialCacheSize(NativeHandle, ref cacheSize)); return(cacheSize); }
/// <summary> /// Whether an Initial has been received for the specified subscription. /// Returns true if initial has been received. /// </summary> /// <returns> /// True if an initial has been received for this subscription. /// </returns> public bool getReceivedInitial() { // Returns bool ret = false; // Verify that the native subscription has been allocated EnsurePeerCreated(); // Call the native layer int receivedInitial = 0; CheckResultCode(SubscriptionNativeMethods.mamaSubscription_getReceivedInitial(NativeHandle, ref receivedInitial)); // Convert the integer returned from the native call into a boolean if (receivedInitial == 1) { ret = true; } return(ret); }
/// <summary> /// Set the parameters for a subscription that may be actually activated later. /// Activate the subscription using MamaSubscription.activate(). /// </summary> /// <param name="queue"> /// The mama queue. /// </param> /// <param name="callback"> /// The callback. /// </param> /// <param name="source"> /// The MamaSource identifying the publisher for this symbol. /// </param> /// <param name="symbol"> /// The symbol for the listener. /// </param> /// <param name="closure"> /// The caller supplied closure. /// </param> public void setup(MamaQueue queue, MamaSubscriptionCallback callback, MamaSource source, string symbol, object closure) { // Verify that the subscription has been created EnsurePeerCreated(); // Save arguments in member variables base.mClosure = closure; base.mQueue = queue; base.mTransport = source.transport; // Create the impl IntPtr impl = MamaSubscriptionImpl.Create(callback, closure, this); // Call into the native layer to setup the subscription CheckResultCode(SubscriptionNativeMethods.mamaSubscription_setup( NativeHandle, queue.NativeHandle, ref MamaBasicSubscription.mCallbackDelegates, source.NativeHandle, symbol, impl)); }