Azure Service Bus Custom Java Action

0
I’m trying to write an integration for Azure Service Bus to receive messages from a topic/subscription. For this I created a Custom Java Action which seemingly connects but does not return any messages. I can run the code in a standalone Java application and it works well.  The dependencies (azure-messaging-servicebus and azure-identity) are bundled with Maven into a fat JAR. I call the Java Action from a Microflow (triggered by a button) and am currently running things locally in Studio Pro 9.10.2.  The Java Action contains the following: var logger = Core.getLogger("ServieBusAction"); logger.debug(String.format("Get creds...")); ClientSecretCredential credential = new ClientSecretCredentialBuilder() .tenantId("<...>") .clientId("<...>") .clientSecret("<...>") .build(); logger.debug(String.format("Get receiver...")); ServiceBusReceiverClient receiver = new ServiceBusClientBuilder() .credential("<...>", credential) .receiver() .maxAutoLockRenewDuration(Duration.ofMinutes(1)) .topicName("<...>") .subscriptionName("<...>") .buildClient(); logger.debug(String.format("Receive messages...")); ServiceBusReceivedMessage message = receiver .receiveMessages(1) .stream() .findAny() .orElse(null); String messageBody = ""; if (message != null) { messageBody = String.format("%s", message.getBody()); logger.debug(String.format("message body: %s", messageBody)); } receiver.close(); return messageBody; I can see the debug logs in the Console, including “Receive messages...”, then it just stalls. Any ideas? 
asked
3 answers
0

Have you tried adding a breakpoint in the action and single stepping through the Java action to see what is going on?

This link has instructions on how to connect a Java debugger to your Mendix application.

https://docs.mendix.com/howto/monitoring-troubleshooting/debug-java-actions/

Hope this helps.

answered
0

Thank you Robert! I debugged it, but only confirms that receiving messages hangs.

I manually made TCP connections to ports involved. From the documentation: “Ports used are 443 (HTTPS), 5671 (AMQP) and 9354 (Net Messaging/SBMP)” .

5671 seems to work, but 443 and 9354 errors with a “Connection reset”. Also tired to manually add the SSL certificate, but without success.

answered
0

Resolved it by upgrading to Mendix 9.13.0. Though, still puzzled what the issue was.

answered