I am new to Spring Dropwizard and want to configure ActiveMQ on a simple client app.
I know that below configuration works in Spring Boot when placed in application.properties using Spring autoconfigure.
spring.activemq.brokerUrl=tcp://0.0.0.0:61616
spring.jms.cache.enabled=false
But how can we achieve the same thing in Spring Dropwizard? How can we place these properties in config.yml so that my client can start listening to JMS messages?
I tried the below config but Spring is not getting read from the config
spring:
activemq:
broker-url: tcp://localhost:61616
How can we configure same config in Dropwizard config with minimal changes to start listening to topic?
Related
I have a springboot app from which i would like to expose the kafka.consumer metrics to Prometheus via JMX. I can see the metrics here but i just don't know where to set those mBeans(i.e. kafka.consumer:type=consumer-metrics,client-id=([-.\w]+)). I understood reading the spring boot documentation that i need to activate JMX only by doing this setting spring.jmx.enabled=true but i don't know what to do extra to expose those metrics to Prometheus through JMX.
Kafka automatically registers its own MBeans with those names.
If you add the actuator starter, Boot will configure Micrometer to scrape those MBeans.
However, Micrometer has deprecated the JMX scraper and has new KafkaMetrics Objects.
Spring Boot 2.3 now uses those classes to configure Micrometer instead of JMX.
What is bootstrap yaml in spring boot?
And could you advise where I can use it?
bootstrap.yml is used in spring cloud
It is starting before application.yml
It is almost use with spring cloud config server
Spring cloud config server is server which is used to externilize your application configuration.
And when starting your application bootstrap.yml will take the configuration from spring cloud config server.
It also can use encrypting and decrypting some information by :
'{cipher}someyour encoded text'
and server will decode it while pulling the configurations
But you need to create jks
You can reach the documentation for more information about spring cloud :
https://spring.io/guides/gs/centralized-configuration/
Configuration files in spring boot will be loaded in such order:
1. src/main/resources/bootstrap.yml
2. src/main/resources/application.yml
3. config/application.yml
I'm having a problem with how to use just Netflix Archaius to work as a config server for multiple Spring Boot microservices. Previously when I applied Eureka and Spring Cloud Config Server in my multiple-services project built with Spring Boot, each microservie would get its own .properties file from the Spring Cloud Config server through the discovery function of the Eureka service. But now I need to change the Spring Cloud Config Server into a Netflix Archaius service, from which the Spring Boot microservices will get .properties file, i have no idea about how to achieve it. Is there any good idea for my reference? Thanks in advance.
Finally I gave up using Netflix Archaius to pull properties file for microservices. Instead, I wrote down required key-value-pair properties into the application.properties of each springboot microservice. Since all the springboot microservices will be deployed in the DCOS platform in the form of docker containers, some inconstant properties were configured into the marathon deployment scripts, which could be populated into the springboot applet. In this way I managed to configure the key-value-pair properties from the outside instead of being hardcoded in the program codes.
I'm just curious, is it possible to consume Spring Cloud config by a Spring REST service which is not a Spring boot application. If it is possible, where to define the properties in a Spring REST service. I meant, where should I define
spring.cloud.config.uri etc.
Or, only Spring boot applications are allowed to consume Cloud configuration?
Any thought would be appreciated. Thanks
well spring boot just bootstrap all configuration automatically . so for simple spring application you have to config it manually and define the cloud config server beans in your application configuration file . it could be pure old fashion xml files or just using java code configuration with #Configuration. you could find some samples in github
We have a Spring Boot application that needs to send messages to a queue available on a remote HornetQ message broker.
I saw that Spring Boot supports HornetQ in embedded mode. However, there's only a minimal set of spring.hornetq.* properties that I can set up on application.properties of my Boot application.
The application must use a core bridge (store and forward), which is configured in a hornetq-configuration.xml file.
Question: what do I need to do to make the HornetQ embedded instance provided by Spring Boot use a hornetq-configuration.xml file that I created?