public async Task RegisterSubscriber(string topic, string subscriberAddress)
 {
     try
     {
         var entity = new Entities.AzureStorageSubscription(topic, subscriberAddress);
         var t = GetTable();
         var operationContext = new OperationContext();
         var tableRequestOptions = new TableRequestOptions { RetryPolicy = new ExponentialRetry() };
         var res = await t.ExecuteAsync(TableOperation.InsertOrReplace(entity), tableRequestOptions, operationContext);
     }
     catch (Exception exception)
     {
         throw new RebusApplicationException(exception, $"Could not subscribe {subscriberAddress} to '{topic}'");
     }
 }
Esempio n. 2
0
 public async Task UnregisterSubscriber(string topic, string subscriberAddress)
 {
     try
     {
         var entity = new Entities.AzureStorageSubscription(topic, subscriberAddress)
         {
             ETag = "*"
         };
         var t = GetTable();
         var operationContext = new OperationContext();
         var res = await t.ExecuteAsync(TableOperation.Delete(entity), new TableRequestOptions { RetryPolicy = new ExponentialRetry() }, operationContext);
     }
     catch (Exception exception)
     {
         throw new RebusApplicationException(exception, $"Could not unsubscribe {subscriberAddress} from '{topic}'");
     }
 }
Esempio n. 3
0
 public async Task RegisterSubscriber(string topic, string subscriberAddress)
 {
     try
     {
         var entity              = new Entities.AzureStorageSubscription(topic, subscriberAddress);
         var t                   = GetTable();
         var operationContext    = new OperationContext();
         var tableRequestOptions = new TableRequestOptions {
             RetryPolicy = new ExponentialRetry()
         };
         var res = await t.ExecuteAsync(TableOperation.InsertOrReplace(entity), tableRequestOptions, operationContext);
     }
     catch (Exception exception)
     {
         throw new RebusApplicationException(exception, $"Could not subscribe {subscriberAddress} to '{topic}'");
     }
 }
 public async Task UnregisterSubscriber(string topic, string subscriberAddress)
 {
     try
     {
         var entity = new Entities.AzureStorageSubscription(topic, subscriberAddress) { ETag = "*" };
         var t = GetTable();
         var operationContext = new OperationContext();
         var res = await t.ExecuteAsync(TableOperation.Delete(entity), new TableRequestOptions { RetryPolicy = new ExponentialRetry() }, operationContext);
     }
     catch (Exception exception)
     {
         throw new RebusApplicationException(exception, $"Could not unsubscribe {subscriberAddress} from '{topic}'");
     }
 }