Home » Tag Archives: JMS

Tag Archives: JMS

Beware of slow transaction callbacks in Spring

spring-interview-questions-answers

TL;DR If your application is failing to obtain new database connection, restarting ActiveMQ broker may help. Interested? The problem with performance Few months ago we experienced a production outage. Many requests were failing with all too familiar: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30003ms. at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:555) ~[HikariCP-2.4.7.jar:na] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:188) ~[HikariCP-2.4.7.jar:na] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:147) ~[HikariCP-2.4.7.jar:na] at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:99) ...

Read More »

Building a horizontal JMS Bridge between two WildFly Servers using ActiveMQ Artemis

Sometimes it’s necessary to connect different Message Brokers together. In Enterprise Messaging this scenario is known as Bridging. It can be done with JMS and different protocols like AMQP,  ActiveMQ Artemis core protocol. This blogpost focusses on Bridging with JMS and two Apache ActiveMQ Artemis Brokers running which are running in WildFly. What’s a JMS Bridge? JMS Bridges typically are ...

Read More »

RabbitMQ retries using Spring Integration

I recently read about an approach to retry with RabbitMQ here and wanted to try a similar approach with Spring Integration, which provides an awesome set of integration abstractions. TL;DR the problem being solved is to retry a message(in case of failures in processing) a few times with a large delay between retries(say 10 mins +). The approach makes use of ...

Read More »

Remote JMS with WildFly Swarm

I’m blogging about WildFly swarm again? Short version is: I needed a test for remote JMS access and refused to setup something complex like a complete application server. The idea was to have a simple WildFly Swarm application which has a queue and a topic configured. Both should be accessible remotely from a standalone Java application. While the topic receives ...

Read More »

Message Durability in ActiveMQ 5.x

I get asked quite a bit to explain the basics of how ActiveMQ works with respect to how it stores messages (or doesn’t in some cases). Here’s the high level explanation of it. Note, the context is within JMS. If you use ActiveMQ’s non JMS clients (ie, STOMP, AMQP, MQTT, etc) then the behavior may be different in some cases. ...

Read More »

AWS SQS and Spring JMS integration

spring-interview-questions-answers

Amazon WEB Services provide us with the SQS messaging service. The java sdk for sqs is compatible with JMS. Therefore instead of using SQS as a simple spring bean we can integrate it with the JMS integration framework that spring provides. I will use spring-boot and gradle. The gradle file: group 'com.gkatzioura.sqstesting' version '1.0-SNAPSHOT' buildscript { repositories { mavenCentral() } ...

Read More »

Automated provisioning of JMS resources in Java EE 7

java-interview-questions-answers

JMS 2.0 (part of the Java EE 7 Platform) introduced lots of nice features. One of these was the ability to declare JMS resources for automatic deployment. Pre Java EE 7 Inject Connection Factory using @Resource Lookup Destination (Queue/Topic) using @Resource Pull out the Session object and use it to create the Message, Message Producer and send the message Most ...

Read More »

JMS Sender application with ActiveMQ and Maven

We have already seen how to create a JMS Receiver application with ActiveMQ and Maven. Let’s check out how we can similarly create the JMS Sender application. web.xml remains the same as we had used for creating the receiver application: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/jmsContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> </web-app> jmsContext.xml would change a bit to something like: ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns