Example #1
0
        public BrokeredMessage CreateMessage(string body, string queue, string messageType, CacheType cacheType, string filename, Dictionary <string, string> metadata)
        {
            var            location  = FullFilename(messageType, queue, filename);
            var            sasUri    = TokenGenerator.GetBlobSasUri(_container, location);
            CloudBlockBlob blockBlob = SaveToStorage(body, location);

            if (metadata != null)
            {
                foreach (var property in metadata)
                {
                    if (property.Value != "")
                    {
                        blockBlob.Metadata.Add(property.Key, property.Value);
                    }
                }

                blockBlob.SetMetadata();
            }

            LargeMessage myRefMsg = new LargeMessage
            {
                Uri          = blockBlob.Uri,
                BodyLocation = blockBlob.Name,
                CacheType    = CacheType.Storage,
                SasUri       = new Uri(sasUri)
            };

            return(new BrokeredMessage(SerializationHelper.SerializeToJsonString(myRefMsg)));
        }
Example #2
0
        private CloudBlockBlob GetReferenceToBlob(BrokeredMessage msg)
        {
            LargeMessage   myRef     = SerializationHelper.DeserializeFromJsonString <LargeMessage>(msg.GetBody <string>());
            CloudBlockBlob blockBlob = _container.GetBlockBlobReference(myRef.BodyLocation);

            return(blockBlob);
        }
 public BrokeredMessage CreateMessage(string body, string queue, string messageType, CacheType cacheType, string filename)
 {
     var location = FullFilename(messageType, queue, filename);
     var sasUri = TokenGenerator.GetBlobSasUri(_container, location);
     CloudBlockBlob blockBlob = SaveToStorage(body, location);
     LargeMessage myRefMsg = new LargeMessage
     {
         Uri = blockBlob.Uri,
         BodyLocation = blockBlob.Name,
         CacheType = CacheType.Storage,
         SasUri = new Uri(sasUri)
     };
     return new BrokeredMessage(SerializationHelper.SerializeToJsonString(myRefMsg));
 }
Example #4
0
        public BrokeredMessage CreateMessage(string body, string queue, string messageType, CacheType cacheType, string filename)
        {
            var            location  = FullFilename(messageType, queue, filename);
            var            sasUri    = TokenGenerator.GetBlobSasUri(_container, location);
            CloudBlockBlob blockBlob = SaveToStorage(body, location);
            LargeMessage   myRefMsg  = new LargeMessage
            {
                Uri          = blockBlob.Uri,
                BodyLocation = blockBlob.Name,
                CacheType    = CacheType.Storage,
                SasUri       = new Uri(sasUri)
            };

            return(new BrokeredMessage(SerializationHelper.SerializeToJsonString(myRefMsg)));
        }
        public BrokeredMessage CreateMessage(string body, string queue, string messageType, CacheType cacheType, string filename, Dictionary<string, string> metadata)
        {
            var location = FullFilename(messageType, queue, filename);
            var sasUri = TokenGenerator.GetBlobSasUri(_container, location);
            CloudBlockBlob blockBlob = SaveToStorage(body, location);
            if (metadata != null)
            {
                foreach (var property in metadata)
                {
                    if (property.Value != "") blockBlob.Metadata.Add(property.Key, property.Value);
                }

                blockBlob.SetMetadata();
            }

            LargeMessage myRefMsg = new LargeMessage
            {
                Uri = blockBlob.Uri,
                BodyLocation = blockBlob.Name,
                CacheType = CacheType.Storage,
                SasUri = new Uri(sasUri)
            };
            return new BrokeredMessage(SerializationHelper.SerializeToJsonString(myRefMsg));
        }