Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / MsmqMessageProperty.cs / 1 / MsmqMessageProperty.cs
//---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------------------- namespace System.ServiceModel.Channels { public sealed class MsmqMessageProperty { public const string Name = "MsmqMessageProperty"; int abortCount; int moveCount; long lookupId; string messageId; int acknowledge; internal MsmqMessageProperty(MsmqInputMessage msmqMessage) { if (null == msmqMessage) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("msmqMessage"); this.lookupId = msmqMessage.LookupId.Value; if (msmqMessage.AbortCount != null) this.abortCount = msmqMessage.AbortCount.Value; if (msmqMessage.MoveCount != null) this.moveCount = msmqMessage.MoveCount.Value; this.acknowledge = (int)(ushort)msmqMessage.Class.Value; this.messageId = MsmqMessageId.ToString(msmqMessage.MessageId.Buffer); } public DeliveryFailure? DeliveryFailure { get { return TryGetDeliveryFailure(this.messageId, this.acknowledge); } } public DeliveryStatus? DeliveryStatus { get { DeliveryFailure? deliveryFailure = this.DeliveryFailure; if (!deliveryFailure.HasValue) return null; if (System.ServiceModel.Channels.DeliveryFailure.ReachQueueTimeout == deliveryFailure.Value || System.ServiceModel.Channels.DeliveryFailure.Unknown == deliveryFailure.Value) return System.ServiceModel.Channels.DeliveryStatus.InDoubt; else return System.ServiceModel.Channels.DeliveryStatus.NotDelivered; } } public int AbortCount { get { return this.abortCount; } internal set { this.abortCount = value; } } internal long LookupId { get { return this.lookupId; } } internal string MessageId { get { return this.messageId; } } public int MoveCount { get { return this.moveCount; } internal set { this.moveCount = value; } } public static MsmqMessageProperty Get(Message message) { if (null == message) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); if (null == message.Properties) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message.Properties"); return message.Properties[Name] as MsmqMessageProperty; } static DeliveryFailure? TryGetDeliveryFailure(string messageId, int acknowledgment) { // DeliveryFailure definintion explains these bit manipulations int bit15 = (1 << 15) & acknowledgment; if (0 == bit15) return null; int bit14 = (1 << 14) & acknowledgment; int otherBits = ~((1 << 15) | (1 << 14)) & acknowledgment; if ((0 == bit14 && otherBits >= 0 && otherBits <= 0x0A) || (0 != bit14 && otherBits >= 0 && otherBits <= 0x02)) return (DeliveryFailure)acknowledgment; else { MsmqDiagnostics.UnexpectedAcknowledgment(messageId, acknowledgment); return System.ServiceModel.Channels.DeliveryFailure.Unknown; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GridViewCancelEditEventArgs.cs
- MD5.cs
- DesignerSerializerAttribute.cs
- ConfigPathUtility.cs
- DoubleConverter.cs
- TemplateColumn.cs
- FileChangeNotifier.cs
- ListViewInsertedEventArgs.cs
- XmlCodeExporter.cs
- XslAst.cs
- DataTableReaderListener.cs
- CheckBox.cs
- ValidatorCollection.cs
- WebPartHeaderCloseVerb.cs
- TextDecorations.cs
- EventInfo.cs
- WebService.cs
- ColorConverter.cs
- PreProcessor.cs
- ConnectivityStatus.cs
- CompositeFontParser.cs
- OnOperation.cs
- WindowsRichEditRange.cs
- QueryResponse.cs
- DataListItem.cs
- XamlSerializerUtil.cs
- MarkerProperties.cs
- ExceptionHandlers.cs
- EDesignUtil.cs
- DataGridViewElement.cs
- ProjectionCamera.cs
- ColumnResult.cs
- SectionVisual.cs
- ReaderWriterLockWrapper.cs
- FrameworkElement.cs
- FileRecordSequence.cs
- COM2PropertyPageUITypeConverter.cs
- SR.cs
- QuaternionAnimationUsingKeyFrames.cs
- OleAutBinder.cs
- EasingQuaternionKeyFrame.cs
- AuthenticationSection.cs
- DataGridViewControlCollection.cs
- Accessible.cs
- Imaging.cs
- WebPartEditorOkVerb.cs
- NetworkAddressChange.cs
- CallbackDebugBehavior.cs
- NativeMethods.cs
- DataGridViewCell.cs
- BooleanAnimationUsingKeyFrames.cs
- TextWriter.cs
- XmlExpressionDumper.cs
- WindowHideOrCloseTracker.cs
- SimpleMailWebEventProvider.cs
- SerializationFieldInfo.cs
- FlowNode.cs
- PrintDialogDesigner.cs
- PathTooLongException.cs
- WebPartDescription.cs
- IntegerValidator.cs
- EntityKey.cs
- StoreItemCollection.cs
- ObjectReferenceStack.cs
- PreviewKeyDownEventArgs.cs
- StylusPointProperty.cs
- SafeNativeMethods.cs
- XmlSchemaAll.cs
- DataControlExtensions.cs
- LinearQuaternionKeyFrame.cs
- LinearKeyFrames.cs
- codemethodreferenceexpression.cs
- InlineCategoriesDocument.cs
- RewritingPass.cs
- CurrencyManager.cs
- ZoneLinkButton.cs
- mediaeventargs.cs
- WebHttpBindingElement.cs
- NonBatchDirectoryCompiler.cs
- odbcmetadatafactory.cs
- AutoSizeToolBoxItem.cs
- DispatcherExceptionFilterEventArgs.cs
- TargetException.cs
- OleDbRowUpdatingEvent.cs
- SafeUserTokenHandle.cs
- LocalFileSettingsProvider.cs
- ViewGenerator.cs
- InternalSendMessage.cs
- UTF32Encoding.cs
- ToolStripItemImageRenderEventArgs.cs
- ProcessModelInfo.cs
- ComponentChangingEvent.cs
- ProxyGenerator.cs
- HtmlFormParameterReader.cs
- XmlTextEncoder.cs
- PipeStream.cs
- EntityDataSourceWrapper.cs
- OracleCommandBuilder.cs
- XPathDocumentBuilder.cs
- URLMembershipCondition.cs