本文整理汇总了C#中Microsoft.WindowsAzure.CloudStorageAccount.CreateCloudQueueClient方法的典型用法代码示例。如果您正苦于以下问题:C# CloudStorageAccount.CreateCloudQueueClient方法的具体用法?C# CloudStorageAccount.CreateCloudQueueClient怎么用?C# CloudStorageAccount.CreateCloudQueueClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.CloudStorageAccount
的用法示例。
在下文中一共展示了CloudStorageAccount.CreateCloudQueueClient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStart
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 100;
//Initialize Indexer
storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("CrawlerStorage"));
//Initialize URL Queue
urlQueueClient = storageAccount.CreateCloudQueueClient();
urlQueue = urlQueueClient.GetQueueReference("urlqueue");
if (urlQueue.CreateIfNotExist())
{
//Add first URL to the queue
CloudQueueMessage firstURL = new CloudQueueMessage(startURL);
urlQueue.AddMessage(firstURL);
}
//Initialize Index Queue
indexQueueClient = storageAccount.CreateCloudQueueClient();
indexQueue = indexQueueClient.GetQueueReference("indexqueue");
indexQueue.CreateIfNotExist();
//Initialize Database Blob
databaseClient = storageAccount.CreateCloudBlobClient();
databaseContainer = databaseClient.GetContainerReference("wordfrequencies");
databaseContainer.CreateIfNotExist();
var permission = databaseContainer.GetPermissions();
permission.PublicAccess = BlobContainerPublicAccessType.Container;
databaseContainer.SetPermissions(permission);
return base.OnStart();
}
示例2: QueueHelper
// Constructor - get settings from a hosted service configuration or .NET configuration file.
public QueueHelper(string configurationSettingName, bool hostedService)
{
if (hostedService)
{
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSettingPublisher) =>
{
var connectionString = RoleEnvironment.GetConfigurationSettingValue(configName);
configSettingPublisher(connectionString);
}
);
}
else
{
CloudStorageAccount.SetConfigurationSettingPublisher(
(configName, configSettingPublisher) =>
{
var connectionString = ConfigurationManager.ConnectionStrings[configName].ConnectionString;
configSettingPublisher(connectionString);
}
);
}
Account = CloudStorageAccount.FromConfigurationSetting(configurationSettingName);
QueueClient = Account.CreateCloudQueueClient();
QueueClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);
}
示例3: QueueHelper
// Constructor - get settings from a hosted service configuration
/// <summary>
/// Initializes a new instance of the <see cref="QueueHelper"/> class.
/// </summary>
/// <param name="configurationSettingName">Name of the configuration setting.</param>
/// <remarks></remarks>
public QueueHelper(string configurationSettingName)
{
var connectString = CloudConfigurationManager.GetSetting(configurationSettingName);
_storageAccount = CloudStorageAccount.Parse(connectString);
_queueClient = _storageAccount.CreateCloudQueueClient();
_queueClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.FromSeconds(1));
}
示例4: OnStart
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
#if DEBUG
account = CloudStorageAccount.DevelopmentStorageAccount;
#else
account = new CloudStorageAccount(accountAndKey, true);
#endif
tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);
//client = new CloudQueueClient(account.BlobEndpoint.ToString(), account.Credentials);
qclient = account.CreateCloudQueueClient();
q = qclient.GetQueueReference("icd9mapplotrequests");
rows = new List<ICD9MapPlotResultEntry>();
bclient = account.CreateCloudBlobClient();
container = bclient.GetContainerReference("results");
container.CreateIfNotExist();
client = account.CreateCloudTableClient();
client.CreateTableIfNotExist("ICD9MapPlotResult");
client.CreateTableIfNotExist("DoctorDetails");
client.CreateTableIfNotExist("PatientDetails");
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
return base.OnStart();
}
示例5: InitializeCloudStorage
public static void InitializeCloudStorage(CloudStorageAccount account)
{
CloudTableClient cloudTableClient = account.CreateCloudTableClient();
CloudQueueClient cloudQueueClient = account.CreateCloudQueueClient();
CreateUserPrivilegeTable(cloudTableClient);
}
示例6: ProcessingQueue
public ProcessingQueue()
{
_formatter = new BinaryFormatter();
storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
queueClient = storageAccount.CreateCloudQueueClient();
queue = queueClient.GetQueueReference(TableName);
queue.CreateIfNotExist();
}
示例7: ProcessingQueue
public ProcessingQueue()
{
_formatter = new BinaryFormatter();
storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
queueClient = storageAccount.CreateCloudQueueClient();
queue = queueClient.GetQueueReference(TableName);
queue.CreateIfNotExist();
}
示例8: SingleDeliveryQueueClient
public SingleDeliveryQueueClient(CloudStorageAccount account, string queueName)
{
var queueClient = account.CreateCloudQueueClient();
queue = queueClient.GetQueueReference(queueName);
queue.CreateIfNotExist();
tableClient = account.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(TableName);
}
示例9: Initialize
public static void Initialize(string account, string key)
{
Uri blobUri = new Uri(string.Format("http://{0}.blob.core.windows.net", account));
Uri queueUri = new Uri(string.Format("http://{0}.queue.core.windows.net", account));
Uri tableUri = new Uri(string.Format("http://{0}.table.core.windows.net", account));
s_credentials = new StorageCredentialsAccountAndKey(account, key);
s_storageAccount = new CloudStorageAccount(s_credentials, blobUri, queueUri, tableUri);
s_blobClient = s_storageAccount.CreateCloudBlobClient();
s_tableClient = s_storageAccount.CreateCloudTableClient();
s_queueClient = s_storageAccount.CreateCloudQueueClient();
}
示例10: AzureQueueProvider
public AzureQueueProvider()
{
//var accountAndKey = new StorageCredentialsAccountAndKey("cloudmorph", "Q7Vco66yV3hncM/piawqSHyiXZZ8meZdRMAMElOorgE/EHv4t8B18Nn7zUF/7nLu6WSMaZzmjaUo4LUHlWCfyw==");
//var _storageAccount = new CloudStorageAccount(accountAndKey, true);
// Retrieve storage account from connection-string
//_storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
//_storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=http;AccountName=bmaigorcloudmorphstorage;AccountKey=Q7Vco66yV3hncM/piawqSHyiXZZ8meZdRMAMElOorgE/EHv4t8B18Nn7zUF/7nLu6WSMaZzmjaUo4LUHlWCfyw==");
_storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the queue client
_client = _storageAccount.CreateCloudQueueClient();
}
示例11: AzureMessageQueue
public AzureMessageQueue(CloudStorageAccount cloudStorageAccount, string inputQueueName, string errorQueueName)
{
if (inputQueueName == null) throw new ArgumentNullException("inputQueueName");
if (errorQueueName == null) throw new ArgumentNullException("errorQueueName");
inputQueueName = inputQueueName.ToLowerInvariant();
errorQueueName = errorQueueName.ToLowerInvariant();
cloudQueueClient = cloudStorageAccount.CreateCloudQueueClient();
inputQueue = cloudQueueClient.GetQueueReference(inputQueueName);
inputQueue.CreateIfNotExist();
cloudQueueClient.GetQueueReference(errorQueueName).CreateIfNotExist();
this.inputQueueName = inputQueueName;
this.errorQueueName = errorQueueName;
}
示例12: InitializeAzureStorage
/// <summary>
///
/// </summary>
/// <param name="storageAccountName"></param>
private void InitializeAzureStorage(AzureStorageOptions options)
{
Debug.Assert(null != options);
// TODO: put in the logic to appropriately load configuration
bool useRoleEnvironment = false;
string storageConnectionStringValue = null;
if (useRoleEnvironment)
{
storageConnectionStringValue = RoleEnvironment.GetConfigurationSettingValue(options.StorageAccountName);
}
else
{
storageConnectionStringValue = ConfigurationManager.ConnectionStrings[options.StorageAccountName].ConnectionString;
}
Debug.Assert(null != storageConnectionStringValue);
Account = CloudStorageAccount.Parse(storageConnectionStringValue);
// This will not work unless run in the DevFabric or in Azure
// Trace.WriteLine("Azure account credentials:" + Account.Credentials.ToString(), "Information");
TableClient = Account.CreateCloudTableClient();
TableClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);
TableServiceContext = TableClient.GetDataServiceContext();
BlobClient = Account.CreateCloudBlobClient();
BlobClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);
QueueClient = Account.CreateCloudQueueClient();
QueueClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);
}
示例13: AzureDocumentExecutor
public AzureDocumentExecutor(CloudStorageAccount account)
{
var client = account.CreateCloudQueueClient();
queue = client.GetQueueReference("documents");
queue.CreateIfNotExist();
}
示例14: InitializeStorageResources
private static void InitializeStorageResources(CloudStorageAccount storageAccount)
{
var blobStorage = storageAccount.CreateCloudBlobClient();
LogWorker.LogBlobContainer = blobStorage.GetContainerReference("logitems");
CommandWorker.CommandBlobContainer = blobStorage.GetContainerReference("commands");
var queueStorage = storageAccount.CreateCloudQueueClient();
LogWorker.LogQueue = queueStorage.GetQueueReference("logmessages");
CommandWorker.CommandQueue = queueStorage.GetQueueReference("commandmessages");
bool isStorageFinalized = false;
while (!isStorageFinalized)
{
try
{
LogWorker.LogBlobContainer.CreateIfNotExist();
LogWorker.LogQueue.CreateIfNotExist();
CommandWorker.CommandBlobContainer.CreateIfNotExist();
CommandWorker.CommandQueue.CreateIfNotExist();
isStorageFinalized = true;
}
catch (StorageClientException sce)
{
if (sce.ErrorCode == StorageErrorCode.TransportError)
{
Trace.TraceError("Storage services initialization failure. " +
"Check your storage account configuration settings. " +
"If running locally, ensure that the Development Storage service is running. " +
"Message: '{0}'", sce.Message);
}
else
{
throw sce;
}
}
}
}
示例15: QueueUtilities
public QueueUtilities(string connectionString)
{
_account = CloudStorageAccount.Parse(connectionString);
_client = _account.CreateCloudQueueClient();
}