繁体   English   中英

如何压缩 azure 队列消息(json 字符串)以从 azure 存储队列中推送和拉取

[英]how to compress azure queue message (json string) to push and pull from azure storage queue

Azure 存储队列的最大消息大小为64Kb我的消息可能超过此大小,我正在寻找压缩选项

我的代码如下所示

var json = JsonConvert.SerializeObject(item);
            CloudQueueMessage message = new CloudQueueMessage(json);              

            queue.AddMessageAsync(message);

在接收端

 public static void ProcessQueueMessage([QueueTrigger("abc")] AbcItem abcItem, TextWriter logger)
    {
        if (abcItem != null)
        {
            //processing
        }
    }

我的问题是这种压缩是否可以在 azure 队列上工作,是否可以在推入队列之前压缩该字符串并在处理之前将其从队列中拉出时在另一端解压缩?

是的,您可以将所有信息存储在队列中,因此压缩信息也可以使用。

但是,即使是压缩文件也可能超过 64Kb,请查看此相关问答: Azure 队列存储:在消息中发送文件以将数据存储在 Blob 存储中,并且仅在队列中引用

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM