本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient.GetQueueReference方法的典型用法代码示例。如果您正苦于以下问题:C# CloudQueueClient.GetQueueReference方法的具体用法?C# CloudQueueClient.GetQueueReference怎么用?C# CloudQueueClient.GetQueueReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient
的用法示例。
在下文中一共展示了CloudQueueClient.GetQueueReference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例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: 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);
}
}
}
}
示例5: CreateShipQueue
private void CreateShipQueue(CloudQueueClient queueClient)
{
var shipQueueName = CloudConfigurationManager.GetSetting("ShipQueue.Name");
var queue = queueClient.GetQueueReference(shipQueueName);
queue.CreateIfNotExists();
}
示例6: QueueHelper
public QueueHelper(string storageAccountConnectionString)
: base(storageAccountConnectionString)
{
queueClient = base.StorageAccount.CreateCloudQueueClient();
subscribeQueue = queueClient.GetQueueReference(ConfigurationManager.AppSettings["QueueAzuremailsubscribequeue"]);
subscribeQueue.CreateIfNotExists();
}
示例7: 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();
}
示例8: CallQueueService
public CallQueueService(string storageConnectionStringConfigName = "StorageConnectionString")
{
var connectionString = CloudConfigurationManager.GetSetting(storageConnectionStringConfigName);
var storageAccount = CloudStorageAccount.Parse(connectionString);
this.queueClient = storageAccount.CreateCloudQueueClient();
this.queue = queueClient.GetQueueReference("calls");
this.queue.CreateIfNotExists();
}
示例9: createQueue
protected virtual CloudQueue createQueue(CloudQueueClient client, string queueName)
{
// Retrieve a reference to a queues
var queue = client.GetQueueReference(queueName);
// Create the queue if it doesn't already exist
queue.CreateIfNotExists();
return queue;
}
示例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)
{
queue.FetchAttributes();
var messageParts = msg.AsString.Split(new char[] { ',' });
var message = messageParts[0];
var blobReference = messageParts[1];
if (queue.Metadata.ContainsKey("Resize") && string.Equals(message, "Photo Uploaded"))
{
var maxSize = queue.Metadata["Resize"];
Trace.TraceInformation("Resize is configured");
CloudBlockBlob outputBlob = this.container.GetBlockBlobReference(blobReference);
outputBlob.FetchAttributes();
Trace.TraceInformation(string.Format("Image ContentType: {0}", outputBlob.Properties.ContentType));
Trace.TraceInformation(string.Format("Image width: {0}", outputBlob.Metadata["Width"]));
Trace.TraceInformation(string.Format("Image hieght: {0}", outputBlob.Metadata["Height"]));
}
Trace.TraceInformation(string.Format("Message '{0}' processed.", msg.AsString));
queue.DeleteMessage(msg);
}
}
}
}
示例11: PickCreator
public PickCreator()
{
_storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting("StorageConnectionString"));
_queueClient = _storageAccount.CreateCloudQueueClient();
_queue = _queueClient.GetQueueReference("scaleoutsamplequeue");
_queue.CreateIfNotExists();
}
示例12: OnStart
public override bool OnStart()
{
_account = CloudStorageAccount.Parse(
RoleEnvironment.GetConfigurationSettingValue("SiteMonitRConnectionString")
);
_queueClient = _account.CreateCloudQueueClient();
_queue = _queueClient.GetQueueReference(new WebSiteQueueConfiguration().GetIncomingQueueName());
_queue.CreateIfNotExists();
return base.OnStart();
}
示例13: AzureQueueHelper
public AzureQueueHelper()
{
// Retrieve the storage account from a connection string in the web.config file.
storageAccount = CloudStorageAccount.Parse(
ConfigurationManager.AppSettings["AzureQueueConnectionString"]);
// Create the cloud queue client.
queueClient = storageAccount.CreateCloudQueueClient();
// Retrieve a reference to our queue.
queue = queueClient.GetQueueReference("receiptgenerator");
}
示例14: AzureStorageQueueEndpointManager
protected AzureStorageQueueEndpointManager(AzureStorageQueueEndpoint endpoint,
IAzureStorageConfiguration storageConfiguration)
{
if (storageConfiguration == null)
throw new ArgumentNullException("storageConfiguration");
endpoint.Validate();
storageConfiguration.Validate();
CloudStorageAccount = CloudStorageAccount.Parse(storageConfiguration.ConnectionString);
CloudQueueClient = CloudStorageAccount.CreateCloudQueueClient();
CloudQueue = CloudQueueClient.GetQueueReference(endpoint.QueueName);
}
示例15: GetMessage
/// <summary>
/// Wrapper method that adds a message to the queue. Accepts all the same parameters that
/// CloudQueue.AddMessage accepts and passes them through.
///
/// Gets a message from the queue using the default request options. This operation marks
/// the retrieved message as invisible in the queue for the default visibility timeout period.
/// </summary>
/// <param name="visibilityTimeout">The visibility timeout interval.</param>
/// <param name="options">A <see cref="T:Microsoft.WindowsAzure.Storage.Queue.QueueRequestOptions"/> object
/// that specifies any additional options for the request. Specifying null will use the default request
/// options from the associated service client (<see cref="T:Microsoft.WindowsAzure.Storage.Queue.CloudQueueClient"/>).</param>
/// <param name="operationContext">An <see cref="T:Microsoft.WindowsAzure.Storage.OperationContext"/> object that represents
/// the context for the current operation. This object is used to track requests to the storage service, and to provide
/// additional runtime information about the operation.</param>
/// <returns>
/// A message.
/// </returns>
public CloudQueueMessage GetMessage(TimeSpan? visibilityTimeout = null, QueueRequestOptions options = null, OperationContext operationContext = null)
{
try
{
var cloudQueueClient = new CloudQueueClient(BaseUri, StorageCredentials);
var cloudQueue = cloudQueueClient.GetQueueReference(QueueName);
return cloudQueue.GetMessage(visibilityTimeout, options, operationContext);
}
catch (StorageException ex)
{
System.Diagnostics.Trace.TraceError("Exception thrown: " + ex); // TODO: exception handling, dude
throw;
}
}