I'm currently developing a Spring Boot application that uses ActiveMQ "Classic" to communicate with MQTT enabled devices. The main problem is that I need to have in-memory ActiveMQ because when the Spring Boot application doesn't, all the messages sent to the topics can't be read because the @JmsListener for the topics only work in runtime(because the same is subscriber of the topic in that moment). I could use a docker-compose to create a stack and lock everything when ActiveMQ container is down but I can't use it into the project that I'm actually doing.
So, is there a way to expose the ports of in-memory ActiveMQ or a way to start an ActiveMQ deamon when the Spring Boot project start and stop it when Spring Boot stops?
Here is the application.properties file
    # Embedded ActiveMQ Configuration Example
    spring.activemq.broker-url=vm://embedded?broker.persistent=false,useShutdownHook=false
    spring.activemq.close-timeout=15000
    spring.activemq.in-memory=true
    spring.activemq.non-blocking-redelivery=false
    spring.activemq.password=admin
    spring.activemq.user=admin
    spring.activemq.send-timeout=0
    spring.activemq.packages.trust-all=false
    spring.activemq.packages.trusted=com.memorynotfound
    spring.activemq.pool.block-if-full=true
    spring.activemq.pool.block-if-full-timeout=-1
    spring.activemq.pool.create-connection-on-startup=true
    spring.activemq.pool.enabled=false
    spring.activemq.pool.expiry-timeout=0
    spring.activemq.pool.idle-timeout=30000
    spring.activemq.pool.max-connections=1
    spring.activemq.pool.max-sessions-per-connection=500
    spring.activemq.pool.reconnect-on-exception=true
    spring.activemq.pool.time-between-expiration-check=-1
    spring.activemq.pool.use-anonymous-producers=true