public ListeningConnection(QueueSubscription queueSubscription, ISubscriptionConfig config, QueueSubscriptionCache subscriptionCache) { _queueSubscription = queueSubscription; _config = config; _subscriptionCache = subscriptionCache; Logger = new RabbitMqConsoleLogger(); }
Task Declare(ClientContext context, QueueSubscription subscription) { if (_log.IsDebugEnabled) { _log.DebugFormat("Binding topic ({0}) to queue ({1})", subscription.Source, subscription.Destination); } return(context.CreateQueueSubscription(subscription.Source.EntityName, subscription.Destination.EntityName)); }
Task Delete(NamespaceContext context, QueueSubscription subscription) { if (_log.IsDebugEnabled) { _log.DebugFormat("Create Queue Subscription ({0})", subscription); } return(context.DeleteTopicSubscription(subscription.Subscription.SubscriptionDescription)); }
Task Create(NamespaceContext context, QueueSubscription subscription) { if (_log.IsDebugEnabled) { _log.DebugFormat("Create Queue Subscription ({0})", subscription); } // TODO we need to deal with scopes better to make this more realistic var queuePath = $"{context.NamespaceManager.Address.AbsolutePath.TrimStart('/')}{subscription.Destination.QueueDescription.Path}"; subscription.Subscription.SubscriptionDescription.ForwardTo = queuePath; return(context.CreateTopicSubscription(subscription.Subscription.SubscriptionDescription)); }
public Task <object> SubscribeAsync(QueueSubscription subscription) { var taskCompletionSource = new TaskCompletionSource <object>(); Task.Run(() => { Task.Delay(OpenTimeout).Wait(); subscription.OpenEvent.Set(); while (subscription.KeepListening) { Task.Delay(ProcessingInterval).Wait(); } taskCompletionSource.SetResult(null); }); return(taskCompletionSource.Task); }
public void CreateSubscription(RabbitEndpoint definition, bool start) { if (Subscriptions.HasSubscription(definition.QueueName)) { return; } var queueSubscription = new QueueSubscription(ProxyFactory, Dispatcher, definition); queueSubscription.Name = definition.QueueName; if (start) { Subscriptions.AddAndStartSubscription(queueSubscription); } else { Subscriptions.AddSubscription(queueSubscription); } }
public async Task <QueueSubscribeResult> SubscribeAsync <T>( Func <T, QueueMessageContext, Task <bool> > callback) where T : class { await StartAsync(); var options = GetOptions <T>(); var result = await DoSubscribeAsync(options); if (result.IsSuccess) { var subscription = new QueueSubscription <T>(async(message, context) => await callback(message, context)); _subscriptions[subscription.Id] = subscription; result.SubscriptionId = subscription.Id; result.Options = options; } return(result); }
Task Create(NamespaceContext context, QueueSubscription subscription) { return(context.CreateTopicSubscription(subscription.Subscription.SubscriptionDescription, subscription.Subscription.Rule, subscription.Subscription.Filter)); }
Task Delete(NamespaceContext context, QueueSubscription subscription) { return(context.DeleteTopicSubscription(subscription.Subscription.SubscriptionDescription)); }
Task Delete(ConnectionContext context, QueueSubscription subscription) { return(context.DeleteTopicSubscription(subscription.Subscription.SubscriptionDescription)); }
Task Declare(ClientContext context, QueueSubscription subscription) { LogContext.Debug?.Log("Binding topic {Topic} to {Queue}", subscription.Source, subscription.Destination); return(context.CreateQueueSubscription(subscription.Source, subscription.Destination)); }
protected OpenConnection(QueueSubscription queueSubscription) { _queueSubscription = queueSubscription; }