public void Subscribe(MQSubscriptionDescriptor subscriptionDescriptor, int subqueueHandle = MQC.MQHO_NONE) { int compCode, reason; byte[] array = new byte[subscriptionDescriptor.GetRequiredBufferSize()]; subscriptionDescriptor.WriteStruct(array, 0); objectHandle = subqueueHandle; IntPtr intPtr = Marshal.AllocCoTaskMem(array.Length); try { Marshal.Copy(array, 0, intPtr, array.Length); Bindings.MQSUB(qMgr.Handle, intPtr, ref objectHandle, out subscriptionHandle, out compCode, out reason); } finally { if (intPtr != IntPtr.Zero) { Marshal.FreeCoTaskMem(intPtr); } } if (compCode != MQC.MQCC_OK) { throw new MQException(compCode, reason); } _subQueue = new MQQueue(qMgr); _subQueue.objectHandle = objectHandle; }
private void ClearInvalidFields(int Version) { switch (Version) { case 0: this.mqPMO.StrucId = new byte[4]; this.mqPMO.StrucId[0] = 80; this.mqPMO.StrucId[1] = 77; this.mqPMO.StrucId[2] = 79; this.mqPMO.StrucId[3] = 32; this.mqPMO.Options = 0; this.mqPMO.Timeout = -1; this.mqPMO.Context = 0; this.mqPMO.KnownDestCount = 0; this.mqPMO.UnknownDestCount = 0; this.mqPMO.InvalidDestCount = 0; this.mqPMO.ResolvedQName = new byte[48]; this.mqPMO.ResolvedQMgrName = new byte[48]; break; case 1: break; case 2: goto IL_147; default: goto IL_17A; } this.mqPMO.RecsPresent = 0; this.mqPMO.PutMsgRecFields = 0; this.mqPMO.PutMsgRecOffset = 0; this.mqPMO.ResponseRecOffset = 0; this.mqPMO.PutMsgRecPtr = IntPtr.Zero; this.mqPMO.ResponseRecPtr = IntPtr.Zero; this.queueContextReference = null; IL_147: this.mqPMO.OriginalMsgHandle = 0L; this.mqPMO.NewMsgHandle = 0L; this.mqPMO.Action = 0; this.mqPMO.PubLevel = 9; IL_17A: if (Version == 0) { this.mqPMO.Version = 1; } }