Difficulty: beginner
Estimated Time: 15 minutes

In this scenario you will learn more about developing Spring Boot applications using the Red Hat OpenShift Application Runtimes platform. We will be building a simple Spring Boot application which produces messages to and consumes messages from a JBOSS AMQ resource. AMQ provides fast, lightweight, and secure messaging for Internet-scale applications. AMQ components use industry-standard message protocols and support a wide range of programming languages and operating environments. AMQ gives you the strong foundation you need to build modern distributed applications.

In this scenario you learned about Spring Boot and how it can be used to create Message-driven applications using the JMS protocol. We will add additional scenarios that explain more how to build Spring Boot applications on OpenShift shortly, so check back to learn.openshift.com

To summarize: TODO

Additional Resources

More background and related information on Red Hat OpenShift Application Runtimes and Eclipse Vert.x can be found here:

  • Red Hat OpenShift Application Runtimes for Developers - Here you can get started with a project using different boosters and clone that project to your local computer. This also enables you to deploy your application on your own private OpenShift Container Platform or use OpenShift Online that is provided for free from Red Hat.
  • Project Snowdrop homepage - This site has a lot of details of the work that Red Hat is doing to make Spring work great on Kubernetes and OpenShift.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Spring Boot Messaging on RHOAR

Step 1 of 5

Step 1

Review the base structure of the application

For your convenience, this scenario has been created with a base project using the Java programming language and the Apache Maven build tool.

As you review the content, you will notice that there are a lot of TODO comments. Do not remove them! These comments are used as markers for later exercises in this scenario.

1. Add JMS Dependencies

To add Spring JMS to our project all we have to do is to add the following line in pom.xml

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-activemq</artifactId>
      <version>1.5.8.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>

Along with the JMS dependencies this starter also brings in the ActiveMQ Broker. The Broker manages connections to the Queue and acts as the mediator between the application and ActiveMQ. The jackson-databind dependency is for marshalling and unmarshalling the messages we will send. We will cover this later.

Right now the application will not compile because we are missing our Message object in the provided code. In our next step we'll fill in those required classes and we will be able to test it locally.

Congratulations

You have now successfully executed the first step in this scenario. In the next step we will setup the code necessary to send and receive JMS messages.

Terminal
Local Web Browser
OpenShift Console