/** * <summary> * Closes a queue which was previously opened. * </summary> * * <param name="handle"> Reference to the previously opened queue</param> * * <returns><c>ErrorCode.EC_NOERROR</c> on success otherwise errors such as these, but * not limited to could be produced: * * <table border="0" cellpadding="3" cellspacing="0"> * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td> * <td>A networking error has occurred and the conneciton * is nolonger valid. * </td></tr> * <tr><td><c>ErrorCode.EC_NOTOPEN</c></td> * <td>The queue was not currently input an open status input the * context of this connection. * </td></tr> * </table> * </returns> */ public ErrorCode CloseQueue(QueueHandle handle) { ErrorCode ret = ErrorCode.EC_NOERROR; QUEUE_CLOSE_OPEN_CURSOR_PARAMS parms = new QUEUE_CLOSE_OPEN_CURSOR_PARAMS(); parms.queueID = handle; try { output.Write(Safmq.CMD_QUEUE_CLOSE); parms.Write(output); output.Flush(); ret = getResponseCode(); } catch (Exception ) { ret = ErrorCode.EC_NETWORKERROR; } return ret; }
/** * <summary> * Opens a cursor for sequential reading of the queue. The newly opened * cursor points to the oldest, highest priority message in the queue. * </summary> * * <remarks> * <para>Cursors may be used to violate the priority FIFO nature of the queue * by scanning the queue and only retreiving messages which meet the * criteria of the reader. Cursor access is sequential when used in conjunction * with <c>AdvanceCursor(CursorHandle)</c>, however specific messages may * be sought out by a call to <c>SeekID(UUID,int,CursorHandle)</c>. </para> * </remarks> * * <param name="qhandle"> A handle to a queue previously opened by a call to OpenQueue(string)</param> * <param name="cursorID"> A previously allocated reference to a <c>CursorHandle</c> * which will receive the reference to the cursor.</param> * <returns><c>ErrorCode.EC_NOERROR</c> upon success, otherwise errors returned * could be but are not limited to:<br/> * <table border="0" cellpadding="3" cellspacing="0"> * <tr><td><c>ErrorCode.EC_NETWORKERROR</c></td> * <td>A networking error has occurred and the conneciton * is nolonger valid. * </td></tr> * <tr><td><c>ErrorCode.EC_NOTAUTHORIZED</c></td> * <td>The user is not authorized to Read messages from this * queue. * </td></tr> * <tr><td><c>ErrorCode.EC_NOTOPEN</c></td> * <td>The queue specified has not been opened by this connection. * </td></tr> * </table> * </returns> * * <seealso cref="OpenQueue(string, QueueHandle)"/> */ public ErrorCode OpenCursor(QueueHandle qhandle, CursorHandle cursorID) { ErrorCode ret = ErrorCode.EC_NOERROR; QUEUE_CLOSE_OPEN_CURSOR_PARAMS parms = new QUEUE_CLOSE_OPEN_CURSOR_PARAMS(); parms.queueID = qhandle; try { output.Write(Safmq.CMD_OPEN_CURSOR); parms.Write(output); output.Flush(); ret = getResponseCode(); if (ret == ErrorCode.EC_NOERROR) { cursorID.handle = input.ReadInt32(); } } catch (Exception) { ret = ErrorCode.EC_NETWORKERROR; } return ret; }