미리보기 버전 인 Microsoft.Azure.Management.ServiceBus Libary가 100 % 호환 .Netcore입니다. 우리는 여기 더 detail을 얻을 수 있습니다.
Preparetion :이
Registry Azure Active Directory application and assign Role
단계 :
는 .NET 코어 콘솔 프로젝트를 만들고 다음 코드를 추가합니다.
var tenantId = "tenantid";
var context = new AuthenticationContext($"https://login.windows.net/{tenantId}");
var clientId = "Client";
var clientSecret = "Secret";
var subscriptionId = "subscriptionId";
var result = context.AcquireTokenAsync(
"https://management.core.windows.net/",
new ClientCredential(clientId, clientSecret)).Result;
var creds = new TokenCredentials(result.AccessToken);
var sbClient = new ServiceBusManagementClient(creds)
{
SubscriptionId = subscriptionId
};
var queueParams = new QueueCreateOrUpdateParameters()
{
Location = "East Asia",
EnablePartitioning = true
};
var queue = sbClient.Queues.ListAll("groupname", "namespace").ToList().FirstOrDefault(x => x.Name.Equals("queuename"));
var messagecount = queue.MessageCount;
하늘빛 poratal에서
, 우리는 큐에서 메시지를 확인
Project.json 파일 :
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.Azure.Management.ServiceBus": "0.2.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.13.9",
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
이 푸른 서비스를 보이지 않는다 버스 코드 스 니펫이나 저장 대기열. –
물론, ServiceBus의 대기열에있는 항목의 수를 가져 오는 것과 동일한 기능은 무엇입니까? – w2olves
Google "하늘빛 서비스 버스 대기열에 메시지가 있습니다."그리고 말 그대로 첫 번째 결과는 질문에 대한 답변입니다. D http://stackoverflow.com/questions/16254951/determining-how-many-messages-are-on- the-azure-service-bus-queue –