0
votes

I develop a high load enterprise application. There are 2 services which should be scaled in specific way. They use Azure EventHubs for messaging. When load increase we need to create one more instance of a service and create one more topic (Event Hub) for communication with other services.

Is there a way to create event hub dynamically from java code? For example if I use Kafka I can just pass name of topic that doesn't exist and it will create it by itself. When I try to do it with Azure EventHubs I have such error:

The messaging entity 'sb://eventhubdev.servicebus.windows.net/newTopic' could not be found.

So... is it possible to create and delete it programmatically? Google didn't help me with this question clearly enough.

2

2 Answers

0
votes

There might be a solution to scale via java, but I would challenge that. Scaling should be handled by your infrastructure (e.g. kubernetes) and not your code. Furthermore, I don't know if the eventhub is dynamically enough to be scaled in the first place.

Providing the eventhub could be done via terraform. See Link for further details: https://www.terraform.io/docs/providers/azurerm/r/eventhub.html

0
votes

After long investigation we decided to create new topic by direct API calls as described in this doc: https://docs.microsoft.com/en-us/rest/api/eventhub/eventhubs/createorupdate