For a working demo a messaging system is needed (like RabbitMQ, ActiveMQ, ...).
The project shows how to do the following things:
- make a HTTP request via the SQL interface in SYSTOOLS
- put data on a remote message queue from a messaging system
- retrieve data from a remote message queue
- provide REST API to weather data
- web frontend to the weather data
This following service programs need to be installed (and all dependencies):
weatherdb.sql contains the SQL statement which builds the SQL table
for the weather data.
The installation script
setup is used to build the programs. It needs to know
where to install the objects. The variable
TARGET_LIB needs to hold the library
name for the objects. Set the library in the following way:
before executing the setup script.
As the programs rely on other libraries the place for the copybook needs to be stated.
- Insert some cities into the database table
The long Story
WEATHERGET retrieves the data from REST service and puts it on the
queue. By using the command
WEATHERGET the RPG program gets the parameters
passed correctly in contrast to making the call directly to the RPG program on
the command line which may mess up long parameters (more than 32 characters).
WEATHERGET COUNTRY(DE) CITY(Hamburg)
WEATHERSTO takes the data from the queue and stores it in the
database. It doesn't need any parameters.
WEATHERCTL can be used to start the whole application with just
one call (without any parameter). It selects all cities from the table
weather_cities) and starts
WEATHERGET for each every 15
minutes. It also starts the program to fetch the data from queue,
It creates a data area
WEATHER in the current library which controls the
lifecycle of the program. Just delete the data area to end the program (it is
checked for existence every 15 minutes).
WEATHERRS provides the REST services. It can be started without
any parameters. The REST service can be tested with