MamaQueues allow applications to dispatch events in order with multiple threads.
Inherits from Wombat.MamaWrapper, IDisposable
Name | |
---|---|
MamaQueue(MamaBridge bridgeImpl) Create a queue |
|
void | setHighWatermark(int highWatermark) Specify a high watermark for events on the queue. The behaviour for setting this value results in on the underlying middleware varies. |
int | getHighWatermark() Get the value of the high water mark for the specified queue. A value of 0 will be returned if no high water mark was previously specified. |
void | setLowWatermark(int lowWatermark) Set the low water mark for the queue. Only supported by Wombat TCP middleware. |
void | setQueueName(string queueName) Sets the name of the queue to the given name (for stats, OS naming etc). |
int | getLowWatermark() Get the value of the low water mark for the specified queue. A value of 1 will be returned if no low water mark was previously specified. |
int | getEventCount() |
string | getQueueBridgeName() Get the name of the bridge associated with the queue - either “wmw”, “lbm”, or “tibrv”. |
void | setQueueMonitorCallbacks(MamaQueueMonitorCallback callback, object closure) Specify a set of callbacks which may be invoked in response to certain conditions arising on the queue. |
void | setEnqueueCallback(MamaQueueEnqueueCallback callback) Register the specified callback function to receive a callback each time an event is enqueued on the specified MamaQueue |
void | enqueueEvent(MamaQueueEventCallback callback, object closure) This function will enqueue an event on the mama queue. |
bool | canDestroy() Check to see if a queue can be destroyed. The queue cannot be destroyed if there are currently open event objects on it. |
void | destroy() Destroy a queue. Note that the queue can only be destroyed if all of the objects created on it, (timers, subscriptions etc), have been destroyed. |
void | destroyWait() Destroy a queue. Note that the queue can only be destroyed if all of the objects created on it, (timers, subscriptions etc), have been destroyed. This function will block until all of the objects have been destroyed and will then destroy the queue. |
void | destroyTimedWait(long timeout) Destroy a queue. Note that the queue can only be destroyed if all of the objects created on it, (timers, subscriptions etc), have been destroyed. This function will block until all of the objects have been destroyed and will then destroy the queue. |
void | dispatch() Dispatch messages from the queue. This call blocks and dispatches until stopDispatch() is called. |
void | dispatchEvent() Dispatch a single event from the specified queue. If there is no event on the queue simply return and do nothing. |
void | stopDispatch() Unblock the queue as soon as possible. This will cause mamaDispatchers to exit. Creating a new dispatcher will resume dispatching events. |
void | timedDispatch(long timeout) Dispatch messages from the queue until timeout has elapsed. Some middleware implementations will always block until timeout (dispatching multiple times), whereas others will always unblock once the first event is dispatched or the timeout has elapsed - whichever comes first. |
Name | |
---|---|
virtual override MamaStatus.mamaStatus | DestroyNativePeer() 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. MamaWrapper.DestroyNativePeer |
Public Functions inherited from Wombat.MamaWrapper
Name | |
---|---|
void | Dispose() Destroys the underlying peer object and unbinds the wrapper from it. |
void | setNativeHandle(IntPtr nHandle) Sets the native handle of the native peer object. Should only be used by subclasses and in the same assembly. |
Protected Functions inherited from Wombat.MamaWrapper
Name | |
---|---|
MamaWrapper() Constructs a new wrapper object but doesn’t create it. If the object is not explicitly disposed it will remain registered for finalization and will attempt the destroy the native peer object when finalized. |
|
MamaWrapper(IntPtr nativeHandle) Constructs a managed wrapper from an existing native peer. The peer object will not be automatically finalized |
|
virtual void | Dispose(bool disposing, bool destroyNativeHandle =true) The actual implementation of Dispose - called by both the Dispose method and the finalizer. |
virtual void | OnDispose() |
Protected Attributes inherited from Wombat.MamaWrapper
Name | |
---|---|
IntPtr | nativeHandle the handle to the native peer object |
MamaQueue(
MamaBridge bridgeImpl
)
Create a queue
void setHighWatermark(
int highWatermark
)
Specify a high watermark for events on the queue. The behaviour for setting this value results in on the underlying middleware varies.
LBM: LBM uses an unbounded event queue. Setting this values allows users of the API to receive a callback if the value is exceeded. (MamaQueue.setQueueMonitorCallbacks for setting queue-related callbacks.) The default behaviour is for the queue to grow unbounded without notifications.
The high watermark for LBM can be set for all queues at once by setting the mama.lbm.eventqueuemonitor.queue_size_warning property for the API. Calls to this function will override the value specified in mama.properties at runtime. Callbacks can be disabled by setting this value to 0 - effectively disabling high watermark checking.
RV: This will set a queue limit policy of TIBRVQUEUE_DISCARD_FIRST whereby the oldest events in the queue are discarded first. The discard amount will be set with a value of 1. I.e. events will be dropped from the queue one at a time. The default behaviour is an unlimited queue which does not discard events.
int getHighWatermark()
Get the value of the high water mark for the specified queue. A value of 0 will be returned if no high water mark was previously specified.
void setLowWatermark(
int lowWatermark
)
Set the low water mark for the queue. Only supported by Wombat TCP middleware.
The low watermark must be greater than 1 and less than highWaterMark otherwise this method returns MAMA_STATUS_INVALID_ARG. For this reason the high water mark must be set before invoking this method.
void setQueueName(
string queueName
)
Sets the name of the queue to the given name (for stats, OS naming etc).
int getLowWatermark()
Get the value of the low water mark for the specified queue. A value of 1 will be returned if no low water mark was previously specified.
int getEventCount()
string getQueueBridgeName()
Get the name of the bridge associated with the queue - either “wmw”, “lbm”, or “tibrv”.
void setQueueMonitorCallbacks(
MamaQueueMonitorCallback callback,
object closure
)
Specify a set of callbacks which may be invoked in response to certain conditions arising on the queue.
The behaviour here is middleware specific as not all will support all callbacks.
LBM: When the high watermark is exceeded the mamaQueueHighWatermarkExceededCb callback will invoked each time an event on the queue is dispatched until such time as the number of events on the queue falls below the high watermark.
RV: Not currently supported.
void setEnqueueCallback(
MamaQueueEnqueueCallback callback
)
Register the specified callback function to receive a callback each time an event is enqueued on the specified MamaQueue
void enqueueEvent(
MamaQueueEventCallback callback,
object closure
)
This function will enqueue an event on the mama queue.
Parameters:
Exceptions:
bool canDestroy()
Check to see if a queue can be destroyed. The queue cannot be destroyed if there are currently open event objects on it.
Return: True if the queue can be destroyed.
void destroy()
Destroy a queue. Note that the queue can only be destroyed if all of the objects created on it, (timers, subscriptions etc), have been destroyed.
Exceptions:
void destroyWait()
Destroy a queue. Note that the queue can only be destroyed if all of the objects created on it, (timers, subscriptions etc), have been destroyed. This function will block until all of the objects have been destroyed and will then destroy the queue.
void destroyTimedWait(
long timeout
)
Destroy a queue. Note that the queue can only be destroyed if all of the objects created on it, (timers, subscriptions etc), have been destroyed. This function will block until all of the objects have been destroyed and will then destroy the queue.
Exceptions:
void dispatch()
Dispatch messages from the queue. This call blocks and dispatches until stopDispatch() is called.
void dispatchEvent()
Dispatch a single event from the specified queue. If there is no event on the queue simply return and do nothing.
void stopDispatch()
Unblock the queue as soon as possible. This will cause mamaDispatchers to exit. Creating a new dispatcher will resume dispatching events.
void timedDispatch(
long timeout
)
Dispatch messages from the queue until timeout has elapsed. Some middleware implementations will always block until timeout (dispatching multiple times), whereas others will always unblock once the first event is dispatched or the timeout has elapsed - whichever comes first.
virtual override MamaStatus.mamaStatus DestroyNativePeer()
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. MamaWrapper.DestroyNativePeer
Return: MAMA Status code
Reimplements: Wombat::MamaWrapper::DestroyNativePeer
Updated on 2023-03-31 at 15:29:32 +0100