How do I disable the http server in a micronaut application

1.1k Views Asked by At

I have a micronaut application that is supposed to run a SQS listener in one container and a regular HTTP server on the other. How do I achieve this via configuration? I can use the following app properties to enable/disable the listener:

micronaut:
  jms:
    sqs:
      enabled: true

How do I enable/disable the web server?

PS: I was able to disable the web server in spring boot with spring.main.web-application-type=NONE. But I am not able to find the relevant setting in micronaut.

1

There are 1 best solutions below

0
On

Another idea to propose is based on the premise that your micronaut fires up both the sqs listener and http server everytime. Then you can configure an environment variable that will be read on startup time. Based on this environment variable you can enable or disable beans across the app that are interfaces to the listener or rest apis to the HTTP app. You can use the @Requires on beans, controllers, factories etc.