public void SubmitMessage_Queue(byte[] message, DateTime time) { MsmqMessageProperty mqProp = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name] as MsmqMessageProperty; // resend the message if timed out if (mqProp.DeliveryFailure == DeliveryFailure.ReachQueueTimeout || mqProp.DeliveryFailure == DeliveryFailure.ReceiveTimeout) { // re-send //Console.WriteLine("Purchase order Time To Live expired"); //Console.WriteLine("Trying to resend the message"); // reuse the same transaction used to read the message from dlq to enqueue the message to app. queue //_SystemEvent.SubmitMessage_Queue(message,time); } if (mqProp.DeliveryStatus == DeliveryStatus.InDoubt || mqProp.DeliveryFailure == DeliveryFailure.Unknown) { NotifyAdmin(); } }
public void SubmitPurchaseOrder(PurchaseOrder po) { Console.WriteLine("Submitting purchase order did not succeed ", po); MsmqMessageProperty mqProp = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name] as MsmqMessageProperty; Console.WriteLine("Message Delivery Status: {0} ", mqProp.DeliveryStatus); Console.WriteLine("Message Delivery Failure: {0}", mqProp.DeliveryFailure); Console.WriteLine(); // Resend the message if timed out. if (mqProp.DeliveryFailure == DeliveryFailure.ReachQueueTimeout || mqProp.DeliveryFailure == DeliveryFailure.ReceiveTimeout) { // Re-send. Console.WriteLine("Purchase order Time To Live expired"); Console.WriteLine("Trying to resend the message"); // Reuse the same transaction used to read the message from dlq to enqueue the message to the application queue. orderProcessorService.SubmitPurchaseOrder(po); Console.WriteLine("Purchase order resent"); } }
public void SubmitPurchaseOrder(PurchaseOrder po) { // <Snippet1> MsmqMessageProperty mqProp = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name] as MsmqMessageProperty; Console.WriteLine("Abort count: {0} ", mqProp.AbortCount); Console.WriteLine("Move count: {0} ", mqProp.MoveCount); // code to submit purchase order ... // </Snippet1> int randomNumber = r.Next(10); if (randomNumber % 2 == 0) { Orders.Add(po); Console.WriteLine("Processing {0} ", po); } else { Console.WriteLine("Aborting transaction, cannot process purchase order: " + po.PONumber); Console.WriteLine(); throw new Exception("Cannot process purchase order: " + po.PONumber); } }
public void Publish(int publicationTaskID) { Console.WriteLine(DateTime.Now.ToLongTimeString() + " DLQ: " + publicationTaskID.ToString()); MsmqMessageProperty mqProp = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name] as MsmqMessageProperty; Console.WriteLine(DateTime.Now.ToLongTimeString() + " Message Delivery Status: {0} ", mqProp.DeliveryStatus); Console.WriteLine(DateTime.Now.ToLongTimeString() + " Message Delivery Failure: {0}", mqProp.DeliveryFailure); // Resend the message if timed out. if (mqProp.DeliveryFailure == DeliveryFailure.ReachQueueTimeout || mqProp.DeliveryFailure == DeliveryFailure.ReceiveTimeout) { // Compensating behaviour. Console.WriteLine(DateTime.Now.ToLongTimeString() + " Time To Live expired"); Console.WriteLine(DateTime.Now.ToLongTimeString() + " Log the message failure"); // You can reuse the same transaction used to read the message from dlq to enqueue the message to the application queue. // This is exactly the same as what the client code does, // just call the service again with the publicationTaskID parameter: Console.WriteLine(DateTime.Now.ToLongTimeString() + " Perform compensating behaviour: " + publicationTaskID.ToString()); } }
protected override Message DecodeMsmqMessage(MsmqInputMessage msmqMessage, MsmqMessageProperty messageProperty) { MsmqInputChannelListener listener = this.Manager as MsmqInputChannelListener; return MsmqDecodeHelper.DecodeTransportDatagram(listener, this.MsmqReceiveHelper, msmqMessage, messageProperty); }
protected override Message DecodeMsmqMessage(MsmqInputMessage msmqMessage, MsmqMessageProperty messageProperty) { MsmqInputChannelListener listener = this.Manager as MsmqInputChannelListener; return(MsmqDecodeHelper.DecodeTransportDatagram(listener, this.MsmqReceiveHelper, msmqMessage, messageProperty)); }
protected override Message DecodeMsmqMessage(MsmqInputMessage msmqMessage, MsmqMessageProperty property) { MsmqIntegrationChannelListener manager = base.Manager as MsmqIntegrationChannelListener; return(MsmqDecodeHelper.DecodeIntegrationDatagram(manager, base.MsmqReceiveHelper, msmqMessage as MsmqIntegrationInputMessage, property)); }
public void FinalDisposition(MsmqMessageProperty messageProperty) { this.receiver.DropOrRejectReceivedMessage(messageProperty, false); }
public bool CheckAndHandlePoisonMessage(MsmqMessageProperty messageProperty) { return false; }
public bool CheckAndHandlePoisonMessage(MsmqMessageProperty messageProperty) { return(false); }