-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirstProcess.java
More file actions
63 lines (52 loc) · 1.89 KB
/
Copy pathFirstProcess.java
File metadata and controls
63 lines (52 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package swift.pex;
import com.intersystems.enslib.pex.*;
/**
* Simple Business Process implemented in Java.
* Receives a request and sends it to TargetConfigName.
*/
public class FirstProcess extends BusinessProcess {
/** TargetConfigName: production element name where message will be sent to */
public String TargetConfigName;
/** Timeout when sending a message to TargetConfigName */
public String Timeout = "PT10S";
/**
* OnInit: Business Process initialization
*/
public void OnInit() throws Exception {
LOGINFO("FirstProcess:OnInit()");
// check settings
if (TargetConfigName == null) {
LOGWARNING("Missing TargetConfigName");
} else {
LOGINFO("TargetConfigname=" + TargetConfigName);
}
return;
}
/**
* OnRequest: handle the initiating incoming message
*/
public Object OnRequest(Object request) throws Exception {
LOGINFO("OnRequest");
SendRequestAsync(TargetConfigName, (Message)request, true); // ResponseRequired=true
SetTimer(Timeout, "HasTimedOut");
return null;
}
/**
* OnResponse: handle received responses
*/
public Object OnResponse(Object request, java.lang.Object response, Object callRequest, Object callResponse, String completionKey) throws Exception {
LOGINFO("OnResponse, CompletionKey=" + completionKey);
if (completionKey != "HasTimedOut") {
response = (FirstMessage) callResponse;
}
LOGINFO("Response:" + response.toString());
return response;
}
/**
* OnComplete: this is called after receiving responses for all requests sent to targets
*/
public Object OnComplete(java.lang.Object request, java.lang.Object response) throws java.lang.Exception {
LOGINFO("OnComplete");
return response;
}
}