本文整理汇总了C#中Microsoft.WindowsAzure.StorageClient.CloudQueueMessage类的典型用法代码示例。如果您正苦于以下问题:C# CloudQueueMessage类的具体用法?C# CloudQueueMessage怎么用?C# CloudQueueMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudQueueMessage类属于Microsoft.WindowsAzure.StorageClient命名空间,在下文中一共展示了CloudQueueMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetAndGetMessageReference
public void SetAndGetMessageReference()
{
var cloudMessage = new CloudQueueMessage("dummy");
var queueMessage = new TestAzureQueueMessage();
queueMessage.SetMessageReference(cloudMessage);
Assert.AreEqual(cloudMessage, queueMessage.GetMessageReference());
}
开发者ID:hanzzhang,项目名称:developguide,代码行数:7,代码来源:AzureQueueMessageFixture.cs
示例2: DeleteMessage
/// <summary>
///
/// </summary>
/// <param name="queueName"></param>
/// <param name="cloudQueueMessage"></param>
///
public static void DeleteMessage(string queueName, CloudQueueMessage cloudQueueMessage)
{
if (cloudQueueMessage != null)
{
DeleteMessage(queueName, cloudQueueMessage.Id, cloudQueueMessage.PopReceipt);
}
}
开发者ID:cataylor,项目名称:bananasplit,代码行数:13,代码来源:AzureQueue.cs
示例3: addJob
static void addJob(string UUID)
{
CloudQueue queue = queueClient.GetQueueReference("taskqueue");
queue.CreateIfNotExist();
CloudQueueMessage message = new CloudQueueMessage(UUID);
queue.AddMessage(message);
}
开发者ID:lsdale,项目名称:lsdRepo,代码行数:7,代码来源:Program.cs
示例4: Send
public void Send(string destinationQueueName, TransportMessageToSend message, ITransactionContext context)
{
var outputQueue = cloudQueueClient.GetQueueReference(destinationQueueName);
using (var memoryStream = new MemoryStream())
{
var formatter = new BinaryFormatter();
var receivedTransportMessage = new ReceivedTransportMessage
{
Id = Guid.NewGuid().ToString(),
Headers = message.Headers,
Body = message.Body,
Label = message.Label,
};
formatter.Serialize(memoryStream, receivedTransportMessage);
memoryStream.Position = 0;
var cloudQueueMessage = new CloudQueueMessage(memoryStream.ToArray());
var timeToLive = GetTimeToLive(message);
if (timeToLive.HasValue)
{
outputQueue.AddMessage(cloudQueueMessage, timeToLive.Value);
}
else
{
outputQueue.AddMessage(cloudQueueMessage);
}
}
}
开发者ID:nls75,项目名称:Rebus,代码行数:31,代码来源:AzureMessageQueue.cs
示例5: Index
//
// GET: /Subscription/
public ActionResult Index(string From, string To, string Body)
{
TwilioRestClient twilio;
SMSMessage text;
PhoneNumberUtil phoneUtil = PhoneNumberUtil.GetInstance();
string oldFrom = From;
try
{
From = phoneUtil.Parse(Body, "US").NationalNumber.ToString();
twilio = new TwilioRestClient("accountSid", "authToken");
text = twilio.SendSmsMessage("+YOURTWILIONUMBER", oldFrom, "You're so thoughtful. Steve will call your friend soon!");
}
catch (NumberParseException e)
{
}
string storageConnectionString = "DefaultEndpointsProtocol=https;AccountName=AccountName;AccountKey=ACCOUNTKEY";
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString);
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
CloudQueue queue = queueClient.GetQueueReference("messages");
queue.CreateIfNotExist();
CloudQueueMessage message = new CloudQueueMessage(From);
queue.AddMessage(message, new TimeSpan(1, 0, 0), new TimeSpan(0, 1, 0));
twilio = new TwilioRestClient("accountSid", "authToken");
text = twilio.SendSmsMessage("+YOURTWILIONUMBER", From, "Sorry you're not feeling well. You'll soon hear from Steve! If you want Steve to call a friend just send their number!");
return View();
}
开发者ID:yeahren,项目名称:FlatteristSMS,代码行数:36,代码来源:SubscriptionController.cs
示例6: 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();
}
开发者ID:nicolas3470,项目名称:Distributed-Web-Crawler,代码行数:33,代码来源:WorkerRole.cs
示例7: SignButton_Click
protected void SignButton_Click(object sender, EventArgs e)
{
if (this.FileUpload1.HasFile)
{
this.InitializeStorage();
// upload the image to blob storage
string uniqueBlobName = string.Format("guestbookpics/image_{0}{1}", Guid.NewGuid().ToString(), Path.GetExtension(this.FileUpload1.FileName));
CloudBlockBlob blob = blobStorage.GetBlockBlobReference(uniqueBlobName);
blob.Properties.ContentType = this.FileUpload1.PostedFile.ContentType;
blob.UploadFromStream(this.FileUpload1.FileContent);
System.Diagnostics.Trace.TraceInformation("Uploaded image '{0}' to blob storage as '{1}'", this.FileUpload1.FileName, uniqueBlobName);
// create a new entry in table storage
GuestBookEntry entry = new GuestBookEntry() { GuestName = this.NameTextBox.Text, Message = this.MessageTextBox.Text, PhotoUrl = blob.Uri.ToString(), ThumbnailUrl = blob.Uri.ToString() };
GuestBookDataSource ds = new GuestBookDataSource();
ds.AddGuestBookEntry(entry);
System.Diagnostics.Trace.TraceInformation("Added entry {0}-{1} in table storage for guest '{2}'", entry.PartitionKey, entry.RowKey, entry.GuestName);
// queue a message to process the image
var queue = queueStorage.GetQueueReference("guestthumbs");
var message = new CloudQueueMessage(string.Format("{0},{1},{2}", blob.Uri.ToString(), entry.PartitionKey, entry.RowKey));
queue.AddMessage(message);
System.Diagnostics.Trace.TraceInformation("Queued message to process blob '{0}'", uniqueBlobName);
}
this.NameTextBox.Text = string.Empty;
this.MessageTextBox.Text = string.Empty;
this.DataList1.DataBind();
}
开发者ID:eebesos,项目名称:azurelab,代码行数:32,代码来源:Default.aspx.cs
示例8: SignButton_Click
protected void SignButton_Click( object sender, EventArgs e )
{
if ( FileUpload1.HasFile )
{
InitializeStorage( );
//Subo la imagen al Blob Storage
CloudBlobContainer container = blobStorage.GetContainerReference( "fotogolpics" );
string uniqueBlobName = string.Format( "image_{0}.jpg", Guid.NewGuid( ).ToString( ) );
CloudBlockBlob blob = container.GetBlockBlobReference( uniqueBlobName );
blob.Properties.ContentType = FileUpload1.PostedFile.ContentType;
blob.UploadFromStream( FileUpload1.FileContent );
System.Diagnostics.Trace.TraceInformation( "Uploaded image '{0}' to blob storage as '{1}'", FileUpload1.FileName, uniqueBlobName );
//Creo un nuevo registro en la tabla
FotoGolEntry entry = new FotoGolEntry( ) { GuestName = NameTextBox.Text, Message = MessageTextBox.Text, PhotoUrl = blob.Uri.ToString( ), ThumbnailUrl = blob.Uri.ToString( ) };
FotoGolEntryDataSource ds = new FotoGolEntryDataSource( );
ds.AddGuestBookEntry( entry );
System.Diagnostics.Trace.TraceInformation( "Added entry {0}-{1} in table storage for guest '{2}'", entry.PartitionKey, entry.RowKey, entry.GuestName );
//Pongo un mensaje en cola para que se procese
var queue = queueStorage.GetQueueReference( "fotogolthumbs" );
var message = new CloudQueueMessage( String.Format( "{0},{1},{2}", uniqueBlobName, entry.PartitionKey, entry.RowKey ) );
queue.AddMessage( message );
System.Diagnostics.Trace.TraceInformation( "Queued message to process blob '{0}'", uniqueBlobName );
}
NameTextBox.Text = "";
MessageTextBox.Text = "";
DataList1.DataBind( );
}
开发者ID:julid29,项目名称:confsamples,代码行数:32,代码来源:Default.aspx.cs
示例9: FromMessage
// See Figure 2 in http://msdn.microsoft.com/en-us/magazine/ee335721.aspx
public static AzureMessage FromMessage(CloudQueueMessage message)
{
byte[] buffer = message.AsBytes;
MemoryStream ms = new MemoryStream(buffer);
ms.Position = 0;
BinaryFormatter bf = new BinaryFormatter();
return (AzureMessage)bf.Deserialize(ms);
}
开发者ID:ankurdave,项目名称:cloudclustering,代码行数:9,代码来源:AzureMessage.cs
示例10: AddListingSearch
public void AddListingSearch(int leadSearchId )
{
var q = GetQ("listingsearch");
// Create a message and add it to the queue
var qMessage = new CloudQueueMessage(leadSearchId.ToString());
q.AddMessage(qMessage);
}
开发者ID:karldennis,项目名称:LeadGen,代码行数:8,代码来源:QueueManager.cs
示例11: AddMessage
public void AddMessage()
{
SomeClass someObject = new SomeClass() { Action = "MonteCarloSimulation" };
Byte[] message = SomeClass.ToByte(someObject);
CloudQueueMessage cloudQueueMessage = new CloudQueueMessage(message);
cloudQueue.AddMessage(cloudQueueMessage);
}
开发者ID:yoshiao,项目名称:Azure_Parallel_Samples,代码行数:9,代码来源:PoisonMessagesExample.cs
示例12: ButtonSave_Click
protected void ButtonSave_Click(object sender, EventArgs e)
{
if (FileUploadImage.HasFiles & Page.IsValid)
{
string uniqueBobName = string.Format("{0}/funnyimage_{1}{2}", Utils.CloudBlobKey,
Guid.NewGuid().ToString(),
Path.GetExtension(FileUploadImage.FileName));
CloudBlockBlob blob = _blobClient.GetBlockBlobReference(uniqueBobName);
blob.Properties.ContentType = FileUploadImage.PostedFile.ContentType;
blob.UploadFromStream(FileUploadImage.FileContent);
FunnyAppRepository<Post> postRepository = new FunnyAppRepository<Post>();
FunnyAppRepository<Tag> tagRepository = new FunnyAppRepository<Tag>();
MembershipUser user = Membership.GetUser(Page.User.Identity.Name);
if (user != null)
{
Post post = new Post
{
PostContent = TextBoxDescription.Text,
PostTitle = TextBoxTitle.Text,
State = false,
UserId = user.ProviderUserKey.ToString()
};
string[] tags = TextBoxTag.Text.Split(';');
foreach (string tag in tags)
{
if (!string.IsNullOrEmpty(tag))
{
tagRepository.Create(new Tag()
{
PostRowKey = post.RowKey,
PostPartitionKey = post.PartitionKey,
TagName = tag,
});
tagRepository.SubmitChange();
}
}
postRepository.Create(post);
postRepository.SubmitChange();
CloudQueue queue = _queueClient.GetQueueReference(Utils.CloudQueueKey);
CloudQueueMessage message =
new CloudQueueMessage(string.Format("{0},{1},{2}", blob.Uri, post.PartitionKey, post.RowKey));
queue.AddMessage(message);
LabelResult.Text = "Uploaded";
}
else
{
LabelResult.Text = "Failed";
}
}
}
开发者ID:Ravikumarmaddi,项目名称:WindowsAzure.FunnyApp,代码行数:57,代码来源:ImageUploadPage.aspx.cs
示例13: PutQueueMessage
public void PutQueueMessage(MessageType type, Dictionary<string, long> data)
{
System.IO.MemoryStream stream = new System.IO.MemoryStream(1024 * 64);
_formatter.Serialize(stream, data);
data.Add("Type", (long)type);
CloudQueueMessage message = new CloudQueueMessage(stream.ToArray());
queue.AddMessage(message);
}
开发者ID:mchambers,项目名称:Daremeto,代码行数:10,代码来源:ProcessingQueue.cs
示例14: AddMessages
public void AddMessages()
{
String content1 = "Do something";
CloudQueueMessage message1 = new CloudQueueMessage(content1);
cloudQueue.AddMessage(message1);
String content2 = "Do something else";
CloudQueueMessage message2 = new CloudQueueMessage(content2);
cloudQueue.AddMessage(message2, TimeSpan.FromDays(1.0));
}
开发者ID:yoshiao,项目名称:Azure_Parallel_Samples,代码行数:10,代码来源:AddMessagesExample.cs
示例15: Enqueue
public void Enqueue(ItemBase item)
{
CloudQueueMessage message;
using(var stream = new MemoryStream()){
new BinaryFormatter().Serialize(stream, item);
stream.Flush();
message = new CloudQueueMessage(stream.ToArray());
}
GetQueue().AddMessage(message);
}
开发者ID:tarwn,项目名称:AzureFileProcessorSample,代码行数:10,代码来源:QueueStore.cs
示例16: Push
public void Push(string queueName, string data)
{
// Create the queue client
CloudQueueClient queueClient = this.GetAccount().CreateCloudQueueClient();
// Retrieve a reference to a queue
CloudQueue queue = queueClient.GetQueueReference(queueName);
var message = new CloudQueueMessage(data);
queue.AddMessage(message);
}
开发者ID:Ravikumarmaddi,项目名称:UW-PCE-Cloud-Computing-302,代码行数:10,代码来源:QueueProvider.cs
示例17: Send
public void Send(object command)
{
var formatter = new BinaryFormatter();
using (var s = new MemoryStream())
{
formatter.Serialize(s, command);
var msg = new CloudQueueMessage(s.ToArray());
this.queue.AddMessage(msg);
}
}
开发者ID:ploeh,项目名称:CQRSonAzureDemo,代码行数:10,代码来源:AzureChannel.cs
示例18: AddMessage
/// <summary>
///
/// </summary>
/// <param name="queueName"></param>
/// <param name="messageText"></param>
/// <param name="createQueue"></param>
///
public static void AddMessage(string queueName, string messageText, bool createQueue = true)
{
var cloudQueue = GetCloudQueue(queueName);
var cloudQueueMessage = new CloudQueueMessage(messageText);
if (createQueue)
{
cloudQueue.CreateIfNotExist();
}
cloudQueue.AddMessage(cloudQueueMessage);
}
开发者ID:cataylor,项目名称:bananasplit,代码行数:17,代码来源:AzureQueue.cs
示例19: BackoffExample
public BackoffExample(String queueName)
{
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["DataConnectionString"]);
CloudQueueClient cloudQueueClient = cloudStorageAccount.CreateCloudQueueClient();
cloudQueue = cloudQueueClient.GetQueueReference(queueName);
cloudQueue.CreateIfNotExist();
CloudQueueMessage cloudQueueMessage = new CloudQueueMessage("Some message");
cloudQueue.AddMessage(cloudQueueMessage);
}
开发者ID:yoshiao,项目名称:Azure_Parallel_Samples,代码行数:10,代码来源:BackoffExample.cs
示例20: SetupRecipe
public void SetupRecipe()
{
cloudQueue.CreateIfNotExist();
for (Int32 i = 0; i < 100; i++)
{
String content = String.Format("Message_{0}", i);
CloudQueueMessage message = new CloudQueueMessage(content);
cloudQueue.AddMessage(message);
}
}
开发者ID:yoshiao,项目名称:Azure_Parallel_Samples,代码行数:10,代码来源:GetMessagesExample.cs
注:本文中的Microsoft.WindowsAzure.StorageClient.CloudQueueMessage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论