简体   繁体   中英

Microsoft.Azure.ServiceBus.Message support for Azure Webjob Service

I'm developing my application on .net core framework which uses the following code to push messages to queue which is to be received by a webjob.

topicClient = new TopicClient(connection)
Message message = new Message(utf8encodedtext)
await topicClient.SendAsync(message);

BrokeredMessage support(Microsoft.ServiceBus namespace) is not yet there for .net core. I'm using the following code for Webjob

public static void   ProcessQueueMessage([ServiceBusTrigger("topicgeneric","subscription")] BrokeredMessage message, TextWriter log)
    {
        log.WriteLine(message.Label);

    }
}

With this setup I'm able to receive messages. However the web job doesn't support Microsoft.Azure.ServiceBus.Message. Is there any workaround to use Messages instead of BrokeredMessage are there any tradeoffs/compatibility issue/data loss . I want to re-write my webjob in .net core framework. Will it still work (currently its written in .net framework) as Microsoft.ServiceBus nuget is not supported in .net core

WebJobs SDK version 2.x is using the old service bus client with BrokeredMessage class.

WebJobs SDK version 3.x is using the new .NET Standard service bus client ( Microsoft.Azure.ServiceBus with Message class). It's still in preview though, 3.0.0-beta4 is the last release is of today.

So, you'd have to pick the matching versions: either use all old or all new.

BrokeredMessage support(Microsoft.ServiceBus namespace) is not yet there for .net core

BrokeredMessage will never appear in the new SDK, it's been replaced by Message . They are not compatible to each other, so various issues are possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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