首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将消息发送到服务总线主题花费的时间太长

将消息发送到服务总线主题花费的时间太长
EN

Stack Overflow用户
提问于 2021-03-19 15:56:29
回答 1查看 44关注 0票数 0

我正在从Azure函数向Service Bus Topic发送消息,当函数被调用前3-4次时,向Service Bus Topic发送消息大约需要10-20秒,我正在寻找减少这一时间的方法,我正在使用以下代码向service bus发送消息。

代码语言:javascript
复制
public class ServiceBusTopicService

    {
    private static ITopicClient _topicClient;

    public ServiceBusTopicService(string serviceBusConnectionString, string topicName)
    {
        _topicClient = new TopicClient(serviceBusConnectionString, topicName);
    }
    private  static async Task SendMessage(string json)
    {
        var message = new Message(Encoding.UTF8.GetBytes(json));

        await _topicClient.SendAsync(message);
    }

    public async Task BroadCastEvent(string matasId, Guid correlationId, string profileSource, string eventType)
    {
        var eventToPost = JsonConvert.SerializeObject(ProfileEvent.GetProfileEvent(matasId, correlationId, profileSource, eventType));
        await SendMessage(eventToPost);
    }
}
EN

回答 1

Stack Overflow用户

发布于 2021-03-20 00:58:40

如果它只是在启动时,那么它很可能是cold start problem

有关解决方案,请参阅this answer

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66704375

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档