CICS and Node.js

Node.js is a server-side run time for applications that are written in JavaScript.

It has the following characteristics:
  • Event-driven - it listens for events such as an HTTP request and triggers a callback function when the event is detected.
  • Single-threaded - it processes one request at a time.
  • Non-blocking I/O - Reading and writing to I/O devices such as file systems, sockets, and databases occur asynchronously by using underlying support in z/OS®, triggering a callback function when it completes.

Node.js is lightweight, efficient, and best suited for data-intensive applications. It can use the underlying asynchronous I/O support in z/OS and provides a module-driven, highly scalable approach to application design and development that encourages agile practices.

It is steadily establishing its place within enterprises and becoming a favored choice for digital transformation due to its ability to provide and aggregate REST services.

A significant contributor to the popularity of Node.js is the abundance of Node.js modules, which are available on a public service registry and accessed by using the Node Package Manager (NPM). Modules are already available for most tasks, saving considerable time for Node.js application developers.

Node.js is developed by the Node.js Foundation whose goal is to encourage the adoption and development of Node.js and its related modules. For more information, see the Node.js Foundation website.

Calling CICS services from Node.js applications

Node.js applications are typically long-running, and process TCP/IP socket requests from multiple users. A Node.js runtime is started for each application. Multiple applications can be present in a CICS® region.

Node.js applications that run in CICS might need to invoke existing CICS applications. For example, a Node.js application might aggregate calls to existing business logic functions in order to provide a single service interface for a front-end application. Using existing business logic functions can leverage the proximity of Node.js application to the existing applications, avoiding the need for the front-end application to make several network calls. A Node.js application can also add functionality to existing business logic by calling external services, or by using NPM modules.

Node.js applications can call services hosted in CICS in order to invoke existing business logic. These could be JSON or SOAP web services, exposed by using CICS web services technology, or by using z/OS Connect. Node.js applications can call CICS services by using NPM modules that are used for making HTTP requests and for consuming JSON and SOAP web services. JSON web services are straightforward to consume by Node.js applications, as JSON is the native object format of JavaScript.

Alternatively, when a Node.js application is hosted in the same CICS region as a JSON web service it needs to call, a locally optimized transport can be used. This uses a cross-memory approach to call the service, avoiding the need for any interactions over the network. To use the locally optimized transport to call a CICS service, the Node.js application must use the ibm-cics-api module. The service must be exposed using CICS JSON web services technology, and suitable PIPELINE and URIMAP resources must exist. For more information see Calling CICS services.

Components

Figure 1. CICS support for Node.js applications
The flow of CICS support for Node.js applications