本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Queue.CloudQueue类的典型用法代码示例。如果您正苦于以下问题:C# CloudQueue类的具体用法?C# CloudQueue怎么用?C# CloudQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudQueue类属于Microsoft.WindowsAzure.Storage.Queue命名空间,在下文中一共展示了CloudQueue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: configureQueue
protected virtual void configureQueue(CloudStorageAccount storageAccount)
{
// Create the queue client
this.queueClient = storageAccount.CreateCloudQueueClient();
this.queue = createQueue(this.queueClient, this.queueName);
}
开发者ID:NewMediaCenterMoscow,项目名称:UniSocial3,代码行数:7,代码来源:BaseMessageWorker.cs
示例2: RequestSasToken
static string RequestSasToken(CloudQueue queue)
{
// Omitting any authentication code since this is beyond the scope of
// this sample code
// creating a shared access policy that expires in 1 day.
// No start time is specified, which means that the token is valid immediately.
// The policy specifies full permissions.
SharedAccessQueuePolicy policy = new SharedAccessQueuePolicy()
{
SharedAccessStartTime = DateTime.UtcNow.AddMinutes(-15),
SharedAccessExpiryTime = DateTime.UtcNow.AddDays(1.0),
Permissions = SharedAccessQueuePermissions.Add |
SharedAccessQueuePermissions.Read |
SharedAccessQueuePermissions.Update |
SharedAccessQueuePermissions.ProcessMessages
};
// Generate the SAS token. No access policy identifier is used which
// makes it a non-revocable token
// limiting the table SAS access to only the request customer's id
string sasToken = queue.GetSharedAccessSignature(policy);
return sasToken;
}
开发者ID:King-of-Spades,项目名称:xamarin-samples,代码行数:25,代码来源:Queue.cs
示例3: QueueListenerTests
public QueueListenerTests()
{
CloudQueue queue = new CloudQueue(new Uri("https://test.queue.core.windows.net/testqueue"));
Mock<IStorageQueue> mockQueue = new Mock<IStorageQueue>(MockBehavior.Strict);
mockQueue.Setup(p => p.SdkObject).Returns(queue);
_mockTriggerExecutor = new Mock<ITriggerExecutor<IStorageQueueMessage>>(MockBehavior.Strict);
Mock<IDelayStrategy> mockDelayStrategy = new Mock<IDelayStrategy>(MockBehavior.Strict);
Mock<IBackgroundExceptionDispatcher> mockExceptionDispatcher = new Mock<IBackgroundExceptionDispatcher>(MockBehavior.Strict);
TextWriter log = new StringWriter();
Mock<IQueueProcessorFactory> mockQueueProcessorFactory = new Mock<IQueueProcessorFactory>(MockBehavior.Strict);
JobHostQueuesConfiguration queuesConfig = new JobHostQueuesConfiguration();
QueueProcessorFactoryContext context = new QueueProcessorFactoryContext(queue, log, queuesConfig);
_mockQueueProcessor = new Mock<QueueProcessor>(MockBehavior.Strict, context);
JobHostQueuesConfiguration queueConfig = new JobHostQueuesConfiguration
{
MaxDequeueCount = 5,
QueueProcessorFactory = mockQueueProcessorFactory.Object
};
mockQueueProcessorFactory.Setup(p => p.Create(It.IsAny<QueueProcessorFactoryContext>())).Returns(_mockQueueProcessor.Object);
_listener = new QueueListener(mockQueue.Object, null, _mockTriggerExecutor.Object, mockDelayStrategy.Object, mockExceptionDispatcher.Object, log, null, queueConfig);
CloudQueueMessage cloudMessage = new CloudQueueMessage("TestMessage");
_storageMessage = new StorageQueueMessage(cloudMessage);
}
开发者ID:Bjakes1950,项目名称:azure-webjobs-sdk,代码行数:28,代码来源:QueueListenerTests.cs
示例4: InitQueue
private void InitQueue()
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
queue = queueClient.GetQueueReference("jobqueue");
queue.CreateIfNotExists();
}
开发者ID:aaronhoffman,项目名称:azure-101,代码行数:7,代码来源:QueueJobController.cs
示例5: QueueProcessorFactoryContext
/// <summary>
/// Constructs a new instance
/// </summary>
/// <param name="queue">The <see cref="CloudQueue"/> the <see cref="QueueProcessor"/> will operate on.</param>
/// <param name="trace">The <see cref="TraceWriter"/> to write to.</param>
/// <param name="queueConfiguration">The queue configuration.</param>
/// <param name="poisonQueue">The queue to move messages to when unable to process a message after the maximum dequeue count has been exceeded. May be null.</param>
internal QueueProcessorFactoryContext(CloudQueue queue, TraceWriter trace, IQueueConfiguration queueConfiguration, CloudQueue poisonQueue = null)
: this(queue, trace, poisonQueue)
{
BatchSize = queueConfiguration.BatchSize;
MaxDequeueCount = queueConfiguration.MaxDequeueCount;
NewBatchThreshold = queueConfiguration.NewBatchThreshold;
}
开发者ID:GPetrites,项目名称:azure-webjobs-sdk,代码行数:14,代码来源:QueueProcessorFactoryContext.cs
示例6: 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);
}
开发者ID:Neonsonne,项目名称:dbSpeed,代码行数:7,代码来源:AzureQueueController.cs
示例7: StorageQueueViewModel
public StorageQueueViewModel(CloudQueue queue)
{
if (queue == null)
throw new ArgumentNullException(nameof(queue));
_queue = queue;
}
开发者ID:gest01,项目名称:BetterStorageExplorer,代码行数:7,代码来源:StorageQueueViewModel.cs
示例8: 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();
}
开发者ID:phongha,项目名称:myprojects,代码行数:35,代码来源:WorkerRoleB.cs
示例9: 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();
}
开发者ID:bwrichte,项目名称:LoggingService,代码行数:28,代码来源:WorkerRoleC.cs
示例10: FakeStorageQueue
public FakeStorageQueue(MemoryQueueStore store, string queueName, IStorageQueueClient parent)
{
_store = store;
_queueName = queueName;
_parent = parent;
_sdkObject = new CloudQueue(new Uri("http://localhost/" + queueName));
}
开发者ID:ConnorMcMahon,项目名称:azure-webjobs-sdk,代码行数:7,代码来源:FakeStorageQueue.cs
示例11: ProcessRequestAsync
public static async Task ProcessRequestAsync(HttpContext Context, string Action) {
var form = Context.Request.Form;
Context.Response.ContentType = "text/javascript";
switch (Action) {
case Forms.TakeThePledge.Action.Form:
var businessName = form[Forms.TakeThePledge.Keys.BusinessName];
var address = form[Forms.TakeThePledge.Keys.Address];
var manager = form[Forms.TakeThePledge.Keys.OwnerManagerName];
var phoneNumber = form[Forms.TakeThePledge.Keys.PhoneNumber];
var email = form[Forms.TakeThePledge.Keys.Email];
var website = form[Forms.TakeThePledge.Keys.Website];
string message = $"Business Name: {businessName}\r\nAddress: {address}\r\nOwner/Manager: {manager}\r\nPhone Number: {phoneNumber}\r\nEmail: {email}\r\nWebsite: {website}";
try {
var e = new Site.Email() { To = Application.TakeThePledge.Form.EmailTo, Subject = "New Business Took Bag Free Portsmouth Pledge", Body = message };
if (_queue == null) {
_queue = CloudStorageAccount.Parse($"DefaultEndpointsProtocol=https;AccountName={Application.Queue.Name};AccountKey={Application.Queue.Key}").CreateCloudQueueClient().GetQueueReference(Application.Queue.Name);
}
await _queue.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(e)));
await Context.Response.WriteAsync(Response.Substitute(Forms.TakeThePledge.HtmlID.FormContainer, "<div class=\"tac blue\">Thanks! Your information has been received and you'll be contacted shortly.</div>"));
} catch {
await Context.Response.WriteAsync(Response.Substitute(Forms.TakeThePledge.HtmlID.FormContainer, $"<div class=\"tac blue\">Sorry, there was an error processing the form.</div>"));
}
break;
}
}
开发者ID:matthewhancock,项目名称:plasticbagfreeportsmouth,代码行数:29,代码来源:Post.cs
示例12: 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();
}
开发者ID:jcflore3,项目名称:TCWAdminPortal,代码行数:34,代码来源:WorkerRole.cs
示例13: getQueueLength
protected static int getQueueLength(CloudQueue queue)
{
queue.FetchAttributes();
var messageCount = queue.ApproximateMessageCount;
return messageCount ?? 0;
}
开发者ID:NewMediaCenterMoscow,项目名称:UniSocial3,代码行数:7,代码来源:Program.cs
示例14: 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);
}
开发者ID:afyles,项目名称:NServiceBus,代码行数:25,代码来源:AzureQueueFixture.cs
示例15: 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)?$");
}
开发者ID:kinderst,项目名称:Web-Service-Like-Google,代码行数:28,代码来源:Crawler.cs
示例16: Initialize
public static void Initialize(string storageConnectionString, string ocrQueueName, string emailQueueName)
{
storageAccount = CloudStorageAccount.Parse(storageConnectionString);
queueClient = storageAccount.CreateCloudQueueClient();
ocrQueue = InitializeQueue(ocrQueueName);
emailQueue = InitializeQueue(emailQueueName);
}
开发者ID:melicamp,项目名称:azure-cloud-ocr,代码行数:8,代码来源:AzureQueues.cs
示例17: InitializeStorage
private void InitializeStorage()
{
var storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["AzureWebJobsStorage"].ToString());
var blobClient = storageAccount.CreateCloudBlobClient();
_imagesBlobContainer = blobClient.GetContainerReference("images");
var queueClient = storageAccount.CreateCloudQueueClient();
_requestQueue = queueClient.GetQueueReference("imagerequest");
}
开发者ID:Arrnt,项目名称:CLD3000Oblig2,代码行数:8,代码来源:HomeController.cs
示例18: CacheVoteGetter
public CacheVoteGetter(ApplicationDbContext dbContext)
{
_dbContext = dbContext;
var cloudStorageAccount = CloudStorageAccount.Parse(Startup.Configuration["MicrosoftAzureStorage:devdaydemo_AzureStorageConnectionString"]);
var createCloudQueueClient = cloudStorageAccount.CreateCloudQueueClient();
_messageQueue = createCloudQueueClient.GetQueueReference(typeof(Voto).Name.ToLowerInvariant());
}
开发者ID:alebanzas,项目名称:DevDayCompete,代码行数:8,代码来源:CacheVoteGetter.cs
示例19: AzureStorageQueue
/// <summary>
/// Azure storage queue constructor.
/// </summary>
/// <param name="queue">Cloud queue object</param>
public AzureStorageQueue(CloudQueue queue)
{
CloudQueue = queue;
Name = queue.Name;
Uri = queue.Uri;
ApproximateMessageCount = queue.ApproximateMessageCount;
EncodeMessage = queue.EncodeMessage;
}
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:12,代码来源:AzureStorageQueue.cs
示例20: QueueHelper
public QueueHelper(string storageAccountConnectionString)
: base(storageAccountConnectionString)
{
queueClient = base.StorageAccount.CreateCloudQueueClient();
subscribeQueue = queueClient.GetQueueReference(ConfigurationManager.AppSettings["QueueAzuremailsubscribequeue"]);
subscribeQueue.CreateIfNotExists();
}
开发者ID:prashanthganathe,项目名称:PersonalProjects,代码行数:8,代码来源:QueueHelper.cs
注:本文中的Microsoft.WindowsAzure.Storage.Queue.CloudQueue类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论