Home Applications iris-interoperability-template

iris-interoperability-template

Supported by InterSystems Corporation
4.5
2 reviews
0
Awards
1.2k
Views
74
IPM installs
4
2
Details
Releases
Reviews  (2)
Issues
Articles  (5)
Dependencies  (3)
InterSystems IRIS interoperability template: a simple interoperability application which reads data from Reddit and filters it.

What's new in this version

Automatic version update

Gitter
Quality Gate Status
Reliability Rating

iris-interoperability-template

This is a template of InterSystems IRIS Interoperability solution.
It contains a simple interoperablity solution which reads data from Reddit, filters it and outputs into file or sends via email.

What The Sample Does

This sample has an interoperability production with an inbound Reddit Adapter which is used by a Business Service to read data from Reddit.com.
It reads from reddit.com/new/.json every 15 sec.
You can alter both the URL and frequency in the service’s settings.
Screenshot 2020-10-29 at 19 33 14

The production has a business process with a rule, which filters on news that mentions cats and dogs. The business process then sends this data to a business operation which either saves data to a source folder /output/Dog.txt or /output/Cat.txt.
Screenshot 2020-10-29 at 19 38 58

Prerequisites

Make sure you have git and Docker desktop installed.

Installation: ZPM

Open IRIS Namespace with Interoperability Enabled.
Open Terminal and call:
USER>zpm “install interoperability-sample”

Installation: Docker

Clone/git pull the repo into any local directory

$ git clone https://github.com/intersystems-community/iris-interoperability-template.git

Open the terminal in this directory and run:

$ docker-compose build
  1. Run the IRIS container with your project:
$ docker-compose up -d

How to Run the Sample

Open the production and start it.
It will start gathering news from reddit.com/new/ and filter it on cats and dogs into /output/Dog.txt or /output/Cat.txt files.

You can alter the business rule to filter for different words, or to use an email operation to send posts via email.
Screenshot 2020-10-29 at 20 05 34

How to alter the template

Use the green “Use this template” button on Github to copy files into a new repository and build a new IRIS interoperability solution using this one as an example.

This repository is ready to code in VSCode with the ObjectScript plugin.
Install VSCode, Docker and ObjectScript plugin and open the folder in VSCode.

Use the handy VSCode menu to access the production and business rule editor and run a terminal:
Screenshot 2020-10-29 at 20 15 56

environment variables usage

this example shows how you can introduce env variables in your dev environment.
Suppose you need to setup the production with some secret token to access a limited access API.
Of course you don’t want to expose the secret to GitHub.
In this case Env variables mechanism could be helpful.
First introduce .env file and setup .gitignore to filter .env from git.

Then add the secret token in .env in a form ENV_VARIABLE=“TOKEN VALUE”

Next introduce make environment variables be imported to dockerfile. to make it work add the environment section into docker-compose.yml, .e.g:

environment:
      - SAMPLE_TOKEN=${SAMPLE_TOKEN}

Then you’ll be able to init the running container with the data from env variables e.g. with the following call, which uses the value from .env file as a setting of the production:

USER> d ##class(dc.Demo.Setup).Init($system.Util.GetEnviron("SAMPLE_TOKEN"))

package manager production parameters

the users (not developers) of the module you developed can use parameters to pass to the module during installation and setup it.
it can be useful when setup parameters are secret tokens to access particular API.
You as a developer can provide such a parameter setting with default tag of module XML, e.g. it is done in this module.xml example:

<Default Name="SampleToken" Value="TokenValue" />

This default parameter lets users to call the installation of the package with the option of passing of parameter (SampleToken in this case). E.g. the installation call could be run as:

USER>zpm "install interoperability-sample -D SampleToken=TokenSecretValue"

And the token value is being used then to setup the production in the following call:

<Invoke Class="dc.Demo.Setup" Method="Init" >
         <Arg>${SampleToken}</Arg>
      </Invoke>
Made with
Install
zpm install interoperability-sample download archive
Version
0.3.312 Mar, 2024
ObjectScript quality test
Category
Template
Works with
InterSystems IRISInterSystems IRIS for Health
First published
29 Oct, 2020
Last checked by moderator
23 Jul, 2024Works