-
Notifications
You must be signed in to change notification settings - Fork 0
/
notificator-config.html
179 lines (179 loc) · 7.77 KB
/
notificator-config.html
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="description" content="JobStreamer : JobStreamer site."/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.1.8/semantic.min.css" type="text/css"/>
<link rel="stylesheet" href="css/basic.css" type="text/css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/prism/1.5.0/themes/prism.css" type="text/css"/>
</head>
<body>
<div class="ui fixed inverted teal menu">
<div class="title item"><a href="./index.html"><b>Job Streamer</b></a></div>
</div>
<div/>
<div id="main_content_wrap" class="main ui grid content">
<div class="four wide column">
<div class="ui vertical fluid tabular menu">
<a class="item" href="get-started-quickly.html">
Getting Started
</a>
<div class="item">
<div class="header">Guide</div>
<div class="menu">
<a class="item" href="auth.html">
Authentication and authorization
</a>
<a class="item" href="deploy-batch-components.html">
Deploy batch components
</a>
<a class="item" href="create-a-job.html">
Create job
</a>
<a class="item" href="execute-the-job.html">
Execute job
</a>
<a class="item" href="schedule-job.html">
Schedule job
</a>
<a class="item" href="job-config.html">
Job config
</a>
<a class="item" href="notificator-config.html">
Notificator config
</a>
<a class="item" href="import-export.html">
Import and export
</a>
<a class="item" href="test-mode.html">
Test mode
</a>
<a class="item" href="healthcheck.html">
Healthcheck
</a>
</div>
</div>
<div class="item">
<div class="header">Components</div>
<div class="menu">
<a class="item" href="control-bus.html">
Control bus
</a>
<a class="item" href="agent.html">
Agent
</a>
<a class="item" href="console.html">
Management console
</a>
<a class="item" href="notificator.html">
Notificator
</a>
</div>
</div>
<div class="item">
<div class=" header">For contributers</div>
<div class="menu">
<a class="item" href="get-started-developer.html">
Getting Started for contributers
</a>
<a class="item" href="developer-guide.html">
Developer guide for contributers
</a>
</div>
</div>
</div> </div>
<div class="twelve wide stretched column">
<h1><a href="#notificator-config" name="notificator-config">Notificator config</a></h1><p>Please refer to <a href="./notificator.html">Notificator</a> about the Notificator.</p><h2><a href="#setting-file" name="setting-file">Setting file</a></h2><p>Setting file have to be edn format.<br/>It defines the behavior when a certain key is sent from the Control-bus.<br/>This setting will be reflected when this file is specified as the first argument of the Notificator (To be described later).</p><h3>Ex1: Send a job success mail.</h3>
<pre><code>{
:send-success-email {:uri "http://localhost:45102/default/job/success-mail/executions?Exchange.CONTENT_TYPE=application/edn"}
}
</code></pre><p>In this setting, the Notificator executes a job named “success-mail” by sending a POST request to “http://localhost:45102/default/job/success-mail/executions?Exchange.CONTENT_TYPE=application/edn” when Notificator receives :send-success-email key from the Control-bus.<br/>A job named “success-mail” needs to be made to send a success mail.</p><h3>Ex2: Send a job success mail by requesting to a smtp server.</h3>
<pre><code>{
:send-success-email {
:uri "smtp://[smtp-server-ip-address]:[email protected]&[email protected]&subject=success"
:message "success"
}
}
</code></pre><p>In this setting, the Notificator sends a request directly to the smtp server when Notificator receives :send-success-email key from the Control-bus.</p><h3><a href="#setting-edn-file-format" name="setting-edn-file-format">Setting edn file format</a></h3><p>Describe setting file in the following format.</p>
<pre><code>{:key1 {:uri "xxx"
:to "yyy"
:message "zzz"}
:key2 {...}
...
:keyx{...}}
</code></pre>
<ul>
<li>:uri - Describe the behavior when the Notificator receive a key.
<ul>
<li>It is equivalent to Apache Camel’s RouteBuilder#from.</li>
<li>Please refer to <a href="http://camel.apache.org/components.html">http://camel.apache.org/components.html</a> about behaviors you can set.</li>
</ul></li>
<li>:to - It is equivalent to Apache Camel’s RouteBuilder#to.</li>
<li>:message - It is equivalent to Apache Camel’s setBody.</li>
</ul><h2>Use Handlebars (template function)</h2><p>You can create templates such as mail bodies by using the Handlebars.<br/>For example, create a hbs file (success.hbs) like the following.</p>
<pre><code>Hello, your batch is {{exit-status}}!
end time is {{end-time}}
</code></pre><p>You can specify following keys in the hbs file.</p>
<table>
<thead>
<tr>
<th>Key name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>job-name</td>
<td>job name</td>
</tr>
<tr>
<td>start-time</td>
<td>start date time</td>
</tr>
<tr>
<td>end-time</td>
<td>finish date time</td>
</tr>
<tr>
<td>batch-status</td>
<td>batch status</td>
</tr>
<tr>
<td>exit-status</td>
<td>exit status</td>
</tr>
</tbody>
</table><p>And specify hbs file name (without extension) with “message-template” key.</p>
<pre><code>{
:send-success-email {
:uri "smtp://[smtp-server-ip-address]:[email protected]&[email protected]&subject=success"
:message-template "success"
}
}
</code></pre><p>Then a mail with the following body will be sent when the Notificator receives “:send-success-email” key.</p>
<pre><code>Hello, your batch is COMPLETED!end time is Sat Sep 17 01:09:29 JST 2016
</code></pre><h2><a href="#start-notificator" name="start-notificator">Start Notificator</a></h2><p>Start like the following.</p>
<pre><code>bin/notificator [edn file] [hbs file dir]
</code></pre><p>If you use multiple hbs files, put then in the same directory (hbs file dir).<br/>You can omit the second argument if you do not use the hbs file.</p>
</div>
</div>
<div class="ui inverted teal footer vertical segment">
<div class="container">
<div class="ui stackable divided relaxed grid">
<div class="sixteen wide column">
<p>Copyright @ 2015-2016 kawasima & contributors.</p>
<p>Released under the EPL license.</p>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/jquery/1.12.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/prism/1.5.0/prism.js"></script>
<script src="https://cdn.jsdelivr.net/prism/1.5.0/components/prism-java.min.js"></script>
<script src="https://cdn.jsdelivr.net/prism/1.5.0/components/prism-bash.min.js"></script>
<script src="https://cdn.jsdelivr.net/prism/1.5.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/semantic-ui/2.1.8/semantic.min.js"> </script>
</body>
</html>