IBM i RPA Sink Connector for Kafka
Overview
Companies that run their core systems of record on IBM i (formerly known as AS400, iSeries) are often dependent on their application vendors when they need to integrate these applications or automate manual user actions. The IBM i RPA Sink Connector for Kafka is an automation connector that runs directly as a Kafka Connect application. It simulates green-screen user actions such as navigation, data entry, and screen capture.
Use cases
You have several options for integrating and automating IBM i based applications. Robotic Process Automation (RPA) is a good fit for companies that can access the application only through the green-screen UI and have limited options for integrating at the application program or database level. If users have to key data into a legacy system manually, this step is a good candidate for automation.
RPA also helps with test automation, a scenario that is often overlooked. Companies often run manual feature and regression tests every time a change is introduced. Automating the regression tests can improve the quality of releases and reduce the risk of unintended changes in system behavior.
The following three common use cases address the majority of IBM i integration requirements:
- Executing a key string to perform an operation.
- Grabbing text from the IBM i screen.
- Executing a predefined Python macro script.
Executing a key string to perform an operation
- Enter
4,[enter],[enter],2,[enter],[enter],1,[enter],[enter],[SET_INFIELD 11 2],5,[enter],[enter]as the key string. - IBM i enters the strings and executes the keystrokes as if a user were doing it manually.
Grabbing text from the IBM i screen
- Enter
addlible muledemodk,[enter],addlible wtf400demo,[enter],[enter],call edtorder,[enter],[enter],[GET_SCREEN 9 10 10 3 output_test]as the key string. IBM i enters the strings and executes the keystrokes. - The module grabs the text in the area that begins at upper-left x-position 9 and upper-left y-position 10, with a width of 10 and a height of 3.
- The module stores the text in the
attributes.screenOutputsection of its output, in a HashMap under the keyoutput_test.
Executing a predefined Python macro script
- Place a file such as
test.pyin a location that the connector can access: a file path (for example/home/ubuntu/macro/test.py), a classpath location, or an S3 location. - Enter the file name
test.pyin the Macro File input field of the Execute Script module. In the macro output parameters input field, definetest_valueas a string. This string corresponds to the variable with the same name intest.py. - Enter
addlible muledemodk,[enter],addlible wtf400demo,[enter],[enter],call edtorder,[enter],[enter],[MACRO]as the key string. IBM i enters the strings and executes the keystrokes. - The module executes the script when it reaches the
[MACRO]keyword in the key string. - The output parameter is stored in a HashMap under the key
test_value.
Product features
- Automates manual green-screen operations and surfaces legacy IBM i applications as modern APIs.
- Simulates green-screen user actions directly from Kafka applications.
- Automates user screen navigation and data entry for IBM i screen (tn5250) applications.
- Supports a Python based script language for advanced screen navigation logic.
- Supports TLS (encrypted) connections.
License
The IBM i RPA Sink Connector for Kafka is offered under the GPL license (see GNU General Public License, Version 2). Infoview Systems, the company that developed this connector, offers commercial support for the product.
How it works
The Infoview IBM i RPA Sink Connector is a Kafka Connect plug-in. It opens an IBM i telnet (5250) session and executes a sequence of user actions: it navigates the screens, types data into display fields, presses function keys, and reads sections of the screen into variables.
The connector runs entirely within the Kafka Connect application and does not require any other software.
The connection configuration includes the credentials and the initial set of keystrokes that every session executes to reach the starting point of the screen navigation (for example, the Order Entry screen).
The connector operation executes the script (a series of keystrokes, macro executions, and so on) and passes the resulting variables back to the Kafka topic as a response.
Prerequisites
The connector works with IBM i objects (for example, programs and data queues). This document assumes that you are familiar with the IBM i operational and development environments and tools, and with Kafka, Kafka Connect, and Confluent Control Center. It provides configuration examples and explains each property required to run the connector in Confluent Control Center.
IBM i server configuration and requirements
- IBM i must have ports 449, 8470, 8472, 8473, 8475, 8476, 9470, 9472, 9473, 9475, and 9476 accessible from the Confluent runtime.
- IBM i must have the
*CENTRAL,*DTAQ,*RMTCMD,*SIGNON, and*SRVMAPhost servers running in theQSYSWRKsubsystem. - If you use a secure TLS connection, apply the TLS certificate to the Central, Data Queue, Remote Command, Sign on, and DDM / DRDA services in Digital Certificate Manager. See IBM i TLS Connection Configuration.
- The IBM i user ID must be authorized to perform the operations on the intended IBM i objects.
- If additional security software locks down remote execution, the IBM i user ID defined in the connector configuration must be allowed to execute remote calls and access database, IFS, and DDM services.
Dependencies
- Access to an IBM i server.
- Access to Kafka.
Compatibility matrix
| Application / Service | Version |
|---|---|
| Apache Kafka | 2.6.0 or higher |
| Confluent Kafka | 6.0.0 or higher |
| Confluent Control Center | 6.0.0 or higher |
| IBM i / OS400 | V5R4 or higher |
Connector operations
The connector is operation-based: when you add it to your Kafka Connect cluster, you configure the specific operation that the connector performs. The connector supports the following operation:
| Operation | Description |
|---|---|
| Execute script | Executes a given key string to perform tasks in IBM i, and/or runs a predefined Python macro to perform the tasks. |
Installation and setup
Contact us to request a link to download the connector. After you download it, follow the steps and recommendations for the evaluation of the InfoConnect for Kafka connector.
Macro file management
The connector may require a macro file to automate more complex operations such as conditional processing and loops.
The connector can load the macro (Python script) file with one of these protocols: S3, FILE, or CLASSPATH. Set the connector configuration parameters that match the protocol. The following sections describe the parameters for each protocol.
Macro file
Enter the name of the Python macro file that you placed in the location described in the protocol sections below. The module places the session variables, which hold all information about the current session, into the script beforehand. You can reference them as _session in the Python macro.
FILE protocol
The FILE protocol requires two values:
- Macro file path: the path to the macro file or Python script.
- Macro file name: the name of the macro file.

S3 protocol
The S3 protocol requires five values to access a file in S3:
- S3 bucket path.
- File name.
- S3 region.
- Access key.
- Secret key.

CLASSPATH protocol
The CLASSPATH protocol requires one value: the file name.

Macro file parameters by protocol
| Protocol | Parameter | Mandatory | Configuration key |
|---|---|---|---|
FILE |
Path | Required | as400.MacroFilePath |
FILE |
File name | Required | as400.MacroFileName |
S3 |
S3 bucket path | Required | s3.bucket |
S3 |
File name | Required | as400.MacroFileName |
S3 |
S3 region | Required | s3.region |
S3 |
Access key | Required | s3.accessKey |
S3 |
Secret key | Required | s3.secretKey |
CLASSPATH |
File name | Required | as400.MacroFileName |
IBM i RPA connection configuration properties
Connection

| Parameter | Description | Mandatory | Default value | Configuration key |
|---|---|---|---|---|
| Name | Unique label for the connector in your application. | Required | AS400RPASinkConnector_0 |
name |
| User Name | IBM i account user name for login. | Required | null |
as400.username |
| User Name X Position | X position of the user name entry field on the login screen. | Required | null |
as400.usernameXPosition |
| User Name Y Position | Y position of the user name entry field on the login screen. | Required | null |
as400.usernameYPosition |
| Password | IBM i account password for login. | Required | null |
as400.password |
| Password X Position | X position of the password entry field on the login screen. | Required | null |
as400.passwordXPosition |
| Password Y Position | Y position of the password entry field on the login screen. | Required | null |
as400.passwordYPosition |
| Initial Key String | Formatted key string that navigates IBM i to the desired screen after login. | Optional | null |
as400.initialKeyString |
| Host | IBM i endpoint. | Optional | localhost |
as400.host |
| Port | Port number of the IBM i endpoint. | Optional | -1 |
as400.port |
| SSL Type | SSL type of the IBM i endpoint, if it requires a secure connection. | Optional | None |
as400.sslType |
| Debug Mode | True prints the screen after every key press. False does not. |
Optional | False |
as400.debug |
| Num Attempts | Number of connection retries within the connector before the exception is raised to the Kafka runtime and connection management. | Optional | 1 |
as400.numAttempts |
| Time Between Attempts (ms) | Time between connection retry attempts. | Optional | 300 |
as400.TimeBetweenAttempts |
IBM i RPA Sink Connector configuration properties
Configure the following connector properties.

| Parameter | Description | Mandatory | Default value | Configuration key |
|---|---|---|---|---|
| Macro File Protocol | Protocol used to load the macro file. See Macro file management. | Optional | FILE |
as400.MacroFileProtocol |
| Key String | Comma-separated list of key strokes, input field locations, and input field text to execute on IBM i. See Key names and Special commands. | Required | null |
as400.keyString |
| Input Parameters | Key-value pairs that replace variables in the Key String. See Parameter mapping. | Optional | null |
as400.InputParameters |
| Sink Target Topic | Kafka topic to which the response is pushed after the Execute script operation. | Required | null |
sink.kafka.topic |
| Kafka Partition Key | Kafka partition key. | Optional | null |
sink.kafka.partition.key |
Sample connector configuration
{
"name": "AS400RPASinkConnectorConnector_0",
"config": {
"connector.class": "com.infoviewsystems.kafka.connect.as400.rpa.core.AS400RPASinkConnector",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"topics": "RPA",
"as400.host": "172.20.34.10",
"as400.username": "OROWADER",
"as400.usernameXPosition": "53",
"as400.usernameYPosition": "8",
"as400.password": "DOAROW07",
"as400.passwordXPosition": "53",
"as400.passwordYPosition": "9",
"as400.initialKeyString": "addlible apanda,[enter],[enter],addlible infocdccom,[enter],[enter]",
"as400.port": "-1",
"as400.sslType": "NONE",
"as400.debug": "true",
"as400.numAttempts": "1",
"as400.TimeBetweenAttempts": "300",
"as400.MacroFileProtocol": "FILE",
"as400.MacroFilePath": "/home/apeksha/macro",
"as400.MacroFileName": "addItems.py",
"as400.KeyString": "call cdcordcmtc,[enter],[SET_INFIELD 29 10],:<uri>,[enter],[enter],[pf6],[MACRO],[pf10],[GET_SCREEN 15 4 8 1 orderNum],[GET_SCREEN 2 24 13 1 orderStatus],[pf12],[pf3]",
"as400.InputParameters": "uri=orderId",
"sink.kafka.topic": "sinktopic",
"value.converter.schemas.enable": "false"
}
}
Key names
The following table lists the standard key codes that the connector supports. Enter the keys exactly as listed. Separate each key, literal, variable, and special command with a comma.
| Key code | Description |
|---|---|
[backspace] |
Back Space |
[backtab] |
Back Tab |
[up] |
Cursor Up |
[down] |
Cursor Down |
[left] |
Cursor Left |
[right] |
Cursor Right |
[delete] |
Delete |
[tab] |
Tab |
[eof] |
End of Field |
[eraseeof] |
Erase EOF |
[erasefld] |
Erase Field |
[insert] |
Insert |
[home] |
Home |
[keypad0] |
Keypad 0 |
[keypad1] |
Keypad 1 |
[keypad2] |
Keypad 2 |
[keypad3] |
Keypad 3 |
[keypad4] |
Keypad 4 |
[keypad5] |
Keypad 5 |
[keypad6] |
Keypad 6 |
[keypad7] |
Keypad 7 |
[keypad8] |
Keypad 8 |
[keypad9] |
Keypad 9 |
[keypad.] |
Decimal |
[keypad,] |
Comma |
[keypad-] |
Keypad minus |
[fldext] |
Field Exit |
[field+] |
Field Plus |
[field-] |
Field Minus |
[bof] |
Beginning of Field |
[enter] |
Enter |
[pf1] |
F1 |
[pf2] |
F2 |
[pf3] |
F3 |
[pf4] |
F4 |
[pf5] |
F5 |
[pf6] |
F6 |
[pf7] |
F7 |
[pf8] |
F8 |
[pf9] |
F9 |
[pf10] |
F10 |
[pf11] |
F11 |
[pf12] |
F12 |
[pf13] |
F13 |
[pf14] |
F14 |
[pf15] |
F15 |
[pf16] |
F16 |
[pf17] |
F17 |
[pf18] |
F18 |
[pf19] |
F19 |
[pf20] |
F20 |
[pf21] |
F21 |
[pf22] |
F22 |
[pf23] |
F23 |
[pf24] |
F24 |
[clear] |
Clear |
[pgup] |
Page Up |
[pgdown] |
Page Down |
[rollleft] |
Roll Left |
[rollright] |
Roll Right |
Special commands
[MACRO]executes the macro file. Specify the macro file name in the Macro File Name parameter. Example:[MACRO].[SET_INFIELD x y]positions the cursor on the input field at column x, row y.[GET_SCREEN x y length height variable-name]reads a rectangular screen area that starts at column x and row y, with a horizontal size oflengthcharacters and a vertical size ofheightcharacters. The output is stored invariable-nameand passed back into the Mule flow or script. In the Mule message, it is stored in theattributes.screenOutputfield as a Java HashMap. Example:[GET_SCREEN 9 10 10 3 output_test].
Key strokes are placed inside brackets, for example [enter]. A full list of valid key strokes is available in the tn5250j KeyMapper source, starting at line 67. Text to type into an input field is a plain string in the comma-separated list.
Full example of a key string:
Parameter mapping
To set the value of input fields dynamically, use the pattern :<variable-name> in the script. For example, the following snippet positions the cursor at column 29, row 10, inserts the content of the variable uri, and then sends the Enter key:
Define the variables in the Input Parameters section of the connector operation as a list of name and value pairs. In the Input Parameters property, key-value pairs replace the variables in the key string. For example, {"value": "4"} replaces :<value> in the key string. In a Mule flow, you can map the value of a variable to a flow value, for example the customerId coming from the HTTP request:
Python macro example
from org.tn5250j.framework.tn5250 import Rect
print "--------------- tn5250j add items script start -------------"
textBox = Rect()
i = 9
for item in items:
field = _session.getScreen().getScreenFields().findByPosition(i-1, 2)
field.setString(str(item["ItemNo"]))
field = _session.getScreen().getScreenFields().findByPosition(i-1, 14)
field.setString(str(item["ItemName"]))
field = _session.getScreen().getScreenFields().findByPosition(i-1, 46)
field.setString(str(item["Quantity"]))
field = _session.getScreen().getScreenFields().findByPosition(i-1, 53)
field.setString(str(item["UnitPrice"]))
i = i + 1
_session.getScreen().sendKeys("[enter]")
_session.getScreen().sendKeys("[enter]")
print "---------------- tn5250j add items script end -------------"
In this example, the connector does the following:
- Executes a call to the order maintenance program and presses Enter.
- Sets the cursor to column 29, row 10, types the value of the variable
uri, and presses Enter twice. - Sends the F6 key event to navigate to a new screen.
- On the new screen, executes the Python macro, which receives the
itemsobject as macro input parameters. For each line item, the macro types the data into the appropriate input fields of the Add Order lines subfile and presses Enter. - After the order is entered, presses F10 to create the new order in the system.
- Retrieves the newly generated order ID and status from the specified screen positions.
- Returns to the Work with Orders screen to prepare for the next transaction.
Support
Contact the Infoview Systems Connector support team at (734) 293-2160 or (+91) 4042707110, or by email at sales@infoviewsystems.com or marketing@infoviewsystems.com.