public CloseAsyncResult(SendAvailabilityMessagePump pump, TimeSpan timespan, AsyncCallback callback, object state) : base(timespan, callback, state) { this.pump = pump; this.pump.Closed = true; SendAvailabilityMessagePump.CloseAsyncResult closeAsyncResult = this; closeAsyncResult.OnCompleting = (Action <AsyncResult, Exception>)Delegate.Combine(closeAsyncResult.OnCompleting, new Action <AsyncResult, Exception>(SendAvailabilityMessagePump.CloseAsyncResult.OnFinally)); base.Start(); }
public SendAsyncResult(MessageSender sender, BrokeredMessage message, SendAvailabilityMessagePump pump, TimeSpan timespan, AsyncCallback callback, object state) : base(timespan, callback, state) { this.messageSender = sender; this.message = message; this.pump = pump; this.sequenceNumber = message.SequenceNumber; SendAvailabilityMessagePump.SendAsyncResult sendAsyncResult = this; sendAsyncResult.OnCompleting = (Action <AsyncResult, Exception>)Delegate.Combine(sendAsyncResult.OnCompleting, new Action <AsyncResult, Exception>(this.OnFinally)); base.Start(); }
private static void FaultingClose(object state) { Tuple <MessagingFactory, MessagingFactory, SendAvailabilityMessagePump> tuple = (Tuple <MessagingFactory, MessagingFactory, SendAvailabilityMessagePump>)state; MessagingFactory item1 = tuple.Item1; MessagingFactory item2 = tuple.Item2; SendAvailabilityMessagePump item3 = tuple.Item3; if (item1.IsOpened) { Exception pairedMessagingFactoryException = new PairedMessagingFactoryException(SRClient.FaultingPairedMessagingFactory(item1.Address.ToString(), item2.Address.ToString())); item1.Fault(pairedMessagingFactoryException); } if (!item3.Closed) { item3.Close(); } }
public ProcessQueueAsyncResult(SendAvailabilityMessagePump pump, int index, TimeSpan timespan, AsyncCallback callback, object state) : base(timespan, callback, state) { this.pump = pump; SendAvailabilityMessagePump.ProcessQueueAsyncResult processQueueAsyncResult = this; processQueueAsyncResult.OnCompleting = (Action <AsyncResult, Exception>)Delegate.Combine(processQueueAsyncResult.OnCompleting, new Action <AsyncResult, Exception>(this.OnFinally)); if (!this.pump.CanPump()) { base.Complete(true); return; } string str = this.pump.options.FetchBacklogQueueName(index); this.messageReceiver = this.pump.options.SecondaryMessagingFactory.CreateMessageReceiver(str); this.messageReceiver.PrefetchCount = 100; this.messageReceiver.RetryPolicy = this.pump.options.SecondaryMessagingFactory.RetryPolicy; this.messageReceiver.ShouldLinkRetryPolicy = true; base.Start(); }
public SendAvailabilityMessagePump(SendAvailabilityPairedNamespaceOptions options) { if (options == null) { throw Fx.Exception.AsError(new ArgumentNullException("options"), null); } if (options.PrimaryMessagingFactory == null) { throw Fx.Exception.AsError(new ArgumentNullException("options.PrimaryMessagingFactory"), null); } if (options.SecondaryMessagingFactory == null) { throw Fx.Exception.AsError(new ArgumentNullException("options.MessagingFactory"), null); } this.options = options; this.InstanceTrackingContext = TrackingContext.GetInstance(Guid.NewGuid(), this.options.SbNamespace); this.SyphonId = SendAvailabilityMessagePump.NextSyphonId(); this.timers = new IOThreadTimer[this.options.BacklogQueueCount]; this.queuesInProcess = new IAsyncResult[this.options.BacklogQueueCount]; }