You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example code of how to use CICS event processing in the Java programming language
3
4
4
5
## Structure
6
+
5
7
The project consists of two Maven modules:
6
8
7
-
1. cics-eventprocessing-java-webapp - The Java source code for this example
8
-
2. cics-eventprocessing-java-bundle - The bundle definition for this example
9
+
1. cics-eventprocessing-java-webapp - the Java source code for this example
10
+
2. cics-eventprocessing-java-bundle - the bundle definition for this example
9
11
10
12
## Code Structure
11
-
The code is built into a WAR file, which can be deployed to a Liberty JVM server as a web application.
12
13
13
14
There are two Java classes:
14
15
15
-
1. EventEmitter.java - A servlet which emits CICS events
16
-
2. EventConsumer.java - Defines the program `EVNTCONS` which receives CICS events, see [Bundle Structure](#bundle_structure) for more details
16
+
1.[`EventEmitter.java`](./cics-eventprocessing-java/cics-eventprocessing-java-webapp/src/main/java/com/ibm/cicsdev/eventprocessing/EventEmitter.java) - a servlet that emits CICS events
17
+
2.[`EventConsumer.java`](./cics-eventprocessing-java/cics-eventprocessing-java-webapp/src/main/java/com/ibm/cicsdev/eventprocessing/EventConsumer.java) - the Java code to define the CICS program resource `EVNTCONS` and consume the CICS events
18
+
19
+
The code is built into a WAR file, packaged into a CICS bundle, and deployed to a Liberty JVM server as a web application.
17
20
18
21
## Bundle Structure
19
-
The CICS bundle contains several elements
20
22
21
-
1.`EVNT` - A transaction which targets the `EVNTCONS` program
22
-
2.`EVENTADAPTER` - An EP Adapter which starts the `EVNT` transaction
23
-
3.`EVENT` - An Event Binding which targets the `EVENTADAPTER` adpater
24
-
4. A WARBUNDLE containing the built Java WAR.
23
+
The CICS bundle contains the following elements:
24
+
25
+
1.[`EVNT.transaction`](./cics-eventprocessing-java/cics-eventprocessing-java/cics-eventprocessing-java-bundle/src/main/bundleParts/EVNT.transaction) - transaction which targets the `EVNTCONS` program
26
+
2.[`ACCOUNTADAPTER.epadapter`](./cics-eventprocessing-java/cics-eventprocessing-java/cics-eventprocessing-java-bundle/src/main/bundleParts/ACCOUNTADAPTER.epadapter) - event processing adapter which starts the `EVNT` transaction
27
+
3.[`ACCOUNT.evbind`](./cics-eventprocessing-java/cics-eventprocessing-java/cics-eventprocessing-java-bundle/src/main/bundleParts/ACCOUNTADAPTER.epadapter) - event binding which targets the `EVENTADAPTER` adpater
28
+
4.`WARBUNDLE` - Java WAR bundle is added when built
25
29
26
30
## Building
27
-
There are several ways to build this project. We suggest you build with a build toolkit such as Gradle or Maven:
31
+
32
+
There are several ways to build this project. We suggest you build with a build toolkit such as Gradle or Maven.
28
33
29
34
### Building with Gradle
35
+
30
36
Run the following command from the `cics-eventprocessing-java` directory:
31
37
32
38
```sh
@@ -36,51 +42,53 @@ Run the following command from the `cics-eventprocessing-java` directory:
36
42
This will compile the Java code, build a WAR file and package it and the EP adapter and Event binding into a CICS bundle as a ZIP file at `./cics-eventprocessing-java-bundle/build/distributions/cics-eventprocessing-java-bundle-0.0.1-SNAPSHOT.zip`
37
43
38
44
### Building with Maven
45
+
39
46
Run the following command from the `cics-eventprocessing-java` directory:
40
47
41
48
```sh
42
49
mvn verify
43
50
```
44
51
45
-
This will compile the Java code, build a WAR file and package it and the EP adapter and Event binding into a CICS bundle as a ZIP file at `.cics-eventprocessing-java-bundle/target/cics-eventprocessing-java-bundle-0.0.1-SNAPSHOT.zip`
52
+
This will compile the Java code, build a WAR file and package it and the EP adapter and Event binding into a CICS bundle as a ZIP file at `./cics-eventprocessing-java-bundle/target/cics-eventprocessing-java-bundle-0.0.1-SNAPSHOT.zip`
46
53
47
54
## Configuration
48
-
You'll need to define a Liberty JVM server with the name `DFHWLP`. This name can be modified in the `pom.xml` of the cics-eventprocessing-java-bundle module.
49
55
50
-
The Liberty JVM server will need the `cicsts:core-1.0`, `cicsts:link-1.0` and `servlet-3.1` features installed at minimum. A sample server.xml file is provided below
56
+
You will need to define a CICS Liberty JVM server with the name `DFHWLP`. This name can be modified in the `pom.xml` of the cics-eventprocessing-java-bundle module.
57
+
58
+
The Liberty JVM server will need the following features installed at a minimum: `cicsts:core-1.0` and `cicsts:link-1.0` and `servlet-3.1`. For example:
51
59
52
60
```xml
53
61
<servername="cics-eventprocessing-java">
54
-
<featureManager>
55
-
<feature>cicsts:core-1.0</feature>
56
-
<feature>cicsts:link-1.0</feature>
57
-
<feature>servlet-3.1</feature>
58
-
</featureManager>
62
+
<featureManager>
63
+
<feature>cicsts:core-1.0</feature>
64
+
<feature>cicsts:link-1.0</feature>
65
+
<feature>servlet-3.1</feature>
66
+
</featureManager>
59
67
60
68
<!-- More configuration -->
61
69
</server>
62
70
```
63
71
64
72
## Deploying
65
-
1. Upload the built bumdle ZIP file to zFS on your z/OS system (using FTP or similar)
66
-
2. Logon to zFS on your z/OS system (using SSH, OMVS or similar)
67
-
3. Extract the ZIP file contents (e.g.: `unzip /path/to/bundle.zip`)
68
-
4. On your CICS region, define a new `BUNDLE` resource with the `BUNDLEDIR` set to the extracted ZIP file contents
69
-
5. Install the `BUNDLE` resource
70
73
71
-
You can confirm the application has started by inquiring the state of the `BUNDLE` (using `CEMT INQUIRE BUNDLE` or similar SPI, or the CICS Explorer bundle view).
74
+
1. Upload the built bundle ZIP file to zFS on your z/OS system in binary using FTP, or similar
75
+
2. Logon to zFS on your z/OS system using SSH, OMVS, or similar
76
+
3. Extract the ZIP file contents, for example using command `unzip /path/to/bundle.zip`
77
+
4. In CICS, define a new `BUNDLE` resource with the `BUNDLEDIR` set to the extracted ZIP file contents, then install the `BUNDLE` resource
78
+
79
+
You can confirm the application has started by inquiring the state of the `BUNDLE`, for example using transaction `CEMT INQUIRE BUNDLE`, or the CICS Explorer bundle view.
72
80
73
81
A message will be written to the Liberty `messages.log` file to confirm the application has started, and the base URL for this application.
74
82
75
83
## Running
84
+
76
85
1. Use a browser to target the address http://my.zos:9080/cics-eventprocessing-java-webapp/emit?name=EVENT replacing `my.zos` with the hostname of your z/OS system and `9080` with the port the Liberty JVM server is listening on.
77
86
2. View the JVM server CURRENT.STDOUT file, this should contain two log messages
78
87
* Emitted event
79
88
* Consumed event
80
89
81
-
You can also emit an event using `EXEC CICS SIGNAL EVENT(EVENT)` either in another CICS program, or using the `CECI` transaction.
82
-
90
+
You can also emit an event using `EXEC CICS SIGNAL EVENT(event)` either in another CICS program, or using transaction `CECI`.
83
91
84
92
## License
85
-
This project is licensed under [Eclipse Public License - v 2.0](LICENSE).
86
93
94
+
This project is licensed under [Eclipse Public License - v 2.0](LICENSE).
0 commit comments