/// <summary> /// Called when an error has occurred with the subscription /// </summary> /// <param name="subscription"> /// The subscription where the error has been detected. /// </param> /// <param name="status"> /// The status code associated with the error. /// </param> /// <param name="subject"> /// The subject for entitlement errors. /// </param> void MamaBasicSubscriptionCallback.onError(MamaBasicSubscription subscription, MamaStatus.mamaStatus status, string subject) { if (mCallback != null) { mCallback.onError((MamaSubscription)subscription, status, subject); } }
/// <summary> /// Invoked when a message arrives /// </summary> /// <param name="subscription"> /// The subscription where the message has arrived. /// </param> /// <param name="message"> /// The message. /// </param> void MamaBasicSubscriptionCallback.onMsg(MamaBasicSubscription subscription, MamaMsg message) { if (mCallback != null) { mCallback.onMsg((MamaSubscription)subscription, message); } }
/* ************************************************************** */ #region MamaBasicSubscriptionCallback Implementation /// <summary> /// Called when subscription creation is complete, and before /// the onMsg() callback is invoked /// </summary> /// <param name="subscription"> /// The subscription that has been created. /// </param> void MamaBasicSubscriptionCallback.onCreate(MamaBasicSubscription subscription) { if (mCallback != null) { mCallback.onCreate((MamaSubscription)subscription); } }
/// <summary> /// Invoked whenever the basic subscription has been destroyed. The client can have confidence that /// no further messages will be placed on the queue for this subscription. /// </summary> /// <param name="subscription"> /// The basic subscription. /// </param> /// <param name="closure"> /// The closure provided to the createBasic function. /// </param> void MamaBasicSubscriptionCallback.onDestroy(MamaBasicSubscription subscription, object closure) { if (mCallback != null) { mCallback.onDestroy((MamaSubscription)subscription); } }
/// <summary> /// Constructor initialises all member variables. /// </summary> /// <param name="callback"> /// The user callback implementation. /// </param> /// <param name="closure"> /// The closure supplied to the MamaBasicSubscription.createBasic function. /// </param> /// <param name="subscription"> /// The actual C# timer object. /// </param> internal MamaBasicSubscriptionImpl(MamaBasicSubscriptionCallback callback, object closure, MamaBasicSubscription subscription) { // Save arguments in member variables mCallback = callback; mClosure = closure; mSubscription = subscription; }
/* ************************************************************** */ #region Internal Operations /// <summary> /// This function creates a new impl and returns an IntPtr that can then be passed to /// the native layer. /// </summary> /// <param name="callback"> /// The user callback implementation /// </param> /// <param name="closure"> /// The closure supplied to the MamaBasicSubscription.createBasic function. /// </param> /// <param name="subscription"> /// The actual C# subscription object. /// </param> /// <returns> /// The IntPtr that can then be used for the closure. /// </returns> internal static IntPtr Create(MamaBasicSubscriptionCallback callback, object closure, MamaBasicSubscription subscription) { // Allocate a new impl MamaBasicSubscriptionImpl impl = new MamaBasicSubscriptionImpl(callback, closure, subscription); // Create a GC handle GCHandle handle = GCHandle.Alloc(impl); // Return the native pointer return((IntPtr)handle); }
/// <summary> /// Called when an error has occurred with the subscription /// </summary> /// <param name="subscription"> /// The subscription where the error has been detected. /// </param> /// <param name="status"> /// The status code associated with the error. /// </param> /// <param name="subject"> /// The subject for entitlement errors. /// </param> void MamaBasicSubscriptionCallback.onError(MamaBasicSubscription subscription, MamaStatus.mamaStatus status, string subject) { if (mCallback != null) { mCallback.onError((MamaSubscription)subscription, status, subject); } }
/// <summary> /// Invoked when a message arrives /// </summary> /// <param name="subscription"> /// The subscription where the message has arrived. /// </param> /// <param name="message"> /// The message. /// </param> void MamaBasicSubscriptionCallback.onMsg(MamaBasicSubscription subscription, MamaMsg message) { if (mCallback != null) { mCallback.onMsg((MamaSubscription)subscription, message); } }
/// <summary> /// Invoked whenever the basic subscription has been destroyed. The client can have confidence that /// no further messages will be placed on the queue for this subscription. /// </summary> /// <param name="subscription"> /// The basic subscription. /// </param> /// <param name="closure"> /// The closure provided to the createBasic function. /// </param> void MamaBasicSubscriptionCallback.onDestroy(MamaBasicSubscription subscription, object closure) { if (mCallback != null) { mCallback.onDestroy((MamaSubscription)subscription); } }
/* ************************************************************** */ #region MamaBasicSubscriptionCallback Implementation /// <summary> /// Called when subscription creation is complete, and before /// the onMsg() callback is invoked /// </summary> /// <param name="subscription"> /// The subscription that has been created. /// </param> void MamaBasicSubscriptionCallback.onCreate(MamaBasicSubscription subscription) { if (mCallback != null) { mCallback.onCreate((MamaSubscription)subscription); } }
public static extern int mamaSubscription_setup2(IntPtr subscription, IntPtr transport, IntPtr queue, ref MamaBasicSubscription.NativeMethods.SubscriptionCallbacks callbacks, [MarshalAs(UnmanagedType.LPStr)]string sourceName, [MarshalAs(UnmanagedType.LPStr)]string symbol, IntPtr closure);
/* ************************************************************** */ #region Internal Operations /// <summary> /// This function creates a new impl and returns an IntPtr that can then be passed to /// the native layer. /// </summary> /// <param name="callback"> /// The user callback implementation /// </param> /// <param name="closure"> /// The closure supplied to the MamaBasicSubscription.createBasic function. /// </param> /// <param name="subscription"> /// The actual C# subscription object. /// </param> /// <returns> /// The IntPtr that can then be used for the closure. /// </returns> internal static IntPtr Create(MamaBasicSubscriptionCallback callback, object closure, MamaBasicSubscription subscription) { // Allocate a new impl MamaBasicSubscriptionImpl impl = new MamaBasicSubscriptionImpl(callback, closure, subscription); // Create a GC handle GCHandle handle = GCHandle.Alloc(impl); // Return the native pointer return (IntPtr)handle; }
/// <summary> /// Constructor initialises all member variables. /// </summary> /// <param name="callback"> /// The user callback implementation. /// </param> /// <param name="closure"> /// The closure supplied to the MamaBasicSubscription.createBasic function. /// </param> /// <param name="subscription"> /// The actual C# timer object. /// </param> internal MamaBasicSubscriptionImpl(MamaBasicSubscriptionCallback callback, object closure, MamaBasicSubscription subscription) { // Save arguments in member variables mCallback = callback; mClosure = closure; mSubscription = subscription; }