Graceful shutdown with JmsHealthIndicator in Spring Boot - spring-boot

Using Spring 1.5.9.RELEASE on JDK 1.9
Would like to use the JmsHealthIndicator to indicate when a connection to a queue manager can't be established after x-number of tries. Haven't found any good online info om how to configure the JmsHealthIndicator other than it should be auto-configured. Also, not sure how often the indicator is called (i.e. can I control the frequency or not)? What endpoint it is associated with?

Related

ActiveMQ Artemis - Spring Boot Throttling

Set up - ActiveMQ Artemis 2.14.0 and Spring Boot.
Problem statement: I want to achieve throttling in terms of reading / limiting the messages to be read from ActiveMQ.
This can be achieved by configuring the consumerMaxRate during the start time and that works fine too. I want to change this parameter on the fly to increase / decrease the rate of consumption without stopping my application. I have tried by re-initializing the beans, setting the activemqconnectionfactories again but somehow the connection is maintained with the initial value only.
Any suggestion would be helpful.
I have tried searching the documentation but it only says about the parameter but with no examples.
The consumerMaxRate cannot be changed while the connection to the broker is active. You'd need to close the connection, set a new consumerMaxRate, and then create a connection with the new configuration.

Can JMS Messaging be performed on quarkus using Apache camel routes?

Sorry for a naive question , just starting off with quarkus here. Since i read that quarkus already supports camel , is it possible to create a JMS route to send a message to a JMS queue ?
I also have some legacy services which use Database bean map handlers (apache commons db). If i include them as a part of quarkus ,can these still be deployed on GraalVM ?
The list of the component currently fully supported by camel-quarkus is listed here: https://github.com/apache/camel-quarkus/tree/master/extensions
Other components not listed here are working out of the box in JVM mode but some work may be required ot make them working as native image

In Spring Boot, How do I declare that my JMS server is embedded?

The Spring Boot documentation has this very brief illustration of an embedded JMS server: "Two beans that you don’t see defined are JmsTemplate and ConnectionFactory. These are created automatically by Spring Boot. In this case, the ActiveMQ broker runs embedded." Huh? The Reference Documentation doesn't say a thing about it. I need to create two VMs, each running from its own jar file, and I need one of them to launch an embedded JMS server, but I have no idea how to do this. Can somebody point me in the right direction. (If you provide a link, I would prefer some clear documentation over an example, but I'll be happy with a good example.)
You are looking at the wrong reference documentation. Yours is from Spring Integration.
The one of Spring Boot can be found here:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-activemq
And there you will find the answer:
When ActiveMQ is available on the classpath, Spring Boot can also
configure a ConnectionFactory. If the broker is present, an embedded
broker is automatically started and configured (provided no broker URL
is specified through configuration).

Transaction management in Spring: Does support come from Spring or container?

I am trying to understand the transaction management in Spring, and I have got some doubts.
I read a bit about transaction management in EJB world, which can be CMT or BMT. For CMT, as per the documentation, it is Application server (e.g. JBOSS) which manages the transaction.
Now, coming to Spring transaction management, and considering using Web container only (Apache Tomcat), how does this work?
Does Spring have its own transaction management with capability of handling local transaction and global transaction (which works with 2 phase commit). Do the actual support need to come by the underlying container (in this case Apache tomcat) or support from framework is sufficient?
I am not clear how all these pieces fit together.
Can anyone help me understand this?
Spring doesn't include any kind of transaction capability of its own, it only provides ways to connect to transaction functionality provided by the container or by standalone libraries.
If you run your application on Tomcat and don't provide any transaction manager libraries like bitronix, then you get only local jdbc transactions provided by the servlet container.
When you read the bullet points at https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/transaction.html notice it says spring is providing abstractions, that means it is providing access through its own apis and using aop to make transactions nonintrusive, but not providing any implementation of transactional functionality. It's facilitating gluing things together, which is the main thing spring does.

Best way to use JCA CCI connections - Alternative to Spring CCI Support

In our project we have a requirement to connect to IBM IMS and get data. Many of the existing applications are done it through code more coupled with IMS.
In one of the application we are using Spring CCI support and providing the CCIConnectionFactory to the JDBCTemplate and using it in a relational (kind of) manner.
However we are building a new application which is not using Spring framework. We are making use of JAVA CDI and it's aspects. But to integrate it with IMS through CCI I can see Spring is the best option. Anyone have experienced on this CCI connections? What way is the best you think? And any other frameworks in Java you are familiar with - apart from Spring's support?
Appreciate your help and input.
I had the same question 5 Month ago and it was very hard to collect information about jca. If your project works with wildfly or jboss take a look on my inbound-ra-example project. At first you must know what kind of resource adapter (RA) you need, inbound or outbound. In short, an inbound RA acts as a server for external data and send the data to a message driven bean. An outbound RA is called from an EJB via a connection factory and initiate the connection to the external information system. Read the readme.md of my example project. The inbound RA is much more difficult as an outbound RA. Generate the skeleton of your ra with the ironjacamar codegenerator. I described the process in my example project.

Resources