-
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 S4_IMAGE=`pwd`'/build/s4-image'
export PYTHONPATH=${S4_IMAGE}/s4-driver/lib/python
export PERLLIB=${S4_IMAGE}/s4-driver/lib/perl
# Change script permissions.
chmod u+x $S4_IMAGE/scripts/*
chmod u+x $S4_IMAGE/s4-driver/scripts/*
# Copy speech02 app to apps deployment directory.
cp -fr $S4_IMAGE/s4-example-apps/s4-example-speech02 $S4_IMAGE/s4-apps
# Start S4 server in standalone mode.
$S4_IMAGE/scripts/start-s4.sh -r client-adapter &
# Start client adapter.
$S4_IMAGE/scripts/run-client-adapter.sh -s client-adapter -g s4 \
-x -d $S4_IMAGE/s4-core/conf/default/client-stub-conf.xml &
# Inject events.
perl $S4_IMAGE/s4-driver/scripts/inject.pl RawSpeech \
org.apache.s4.example.speech01.Speech < $S4_IMAGE/testinput/speech.in
perl $S4_IMAGE/s4-driver/scripts/inject.pl RawSentence \
org.apache.s4.example.speech01.Sentence < $S4_IMAGE/testinput/sentence.in
## Injecting Events with a Java Client
# Follow same steps as before to start S4 server and client adapter.
# Inject events.
$S4_IMAGE/s4-driver/scripts/inject.sh localhost 2334 RawSpeech \
org.apache.s4.example.speech01.Speech < $S4_IMAGE/testinput/speech.in
$S4_IMAGE/s4-driver/scripts/inject.sh localhost 2334 RawSentence \
org.apache.s4.example.speech01.Sentence < $S4_IMAGE/testinput/sentence.in
## Receiving Events
# Follow same steps as before to start S4 server and client adapter.
# Start a reader client.
perl $S4_IMAGE/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 S4_IMAGE=`pwd`'/build/s4-image'
export PYTHONPATH=${S4_IMAGE}/s4-driver/lib/python
export PERLLIB=${S4_IMAGE}/s4-driver/lib/perl
# Inject events.
perl $S4_IMAGE/s4-driver/scripts/inject.pl RawSpeech \
org.apache.s4.example.speech01.Speech < $S4_IMAGE/testinput/speech.in
perl $S4_IMAGE/s4-driver/scripts/inject.pl RawSentence \
org.apache.s4.example.speech01.Sentence < $S4_IMAGE/testinput/sentence.in
## Request-Response
# Example 1: query the prototype of the joiner (SentenceJoinPE)
# in the speech02 application.
python $S4_IMAGE/s4-driver/scripts/request.py '#sentenceJoinPE' \
'org.apache.s4.message.PrototypeRequest' < $S4_IMAGE/testinput/proto-query
# Example 2: request to a single PE from
python $S4_IMAGE/s4-driver/scripts/request.py '#sentenceJoinPE' \
'org.apache.s4.message.SinglePERequest' < $S4_IMAGE/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/