本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient类的典型用法代码示例。如果您正苦于以下问题:C# CloudQueueClient类的具体用法?C# CloudQueueClient怎么用?C# CloudQueueClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudQueueClient类属于Microsoft.WindowsAzure.Storage.Queue命名空间,在下文中一共展示了CloudQueueClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run(string connectionString, bool disableLogging)
{
_connectionString = connectionString;
_storageAccount = CloudStorageAccount.Parse(connectionString);
_queueClient = _storageAccount.CreateCloudQueueClient();
try
{
TimeSpan azureSDKTime = RunAzureSDKTest();
TimeSpan webJobsSDKTime = RunWebJobsSDKTest(disableLogging);
// Convert to ulong because the measurment block does not support other data type
ulong perfRatio = (ulong)((webJobsSDKTime.TotalMilliseconds / azureSDKTime.TotalMilliseconds) * 100);
Console.WriteLine("--- Results ---");
Console.WriteLine("Azure SDK: {0} ms: ", azureSDKTime.TotalMilliseconds);
Console.WriteLine("WebJobs SDK: {0} ms: ", webJobsSDKTime.TotalMilliseconds);
Console.WriteLine("Perf ratio (x100, long): {0}", perfRatio);
MeasurementBlock.Mark(
perfRatio,
(disableLogging ? QueueNoLoggingOverheadMetric : QueueLoggingOverheadMetric) + ";Ratio;Percent");
}
finally
{
Cleanup();
}
}
示例2: BlobManager
public BlobManager(string conStr)
{
//RoleEnvironment.GetConfigurationSettingValue("UploadCon")
Storage = CloudStorageAccount.Parse(conStr);
BlobClient = Storage.CreateCloudBlobClient();
QueueClient = Storage.CreateCloudQueueClient();
}
示例3: Run
public override void Run()
{
Trace.TraceInformation("QueueProcessor_WorkerRole entry point called", "Information");
var queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetQueueSas()));
var queue = queueClient.GetQueueReference("messagequeue");
while (true)
{
Thread.Sleep(10000);
Trace.TraceInformation("Working", "Information");
if (DateTime.UtcNow.AddMinutes(1) >= this.serviceQueueSasExpiryTime)
{
queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetQueueSas()));
queue = queueClient.GetQueueReference("messagequeue");
}
var msg = queue.GetMessage();
if (msg != null)
{
Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
queue.DeleteMessage(msg);
}
}
}
示例4: EndToEndTestFixture
protected EndToEndTestFixture(string rootPath)
{
string connectionString = AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.Storage);
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
_queueClient = storageAccount.CreateCloudQueueClient();
_blobClient = storageAccount.CreateCloudBlobClient();
CreateTestStorageEntities();
TraceWriter = new TestTraceWriter(TraceLevel.Verbose);
ScriptHostConfiguration config = new ScriptHostConfiguration()
{
RootScriptPath = rootPath,
TraceWriter = TraceWriter,
FileLoggingEnabled = true
};
HostManager = new ScriptHostManager(config);
Thread t = new Thread(_ =>
{
HostManager.RunAndBlock();
});
t.Start();
TestHelpers.Await(() => HostManager.IsRunning).Wait();
}
示例5: 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);
}
示例6: GenerateCloudQueueClient
public static CloudQueueClient GenerateCloudQueueClient()
{
Uri baseAddressUri = new Uri(TestBase.TargetTenantConfig.QueueServiceEndpoint);
CloudQueueClient client = new CloudQueueClient(baseAddressUri, TestBase.StorageCredentials);
client.AuthenticationScheme = DefaultAuthenticationScheme;
return client;
}
示例7: configureQueue
protected virtual void configureQueue(CloudStorageAccount storageAccount)
{
// Create the queue client
this.queueClient = storageAccount.CreateCloudQueueClient();
this.queue = createQueue(this.queueClient, this.queueName);
}
示例8: CloudQueueClientConstructor
public void CloudQueueClientConstructor()
{
Uri baseAddressUri = new Uri(TestBase.TargetTenantConfig.QueueServiceEndpoint);
CloudQueueClient queueClient = new CloudQueueClient(baseAddressUri, TestBase.StorageCredentials);
Assert.IsTrue(queueClient.BaseUri.ToString().StartsWith(TestBase.TargetTenantConfig.QueueServiceEndpoint));
Assert.AreEqual(TestBase.StorageCredentials, queueClient.Credentials);
}
示例9: AzureQueueController
public AzureQueueController()
{
var credentials = new StorageCredentials(ConfigurationManager.AppSettings["AzureAccountName"], ConfigurationManager.AppSettings["AzureKeyValue"]);
var azureTableUri = new Uri("https://" + ConfigurationManager.AppSettings["AzureAccountName"] + ".queue.core.windows.net");
var client = new CloudQueueClient(azureTableUri, credentials);
_queue = client.GetQueueReference(QueueName);
}
示例10: Run
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.TraceInformation("QueueProcessor_WorkerRole entry point called", "Information");
// Initialize the account information
var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
// retrieve a reference to the messages queue
var queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
var queue = queueClient.GetQueueReference("messagequeue");
while (true)
{
Thread.Sleep(10000);
Trace.TraceInformation("Working", "Information");
if (queue.Exists())
{
if (DateTime.UtcNow.AddMinutes(1) >= this.serviceQueueSasExpiryTime)
{
queueClient = new CloudQueueClient(this.uri, new StorageCredentials(this.GetProcessSasForQueues()));
queue = queueClient.GetQueueReference("messagequeue");
}
var msg = queue.GetMessage();
if (msg != null)
{
Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
queue.DeleteMessage(msg);
}
}
}
}
示例11: EmailQueue
public EmailQueue(CloudQueueClient queueClient)
{
Guard.NotNull(queueClient, nameof(queueClient));
this._queueClient = queueClient;
this._dequeuedMessages = new ConcurrentDictionary<Email, CloudQueueMessage>();
}
示例12: CreateShipQueue
private void CreateShipQueue(CloudQueueClient queueClient)
{
var shipQueueName = CloudConfigurationManager.GetSetting("ShipQueue.Name");
var queue = queueClient.GetQueueReference(shipQueueName);
queue.CreateIfNotExists();
}
示例13: AzureStorageQueuesTransport
/// <summary>
/// Constructs the transport
/// </summary>
public AzureStorageQueuesTransport(CloudStorageAccount storageAccount, string inputQueueName)
{
if (storageAccount == null) throw new ArgumentNullException("storageAccount");
if (inputQueueName == null) throw new ArgumentNullException("inputQueueName");
_inputQueueName = inputQueueName.ToLowerInvariant();
_queueClient = storageAccount.CreateCloudQueueClient();
}
示例14: QueueHelper
public QueueHelper(string storageAccountConnectionString)
: base(storageAccountConnectionString)
{
queueClient = base.StorageAccount.CreateCloudQueueClient();
subscribeQueue = queueClient.GetQueueReference(ConfigurationManager.AppSettings["QueueAzuremailsubscribequeue"]);
subscribeQueue.CreateIfNotExists();
}
示例15: AnalyzeSummonerMatchHistoryQueue
public AnalyzeSummonerMatchHistoryQueue(CloudQueueClient queueClient)
{
Guard.NotNull(queueClient, nameof(queueClient));
this._queueClient = queueClient;
this._dequeuedMessages = new ConcurrentDictionary<int, CloudQueueMessage>();
}