I'm trying to get messages from Azure Service Bus via java application. I created necessary client config and for example there was successful connection through ManagementClient
@Bean
public ClientSettings getMessageReceiver() throws ServiceBusException, InterruptedException {
AzureTokenCredentials azureTokenCredentials = new ApplicationTokenCredentials(
"clientID,
"domain",
"secret",
AzureEnvironment.AZURE
);
TokenProvider tokenProvider = TokenProvider.createAzureActiveDirectoryTokenProvider(
new AzureAuthentication(azureTokenCredentials),
AzureEnvironment.AZURE.activeDirectoryEndpoint(),
null
);
ClientSettings clientSettings = new ClientSettings(tokenProvider,
RetryPolicy.getDefault(),
Duration.ofSeconds(30),
TransportType.AMQP);
return clientSettings;
}
ManagementClient managementClient =
new ManagementClient(Util.convertNamespaceToEndPointURI("namespace"),
clientSettings);
managementClient.getTopics();
But when I try to get messages from particular topic:
SubscriptionClient subscriptionClient = new SubscriptionClient("namespace", "events/subscriptions/subscription", clientSettings, ReceiveMode.PEEKLOCK);
And got an error message:
It is not possible for an entity that requires sessions to create a non-sessionful message receiver.
What additional steps should be provided?