Skip to content

Commit dc860c1

Browse files
committed
EventHubSupport
1 parent 2e664fa commit dc860c1

9 files changed

Lines changed: 225 additions & 285 deletions

ServiceBusJS/EventHubSamples.html

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2+
"http://www.w3.org/TR/html4/loose.dtd">
3+
<html>
4+
<head>
5+
6+
<!--minifyier: http://refresh-sf.com/yui/#output-->
7+
<title>Service Bus JavaScrcipt SDK QueueClient Test Page</title>
8+
<link rel="stylesheet" href="css/qunit-git.css" type="text/css" />
9+
<link rel="stylesheet" href="css/main.css" type="text/css" />
10+
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"> </script>
11+
<script src="Scripts/servicebusjssdk-1.2.min.js"></script>
12+
13+
<!-- Syntax Highlighter -->
14+
<link rel="stylesheet" href="css/shCore.css" type="text/css" /> <!-- SyntaxHighlighter CSS style -->
15+
<link rel="stylesheet" href="css/shThemeEclipse.css" type="text/css" /> <!-- SyntaxHighlighter ThemeStyle -->
16+
<script src="Scripts/shCore.js"></script> <!-- SyntaxHighlighter js file -->
17+
<script type="text/javascript" src="Scripts/shBrushJScript.js"></script> <!-- JS highlighting -->
18+
<!-- Syntax Highlighter -->
19+
20+
<script type="text/javascript">
21+
$(document).ready(function () {
22+
23+
var clear = function () {
24+
$("#result").html("");
25+
$("#msgId").html("");
26+
27+
}
28+
var queuePath = "hub43";
29+
30+
var ehClient = new EventHubClient(
31+
{
32+
'name': queuePath,
33+
'devicename': 'jssimulator', // This is by specification partition key.
34+
'namespace': "se2014",
35+
'sasKey': "HKcbwBtiF0SyGzKjvum0zXQoqpJF4TpZR5+sX8AW/bU=",
36+
'sasKeyName': "send_events",
37+
'timeOut': 10,
38+
});
39+
40+
41+
$("#btnSend").click(function () {
42+
43+
var eventBody = { "temperature": txtTemp.value, "area": txtArea.value };
44+
45+
var msg = new EventData(eventBody);
46+
47+
clear();
48+
49+
ehClient.sendMessage(msg, function (messagingResult) {
50+
$("#result").html(messagingResult.result);
51+
$("#eventData").html(JSON.stringify(eventBody));
52+
});
53+
});
54+
55+
});
56+
</script>
57+
</head>
58+
<body>
59+
<section class="container ">
60+
61+
<h1 id="qunit-header" class="sample-page-title">JavaScript ServiceBus EventHub Test Page</h1>
62+
<h2 id="qunit-banner" />
63+
64+
<div class="inner-wrapper">
65+
<div class="message-body">
66+
<p>Enter temperature value:</p>
67+
<input id="txtTemp" type="text" value="77">
68+
<p>Enter area:</p>
69+
<input id="txtArea" type="text" value="Frankfurt"><br />
70+
71+
<button id="btnSend">Send</button>
72+
73+
<button class="view-source-send"></button>
74+
75+
</div> <!--END: .message-body-->
76+
<br />
77+
<br />
78+
79+
80+
<div class="view-source-box-send">
81+
82+
<code>
83+
84+
85+
<pre class="brush: js">
86+
87+
// Demonstrates how to send event data to service bus event hub.
88+
// Here we set the Event Data body. This will be the event payload.
89+
eventBody = { "temperature": txtTemp.value, "area": txtArea.value };
90+
91+
// Note, EventData does not support properties.
92+
93+
// Message corresponds the EventData class from .NET SDK.
94+
var msg = new EventData(eventBody);
95+
96+
// This sends the message to the queue and registers the
97+
// the callback to receive the result.
98+
eventHubClient.sendMessage(msg, function (messagingResult) {
99+
$("#result").html(messagingResult.result);
100+
});
101+
102+
</pre>
103+
104+
105+
</code>
106+
107+
</div> <!-- END view-source-box -->
108+
109+
110+
<div class="message-wrapper">
111+
<p>Event Data:</p>
112+
<div id="eventData">
113+
</div><br />
114+
<p>Message Body:</p>
115+
<div id="result">
116+
</div><br />
117+
118+
119+
</div> <!-- END: .message-wrapper -->
120+
121+
<a href="index.html" class="back-btn">Go back</a>
122+
</div> <!-- END: .inner-wrapper -->
123+
124+
<footer class="inner-wrapper">
125+
126+
<div class="logo"><a href="http://www.daenet.eu/"><img src="./img/logo.png"></a></div>
127+
128+
</footer>
129+
130+
</section> <!-- END: .container -->
131+
<!-- View Source toggle -->
132+
133+
134+
<script>
135+
$(".view-source-receive").click(function () {
136+
$(".view-source-box-receive").toggle("slow");
137+
});
138+
</script>
139+
140+
<script>
141+
$(".view-source-send").click(function () {
142+
$(".view-source-box-send").toggle("slow");
143+
});
144+
</script>
145+
146+
147+
<script>
148+
$(".view-source-peeklock").click(function () {
149+
$(".view-source-box-peeklock").toggle("slow");
150+
});
151+
</script>
152+
153+
<script>
154+
$(".view-source-complete").click(function () {
155+
$(".view-source-box-complete").toggle("slow");
156+
});
157+
</script>
158+
159+
<script>
160+
$(".view-source-abandon").click(function () {
161+
$(".view-source-box-abandon").toggle("slow");
162+
});
163+
</script>
164+
165+
166+
167+
<!-- END:View Source toggle -->
168+
<!-- SyntaxHighlighter -->
169+
<script type="text/javascript">
170+
SyntaxHighlighter.all()
171+
</script> <!-- END: SyntaxHighlighter -->
172+
173+
</body>
174+
</html>

ServiceBusJS/QueueSamples.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
<link rel="stylesheet" href="css/main.css" type="text/css" />
1010
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"> </script>
1111

12-
<script src="Scripts/servicebussdk-1.0.js"></script>
13-
<!--<script src="Scripts/servicebusjssdk-1.0.min.js"></script>-->
12+
<script src="Scripts/servicebusjssdk-1.2.min.js"></script>
1413

1514
<!-- Syntax Highlighter -->
1615
<link rel="stylesheet" href="css/shCore.css" type="text/css" /> <!-- SyntaxHighlighter CSS style -->

0 commit comments

Comments
 (0)