本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.CloudQueue.CreateIfNotExists方法的典型用法代码示例。如果您正苦于以下问题:C# CloudQueue.CreateIfNotExists方法的具体用法?C# CloudQueue.CreateIfNotExists怎么用?C# CloudQueue.CreateIfNotExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Queue.CloudQueue
的用法示例。
在下文中一共展示了CloudQueue.CreateIfNotExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStart
public override bool OnStart()
{
ServicePointManager.DefaultConnectionLimit = Environment.ProcessorCount;
// Read storage account configuration settings
ConfigureDiagnostics();
Trace.TraceInformation("Initializing storage account in worker role B");
var storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
// Initialize queue storage
Trace.TraceInformation("Creating queue client.");
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
sendEmailQueue = queueClient.GetQueueReference("azuremailqueue");
subscribeQueue = queueClient.GetQueueReference("azuremailsubscribequeue");
// Initialize blob storage
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
blobContainer = blobClient.GetContainerReference("azuremailblobcontainer");
// Initialize table storage
var tableClient = storageAccount.CreateCloudTableClient();
mailingListTable = tableClient.GetTableReference("mailinglist");
messageTable = tableClient.GetTableReference("message");
messagearchiveTable = tableClient.GetTableReference("messagearchive");
Trace.TraceInformation("WorkerB: Creating blob container, queue, tables, if they don't exist.");
blobContainer.CreateIfNotExists();
sendEmailQueue.CreateIfNotExists();
subscribeQueue.CreateIfNotExists();
this.messageTable.CreateIfNotExists();
this.mailingListTable.CreateIfNotExists();
this.messagearchiveTable.CreateIfNotExists();
return base.OnStart();
}
示例2: OnStart
public override bool OnStart()
{
ServicePointManager.DefaultConnectionLimit = Environment.ProcessorCount;
ConfigureDiagnostics();
// Read storage account configuration settings
Trace.TraceInformation("Initializing storage account in WorkerC");
var storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(
"StorageConnectionString"
));
// Initialize queue storage
Trace.TraceInformation("Creating queue client in WorkerC");
var queueClient = storageAccount.CreateCloudQueueClient();
subscribeQueue = queueClient.GetQueueReference("subscribequeue");
// Initialize table storage
Trace.TraceInformation("Creating table client in WorkerC");
var tableClient = storageAccount.CreateCloudTableClient();
subscribersTable = tableClient.GetTableReference("Subscribers");
Trace.TraceInformation("WorkerC: Creating blob container, queue, tables, if they don't exist.");
subscribeQueue.CreateIfNotExists();
subscribersTable.CreateIfNotExists();
return base.OnStart();
}
示例3: InitQueue
private void InitQueue()
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
queue = queueClient.GetQueueReference("jobqueue");
queue.CreateIfNotExists();
}
示例4: Setup
public void Setup()
{
client = CloudStorageAccount.DevelopmentStorageAccount.CreateCloudQueueClient();
client.ServerTimeout = TimeSpan.FromSeconds(10);
nativeQueue = client.GetQueueReference(QueueName);
nativeQueue.CreateIfNotExists();
nativeQueue.Clear();
sender = new AzureMessageQueueSender
{
Client = client,
MessageSerializer = new JsonMessageSerializer(new MessageMapper())
};
sender.Init(QueueName, true);
receiver = new AzureMessageQueueReceiver
{
Client = client,
MessageSerializer = new JsonMessageSerializer(new MessageMapper()),
};
receiver.Init(QueueName, true);
}
示例5: Crawler
public Crawler()
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
table = tableClient.GetTableReference("crawlertable");
table.CreateIfNotExists();
datatable = tableClient.GetTableReference("datatable");
datatable.CreateIfNotExists();
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
urlQueue = queueClient.GetQueueReference("urlqueue");
urlQueue.CreateIfNotExists();
adminQueue = queueClient.GetQueueReference("adminqueue");
adminQueue.CreateIfNotExists();
alreadyVisitedUrls = new HashSet<String>();
disallowedUrls = new HashSet<String>();
errorUrls = new HashSet<String>();
tableSize = 0;
totalUrls = 0;
counter = 1;
compareDate = DateTime.ParseExact("2015-04-01", "yyyy-MM-dd", CultureInfo.InvariantCulture);
//Regex to check for valid html document
rgx = new Regex(@"^[a-zA-Z0-9\-]+.?(htm|html)?$");
}
示例6: OnStart
public override bool OnStart()
{
// Set the maximum number of concurrent connections.
ServicePointManager.DefaultConnectionLimit = 12;
// Read database connection string and open database.
var dbConnString = CloudConfigurationManager.GetSetting("TCWAdminPortalDbConnectionString");
_dbContext = new TCWAdminContext(dbConnString);
// Open storage account using credentials from .cscfg file.
var storageAccount = CloudStorageAccount.Parse
(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
Trace.TraceInformation("Creating images blob container");
var blobClient = storageAccount.CreateCloudBlobClient();
_imagesBlobContainer = blobClient.GetContainerReference("images");
if (_imagesBlobContainer.CreateIfNotExists())
{
// Enable public access on the newly created "images" container.
_imagesBlobContainer.SetPermissions(
new BlobContainerPermissions
{
PublicAccess = BlobContainerPublicAccessType.Blob
});
}
Trace.TraceInformation("Creating images queue");
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
_imagesQueue = queueClient.GetQueueReference("images");
_imagesQueue.CreateIfNotExists();
Trace.TraceInformation("Storage initialized");
return base.OnStart();
}
示例7: QueueHelper
public QueueHelper(string storageAccountConnectionString)
: base(storageAccountConnectionString)
{
queueClient = base.StorageAccount.CreateCloudQueueClient();
subscribeQueue = queueClient.GetQueueReference(ConfigurationManager.AppSettings["QueueAzuremailsubscribequeue"]);
subscribeQueue.CreateIfNotExists();
}
示例8: QueueMessageSource
public QueueMessageSource()
{
var account = MakeAccount();
queue = MakeQueue(account);
queue.CreateIfNotExists();
}
示例9: AzureQueue
public AzureQueue()
{
var cloudStorageAccount =
CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(Azure.StorageConnectionString));
var cloudQueueClient= cloudStorageAccount.CreateCloudQueueClient();
_cloudQueue= cloudQueueClient.GetQueueReference(CloudConfigurationManager.GetSetting(Azure.QueueName));
_cloudQueue.CreateIfNotExists();
}
示例10: QueueHelper
public QueueHelper(string connection, string queueName)
{
var account = CloudStorageAccount.Parse(connection);
var retry = new LinearRetry(TimeSpan.FromSeconds(1), 3);
queueClient = account.CreateCloudQueueClient();
queueClient.RetryPolicy = retry;
queue = queueClient.GetQueueReference(queueName);
queue.CreateIfNotExists();
}
示例11: QueueStorageContext
static QueueStorageContext()
{
CloudStorageAccount account = CloudStorageAccount.Parse(
System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
CloudQueueClient queueClient = account.CreateCloudQueueClient();
queue = queueClient.GetQueueReference(DetectionQueueName);
queue.CreateIfNotExists();
}
示例12: QueueInit
private static void QueueInit()
{
const string queueName = "performance-demo";
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["AzureStorageConnectionString"]);
var cloudQueueClient = storageAccount.CreateCloudQueueClient();
_Queue = cloudQueueClient.GetQueueReference(queueName);
_Queue.CreateIfNotExists();
_Watch = Stopwatch.StartNew();
}
示例13: QueueStorageAsync
/// <summary>
/// Constructor
/// </summary>
/// <param name="queueName">The name of the queue to be managed</param>
/// <param name="storageConnectionString">The connection string pointing to the storage account (this can be local or hosted in Windows Azure</param>
public QueueStorageAsync(string queueName, string storageConnectionString)
{
Validate.QueueName(queueName, "queueName");
Validate.String(storageConnectionString, "storageConnectionString");
var cloudStorageAccount = CloudStorageAccount.Parse(storageConnectionString);
var cloudQueueClient = cloudStorageAccount.CreateCloudQueueClient();
cloudQueue = cloudQueueClient.GetQueueReference(queueName);
cloudQueue.CreateIfNotExists();
}
示例14: PickCreator
public PickCreator()
{
_storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
_queueClient = _storageAccount.CreateCloudQueueClient();
_queue = _queueClient.GetQueueReference("scaleoutsamplequeue");
_queue.CreateIfNotExists();
}
示例15: AzureQueueExt
public AzureQueueExt(string conectionString, string queueName, params Type[] types)
{
queueName = queueName.ToLower();
var storageAccount = CloudStorageAccount.Parse(conectionString);
var queueClient = storageAccount.CreateCloudQueueClient();
_queue = queueClient.GetQueueReference(queueName);
_queue.CreateIfNotExists();
RegisterTypes(types);
}