Stack: Java Jakarta EE10 Wildfly27 Docker Dapr
The issue is configuration of Topics, dynamically. I have several environments TEST/DEV/PROD and i want to use different topics for the different environments, but the same image. Ideally i would like to set the topic via Environment variables.
So why not do this declarative? Well as i run Dapr on Azure Container Service (ACA) and it does NOT(!) support declarative config(!)
So the way to do this in my subscriber is via the Annotation @Topic
Like this@Topic(name = "cache_update", pubsubName = "${myAppProperty:messagebus}")
In the sample above "messagebus" is the default value and "myAppProperty" is the name of the application Property.
Had i used Spring this would have worked but we are using Jakarta EE10 running on Wildfly 27
How on earth can i get this to work?
UPDATE:
Ok, thank You very much for this, however i am still a bit unclear on how to write the Sub part (That will expose a POST endpoint? SO my Endpoint would look something like this instead?
(i.e No @Topic annotation needed?)
@Path("/handleTopicRoute")
@RequestScoped
public class DaprServiceImpl extends AbstractCmsService implements DaprService {
public Response receiveMessage(CloudEvent<CacheUpdate> event) {
return getResponse(daprSubscriptionController.updateCache(event.getData()));
}
So Dapr finds my mapping endpoint to topic via the endpoint you showed me?