public void onSendComplete( MamaPublisher publisher, MamaMsg message, MamaStatus.mamaStatus status, object closure) { message.destroy(); }
/*Invoked if any errors are encountered during subscription processing*/ public void onError(MamaSubscription subscription, MamaStatus.mamaStatus status, string subject) { Console.WriteLine("Symbol=[" + subscription.subscSymbol + "] : " + "An error occurred creating subscription: " + MamaStatus.stringForStatus(status)); }
public void onError(MamaPublisher publisher, MamaStatus.mamaStatus status, string topic) { errorCount++; string subject = publisher.getSource() + "." + publisher.getSymbol(); // test getters Mama.log(MamaLogLevel.MAMA_LOG_LEVEL_FINE, "MamaPublisherTest.onError: " + subject + " status=" + ((int)status)); }
/// <summary> /// Handler is called whenever mama_start completes, /// </summary> /// <param name="status"> /// The status returned from mama_start. /// </param> internal void onStartBackgroundCompleted(MamaStatus.mamaStatus status) { // Invoke the callback function if (mCallback != null) { // Create a new mama status using the data passed in mCallback.onStartComplete(status); } }
/// <summary> /// This function will invoke the error callback on the user supplied callback implementation. /// </summary> /// <param name="nativeStatus"> /// The status code for the error that has occured. /// </param> internal void InvokeError(int nativeStatus) { // Only invoke the callback if it is supplied if (null != mCallback) { // Create a managed status value fo the native value passed in MamaStatus.mamaStatus status = (MamaStatus.mamaStatus)nativeStatus; // Invoke the callback mCallback.onError(mInbox, status); } }
/// <summary> /// This function will invoke the error callback on the user supplied callback implementation. /// </summary> /// <param name="nativeStatus"> /// The status code for the error that has occured. /// </param> /// <param name="subject"> /// The subject for entitlement errors. /// </param> internal override void InvokeError(int nativeStatus, string subject) { // Only invoke the callback if it is supplied if (null != mCallback) { // Create a managed status value fo the native value passed in MamaStatus.mamaStatus status = (MamaStatus.mamaStatus)nativeStatus; // Invoke the callback mCallback.onError(mSubscription, status, subject); } }
/// <summary> /// This function is called by the base class whenever the MamaQueue is disposed, it will attempt to /// destroy the queue if this has not already been done. /// <seealso cref="MamaWrapper.DestroyNativePeer"/> /// </summary> /// <returns>MAMA Status code</returns> protected override MamaStatus.mamaStatus DestroyNativePeer() { // Returns MamaStatus.mamaStatus ret = MamaStatus.mamaStatus.MAMA_STATUS_OK; // Only continue if the native queue is valid if (nativeHandle != IntPtr.Zero) { ret = (MamaStatus.mamaStatus)NativeMethods.mamaQueue_destroy(nativeHandle); } return(ret); }
/* ************************************************************** */ #region Protected Functions /// <summary> /// This will be called by the base class to de-allocate the native subscription. /// <seealso cref="MamaWrapper.DestroyNativePeer"/> /// </summary> /// <returns> /// MAMA Status code. /// </returns> protected override MamaStatus.mamaStatus DestroyNativePeer() { // Returns MamaStatus.mamaStatus ret = MamaStatus.mamaStatus.MAMA_STATUS_OK; // Only deallocate if this has not already been done if (IntPtr.Zero != NativeHandle) { ret = (MamaStatus.mamaStatus)NativeMethods.mamaSubscription_deallocate(NativeHandle); } return(ret); }
public void onError( MamaSubscription subscription, MamaStatus.mamaStatus status, string subject) { MamdaErrorSeverity severity = MamdaErrorSeverity.MAMDA_SEVERITY_OK; MamdaErrorCode code = MamdaErrorCode.MAMDA_NO_ERROR; string errStr = "unknown"; switch (status) { case MamaStatus.mamaStatus.MAMA_STATUS_BAD_SYMBOL: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_BAD_SYMBOL; errStr = "bad symbol"; break; case MamaStatus.mamaStatus.MAMA_STATUS_TIMEOUT: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_TIMEOUT; errStr = "timeout"; break; case MamaStatus.mamaStatus.MAMA_STATUS_NOT_ENTITLED: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_NOT_ENTITLED; errStr = "entitlement"; break; case MamaStatus.mamaStatus.MAMA_STATUS_NOT_FOUND: severity = MamdaErrorSeverity.MAMDA_SEVERITY_LOW; code = MamdaErrorCode.MAMDA_ERROR_NOT_FOUND; errStr = "not found"; break; default: break; } for (int i = 0; i < mSubscription.mErrorListeners.Count; i++) { MamdaErrorListener listener = (MamdaErrorListener)mSubscription.mErrorListeners[i]; listener.onError( mSubscription, severity, code, MamdaErrorCodes.stringForMamdaError(code)); } }
/// <summary> /// Get a MAMA price field. /// </summary> public MamaPrice getPrice() { EnsurePeerCreated(); if (price_ == null) { price_ = new MamaPrice(); } int code = NativeMethods.mamaMsgField_getPrice(nativeHandle, price_.NativeHandle); MamaStatus.mamaStatus status = (MamaStatus.mamaStatus)code; if (status != MamaStatus.mamaStatus.MAMA_STATUS_OK) { throw new MamaException(status); } return(price_); }
/// <summary> /// The actual implementation of Dispose - called by both the Dispose method and the finalizer. /// </summary> /// <param name="disposing">true if the object is being disposed (false if being finalized)</param> protected virtual void Dispose(bool disposing, bool destroyNativeHandle = true) { MamaStatus.mamaStatus status = MamaStatus.mamaStatus.MAMA_STATUS_OK; if (disposing) { OnDispose(); if (mOwnsThePeer) { // prevent the object from being finalized later GC.SuppressFinalize(this); } } if (!mOwnsThePeer) { return; } if (nativeHandle != IntPtr.Zero) { try { if (Mama.opened) { status = DestroyNativePeer(); } if (disposing) { // only throw exception if the object is not being finalized if (status != MamaStatus.mamaStatus.MAMA_STATUS_OK) { throw new MamaException(status); } } } finally { if (destroyNativeHandle) { nativeHandle = IntPtr.Zero; } } } }
public void unregister() { #if MAMA_WRAPPERS_CHECK_ARGUMENTS if (mHandle == IntPtr.Zero) { throw new InvalidOperationException("Already unregistered"); } #endif // MAMA_WRAPPERS_CHECK_ARGUMENTS if (mHandle != IntPtr.Zero) { mGroup.EnsurePeerCreated(); int code = NativeMethods.mamaSourceGroup_unregisterStateChangeCallback(mGroup.NativeHandle, mHandle); MamaStatus.mamaStatus status = (MamaStatus.mamaStatus)code; if (status != MamaStatus.mamaStatus.MAMA_STATUS_OK) { throw new MamaException(status); } mGroup.mRegistrations.Remove(mKey.ToInt32()); mHandle = IntPtr.Zero; mKey = IntPtr.Zero; } }
/// <summary> /// Get a MamaMsg field /// </summary> public MamaMsg getMsg() { EnsurePeerCreated(); IntPtr myP = IntPtr.Zero; int code = NativeMethods.mamaMsgField_getMsg(nativeHandle, ref myP); MamaStatus.mamaStatus status = (MamaStatus.mamaStatus)code; if (status != MamaStatus.mamaStatus.MAMA_STATUS_OK) { throw new MamaException(status); } if (msg_ == null) { msg_ = new MamaMsg(); } msg_.setNativeHandle(myP); return(msg_); }
/// <summary> /// Constructs a new MamaException with the specified status code /// and a custom error message. /// </summary> /// <param name="status">the MAMA status code</param> /// <param name="message">the custom error message</param> public MamaException(MamaStatus.mamaStatus status, string message) : base(message != null ? message : String.Empty) { this.mStatus = status; }
public void onError( MamaSubscription subscription, MamaStatus.mamaStatus status, string subject) { MamdaErrorSeverity severity = MamdaErrorSeverity.MAMDA_SEVERITY_OK; MamdaErrorCode code = MamdaErrorCode.MAMDA_NO_ERROR; switch (status) { case MamaStatus.mamaStatus.MAMA_STATUS_BAD_SYMBOL: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_BAD_SYMBOL; break; case MamaStatus.mamaStatus.MAMA_STATUS_TIMEOUT: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_TIMEOUT; break; case MamaStatus.mamaStatus.MAMA_STATUS_NOT_ENTITLED: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_NOT_ENTITLED; break; case MamaStatus.mamaStatus.MAMA_STATUS_NOT_FOUND: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_NOT_FOUND; break; case MamaStatus.mamaStatus.MAMA_STATUS_NO_SUBSCRIBERS: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_NO_SUBSCRIBERS; break; case MamaStatus.mamaStatus.MAMA_STATUS_EXPIRED: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_EXPIRED; break; case MamaStatus.mamaStatus.MAMA_STATUS_NOT_PERMISSIONED: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_NOT_PERMISSIONED; break; case MamaStatus.mamaStatus.MAMA_STATUS_BANDWIDTH_EXCEEDED: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_BANDWIDTH_EXCEEDED; break; case MamaStatus.mamaStatus.MAMA_STATUS_DELETE: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_DELETE; break; case MamaStatus.mamaStatus.MAMA_STATUS_PLATFORM: default: severity = MamdaErrorSeverity.MAMDA_SEVERITY_HIGH; code = MamdaErrorCode.MAMDA_ERROR_PLATFORM_STATUS; break; } for (int i = 0; i < mSubscription.mErrorListeners.Count; i++) { MamdaErrorListener listener = (MamdaErrorListener)mSubscription.mErrorListeners[i]; listener.onError( mSubscription, severity, code, MamdaErrorCodes.stringForMamdaError(code)); } }
public void onError(MamaSubscription subscription, MamaStatus.mamaStatus status, string subject) { Console.WriteLine("Subscription error:" + subject); }
/// <summary> /// Constructs a new MamaException with the specified status code. /// Automatically populates the textual description of the error. /// </summary> /// <param name="status">the MAMA status code</param> public MamaException(MamaStatus.mamaStatus status) : this(status, MamaStatus.stringForStatus(status)) { }
/// <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); } }
public void onError(MamaSubscription subscription, MamaStatus.mamaStatus status, string subject) { Console.WriteLine("An error occurred creating subscription for " + subject + ": " + status.ToString()); }
public void onError(MamaInbox inbox, MamaStatus.mamaStatus status) { Console.WriteLine("Error creating inbox: {0}", MamaStatus.stringForStatus(status)); Exit(1); }
/// <summary> /// Return status code as a string /// </summary> public static string stringForStatus(MamaStatus.mamaStatus status) { return(String.Format("mamaStatus: ({0})", status)); }
public void onError(MamaSubscription subscription, MamaStatus.mamaStatus status, string subject) { stats.mErrorCount++; }
public void onSuccess(MamaPublisher publisher, MamaStatus.mamaStatus status, string topic) { Console.WriteLine("onPublishSuccess: " + topic + " " + status.ToString()); }
public void onError(MamaPublisher publisher, MamaStatus.mamaStatus status, string topic) { Console.WriteLine("onPublishError: " + topic + " " + status.ToString()); }
public void onError(MamaSubscription subscription, MamaStatus.mamaStatus status, string subject) { Console.WriteLine("Error creating subscription: {0}", MamaStatus.stringForStatus(status)); Exit(1); }
public void onStartComplete(MamaStatus.mamaStatus status) { }