-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev-notes.txt
131 lines (90 loc) · 3.63 KB
/
dev-notes.txt
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
### Run client examples.
## Injecting Events with a Perl Client
# Create a directory for all the s4 project repositories.
mkdir s4project
cd s4project
# Clone repo.
git clone [email protected]:s4/s4.git
# Build it!
cd s4
gradlew clean allImage
# Create some environment variables.
export IMAGE_BASE=`pwd`'/build/s4-image'
export PYTHONPATH=${IMAGE_BASE}/s4-driver/lib/python
export PERLLIB=${IMAGE_BASE}/s4-driver/lib/perl
# Change script permissions.
chmod u+x $IMAGE_BASE/scripts/*
chmod u+x $IMAGE_BASE/s4-driver/scripts/*
# Copy speech02 app to apps deployment directory.
cp -fr $IMAGE_BASE/s4-example-apps/s4-example-speech02 $IMAGE_BASE/s4-apps
# Start S4 server in standalone mode.
$IMAGE_BASE/scripts/s4-start.sh -r client-adapter &
# Start client adapter.
$IMAGE_BASE/scripts/run-client-adapter.sh -s client-adapter -g s4 \
-x -d $IMAGE_BASE/s4-core/conf/default/client-stub-conf.xml &
# Inject events.
perl $IMAGE_BASE/s4-driver/scripts/inject.pl RawSpeech \
io.s4.example.speech01.Speech < $IMAGE_BASE/testinput/speech.in
perl $IMAGE_BASE/s4-driver/scripts/inject.pl RawSentence \
io.s4.example.speech01.Sentence < $IMAGE_BASE/testinput/sentence.in
## Injecting Events with a Java Client
# Follow same steps as before to start S4 server and client adapter.
# Inject events.
$IMAGE_BASE/s4-driver/scripts/inject.sh localhost 2334 RawSpeech \
io.s4.example.speech01.Speech < $IMAGE_BASE/testinput/speech.in
$IMAGE_BASE/s4-driver/scripts/inject.sh localhost 2334 RawSentence \
io.s4.example.speech01.Sentence < $IMAGE_BASE/testinput/sentence.in
## Receiving Events
# Follow same steps as before to start S4 server and client adapter.
# Start a reader client.
perl $IMAGE_BASE/s4-driver/scripts/read.pl \
'{
readMode => "select",
readInclude => ["SentenceJoined"]
}'
# In a different window, inject messages like in the previous section.
# Remember to initialize the environment variables in the new shell.
export IMAGE_BASE=`pwd`'/build/s4-image'
export PYTHONPATH=${IMAGE_BASE}/s4-driver/lib/python
export PERLLIB=${IMAGE_BASE}/s4-driver/lib/perl
# Inject events.
perl $IMAGE_BASE/s4-driver/scripts/inject.pl RawSpeech \
io.s4.example.speech01.Speech < $IMAGE_BASE/testinput/speech.in
perl $IMAGE_BASE/s4-driver/scripts/inject.pl RawSentence \
io.s4.example.speech01.Sentence < $IMAGE_BASE/testinput/sentence.in
## Request-Response
# Example 1: query the prototype of the joiner (SentenceJoinPE)
# in the speech02 application.
python $IMAGE_BASE/s4-driver/scripts/request.py '#sentenceJoinPE' \
'io.s4.message.PrototypeRequest' < $IMAGE_BASE/testinput/proto-query
# Example 2: request to a single PE from
python $IMAGE_BASE/s4-driver/scripts/request.py '#sentenceJoinPE' \
'io.s4.message.SinglePERequest' < $IMAGE_BASE/testinput/pe-query
-------
### How to set up dev environment for application developer.
# Create project dir.
mkdir myapp
cd myapp
export MYAPP_BASE=`pwd`
mkdir lib
# Create directory for s4 images.
cd SOME_DIR
mkdir s4images
cd s4images
# Download S4 binary distribution.
# put a command here to download bin tgz file.
# Extract image from tgz file.
tar xvzf s4-0.3-SNAPSHOT-bin.tgz
rm -f s4-0.3-SNAPSHOT-bin.tgz
cd s4-0.3-SNAPSHOT
export S4_IMAGE=`pwd`
# The build script will expect to find the S4_IMAGE env variable.
### Using Eclipse
# Configure Gradle as an external configuration in Eclipse:
# http://docs.codehaus.org/display/GRADLE/Running+Gradle+from+Eclipse
# To edit the build.gradle file use the Groovy editor.
# 1. Install Groovy Eclipse plugin.
# 2. Right click on the "build.gradle" file.
# 3. Select Open With -> Other -> Groovy Editor
More info. Gradle screencasts:
http://www.gradlecasts.org/