Some organizations choose an un-managed environment over Java Platform, Enterprise Edition (Java EE) as their integration solution for simplicity and loose coupling. Spring, the open source application framework, is one such choice. As a result, Spring Boot, a suite of pre-configured frameworks and technologies based on the Spring framework, is becoming quite popular. Spring Boot makes it easy to create a Spring web application and have it up and running with little configuration.

Now the question is, can you access IMS™ transactions and data using microservices on Spring Boot? Can you process a synchronous callout request from IMS using Spring Boot?

The answer is a resounding YES!

Accessing IMS transactions and processing IMS callout requests

With the Spring Boot auto configuration feature from application.properties and some Java helper classes, you can make the IMS TM resource adapter work as if it were running in a Java EE application server. You will need to implement helper classes to provide services that a Java EE application server would normally provide, such as a connection pool manager. Because a Java EE resource adapter is used to run in a non-Java EE environment, a pool manager must be implemented and instantiated before a connection pool can be implemented.

For IMS synchronous callout requests, help classes are needed for a thread pool that provides the thread for running the message receivers and, as the callout messages arrive from IMS, running the business methods of the message-driven bean (MDB).

The following diagram shows how an IMS transaction can be accessed as a REST microservice on Spring Boot. A Spring application is implemented as a JSON endpoint for the IMS transaction. It also shows how an IMS application can call out to a service or a message bean on Spring Boot through the TM resource adapter.

Accessing IMS transactions and processing callout requests through the IMS TM resource adapter in Spring Boot.
Figure 1. Accessing IMS transactions and processing callout requests through the IMS TM resource adapter in Spring Boot

Accessing IMS data using a REST interface

For access to IMS data, you can use the Spring auto configuration feature and a simple REST interface to query IMS databases. To support a simple REST interface, the metadata for the database you want to query must be stored in the IMS catalog. This implementation requires the use of the IMS catalog and IMS Connect with Open Database Manager (ODBM) configured.

With the metadata stored in the IMS catalog, the HTTP request is able to receive the schema information from the IMS catalog in JSON format. Using the IMS Universal drivers, a query can be issued by passing the PSB name from the URL as the database name to the DataSource object for every request.

Accessing an IMS database via the IMS Universal driver in Spring Boot
Figure 2. Accessing an IMS database via the IMS Universal driver in Spring Boot

Spring Boot samples on GitHub

Samples covering the following three common use cases are available on IMS GitHub:

  • Accessing IMS TM: This example demonstrates how to call IMS transactions as microservices by using the IMS TM resource adapter, with connection pooling, in an un-managed environment.

    The sample project is a Maven project exported from Eclipse. It contains a sample implementation of a simple pool manager and a REST microservice. The sample demonstrates how a vector is used to store unused connections and how logging, pool initialization, synchronization, shutdown, and cleanup can be implemented.

  • Synchronous callout processing: This example demonstrates how to process a synchronous callout from IMS by using the IMS TM resource adapter and a message-driven bean in Spring Boot with Tomcat embedded.

    The sample project is also a Maven project exported from Eclipse. It demonstrates how you can implement helper classes to provide the needed thread pool, message listener, and logging.

  • Accessing IMS DB: This example demonstrates how to query an IMS database using the IMS Universal drivers.

    The sample project is a Maven project exported from Eclipse, containing a sample implementation of REST interfaces for generic queries to IMS databases. The helper classes demonstrate how to handle data source configuration and use Spring-provided functionality such as JdbcTemplate.

Summary

Check out these Spring Boot samples on IMS GitHub today! See how you can utilize the IMS TM resource adapter and the IMS Universal drivers to access IMS transactions and databases from un-managed environments. Detailed instructions are provided for each sample.

For a tutorial on Spring Boot, see Spring Boot basics on IBM developerWorks.

Join The Discussion

Your email address will not be published. Required fields are marked *