Skip to content

Commit 248c183

Browse files
author
David Witherspoon
authored
Merge pull request kaazing#1 from dpwspoon/develop
Feature/first implementation (kaazing#1)
2 parents 0dd4a64 + 4f7b7e3 commit 248c183

48 files changed

Lines changed: 1419 additions & 72 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
# basic
22
*~
3-
target
4-
GTAGS
5-
GRTAGS
6-
GPATH
7-
prop
8-
out
93
.DS_Store
104
.idea
115
*.iml
@@ -14,71 +8,5 @@ out
148
.settings
159
*.sublime-project
1610
*.sublime-workspace
17-
build-local.properties
1811
.gradle
19-
build
20-
21-
# Github java basic
22-
*.class
23-
24-
# Mobile Tools for Java (J2ME)
25-
.mtj.tmp/
26-
27-
# Package Files #
28-
*.jar
29-
*.war
30-
*.ear
31-
32-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
33-
hs_err_pid*
34-
35-
### Xcode ###
36-
*.pbxuser
37-
!default.pbxuser
38-
*.mode1v3
39-
!default.mode1v3
40-
*.mode2v3
41-
!default.mode2v3
42-
*.perspectivev3
43-
!default.perspectivev3
44-
xcuserdata
45-
*.xccheckout
46-
*.moved-aside
47-
DerivedData
48-
*.xcuserstate
49-
50-
### Flex project ###
51-
.actionScriptProperties
52-
.flexProperties
53-
54-
### C ###
55-
# Object files
56-
*.o
57-
*.ko
58-
*.obj
59-
*.elf
60-
61-
# Precompiled Headers
62-
*.gch
63-
*.pch
64-
65-
# Libraries
66-
*.lib
67-
*.a
68-
*.la
69-
*.lo
70-
71-
# Shared objects (inc. Windows DLLs)
72-
*.dll
73-
*.so
74-
*.so.*
75-
*.dylib
76-
77-
# Executables
78-
*.exe
79-
*.out
80-
*.app
81-
*.i*86
82-
*.x86_64
83-
*.hex
8412

AMQP/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# AMQP
2+
3+
![amqp](amqp.png)
4+
5+
The gateway can be configured as an AMQP proxy, talking to a backend AMQP broker and allowing websocket AMQP client to connect. Example configurations are shown for:
6+
7+
* [RabbitMQ](rabbitmq)
8+
* QPID (coming soon)

AMQP/amqp.png

33 KB
Loading

AMQP/rabbitmq/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# RabbitMQ AMQP Proxy
2+
3+
This tutorial shows how to connect websocket clients to AMQP
4+
5+
### Getting Started
6+
7+
To run this you must have installed docker and have added a host file entry for kaazing.example.com, as described [here](../../README.md)
8+
9+
The [docker-compose.yml](docker-compose.yml) describes two containers it will run: the gateway and the RabbitMQ broker. These will be launched in the following configuration
10+
11+
![AMQP architecture](../amqp.png)
12+
13+
The gateway container will run a amqp.proxy service that allows WebSocket clients to connect on the front end. Clients will connect on a "wss" address which denotes a TLS secured websocket url. The [gateway config file](gateway/amqp-rabbitmq-gateway-config.xml) is configured with an amqp.proxy service as follows:
14+
15+
```xml
16+
<service>
17+
<name>AMQP Tutorial Service</name>
18+
<description>A service that proxys to an AMQP backend</description>
19+
<accept>wss://kaazing.example.com:8000/</accept>
20+
<connect>tcp://rabbitmq:5672</connect>
21+
22+
<type>amqp.proxy</type>
23+
24+
<cross-site-constraint>
25+
<!-- Only websockets coming from this origin can access this url -->
26+
<allow-origin>https://kaazing.example.com:8000/</allow-origin>
27+
</cross-site-constraint>
28+
</service>
29+
```
30+
31+
### Run
32+
33+
1. Start the containers
34+
```bash
35+
docker-compose up -d
36+
```
37+
38+
2. Connect to the gateway in a web browser via [https://kaazing.example.com:8000/](https://kaazing.example.com:8000/). You may see a security error saying the certificate is not trusted. This is because we are using a self-signed certificate. Proceed anyways (in chrome this is under the advanced drop down displayed). This will temporarily add the generated self-signed certificate to you truststore.
39+
40+
3. Change the connect url of the demo to `wss://kaazing.example.com:8000/` and connect
41+
42+
4. Subscribe/Publish AMQP messages as desired
43+
44+
### Next Steps
45+
46+
- Configure AMQP for high availability (Example coming soon)
47+
- [Secure your AMQP infrastructure with Enterprise Shield](../../enterprise-shield)

AMQP/rabbitmq/broker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM rabbitmq:3

AMQP/rabbitmq/docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: '2'
2+
services:
3+
gateway:
4+
build: gateway
5+
ports:
6+
- "8000:8000"
7+
hostname: "kaazing.example.com"
8+
rabbitmq:
9+
build: broker

AMQP/rabbitmq/gateway/Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM kaazing/enterprise-gateway:latest
2+
3+
# Generate Keystore entry for kaazing.example.com
4+
5+
RUN keytool -genkeypair -keystore conf/keystore.db -storetype JCEKS -keypass ab987c -storepass ab987c -alias kaazing.example.com -keyalg RSA -dname "CN=kaazing.example.com, OU=Example, O=Example, L=Mountain View, ST=California, C=US"
6+
7+
# Add and Build Javascript Client tutorials to web directory so we can test it from a browser,
8+
# TODO pull in built tutorials when they are released
9+
10+
RUN set -ex \
11+
&& for key in \
12+
9554F04D7259F04124DE6B476D5A82AC7E37093B \
13+
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
14+
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
15+
FD3A5288F042B6850C66B31F09FE44734EB7990E \
16+
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
17+
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
18+
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
19+
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
20+
; do \
21+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
22+
done
23+
24+
ENV NODE_VERSION 0.10.45
25+
26+
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
27+
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
28+
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
29+
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
30+
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
31+
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt
32+
33+
RUN git clone https://github.com/kaazing/javascript.client.tutorials ./web/javascript.client.tutorials
34+
RUN npm --prefix ./web/javascript.client.tutorials/amqp install ./web/javascript.client.tutorials/amqp
35+
36+
# Add rabbitmq client libs
37+
ADD https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_6_2/rabbitmq-java-client-bin-3.6.2.tar.gz lib/ext/
38+
39+
# Add gateway config
40+
COPY amqp-rabbitmq-gateway-config.xml conf/gateway-config.xml
41+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<gateway-config xmlns="http://xmlns.kaazing.org/2015/11/gateway">
3+
4+
<service>
5+
<name>Directory Service</name>
6+
<description>
7+
Directory Service to serve up secure pages with, file
8+
in web directory are available via https
9+
</description>
10+
11+
<accept>https://kaazing.example.com:8000/</accept>
12+
13+
<type>directory</type>
14+
15+
<properties>
16+
<directory>/javascript.client.tutorials/amqp</directory>
17+
<welcome-file>index.html</welcome-file>
18+
</properties>
19+
</service>
20+
21+
<service>
22+
<name>AMQP Tutorial Service</name>
23+
<description>A service that proxys to an AMQP backend</description>
24+
<accept>wss://kaazing.example.com:8000/</accept>
25+
<connect>tcp://rabbitmq:5672</connect>
26+
27+
<type>amqp.proxy</type>
28+
29+
<cross-site-constraint>
30+
<!-- Only websockets coming from this origin can access this url -->
31+
<allow-origin>https://kaazing.example.com:8000/</allow-origin>
32+
</cross-site-constraint>
33+
</service>
34+
35+
<security>
36+
<keystore>
37+
<type>JCEKS</type>
38+
<file>keystore.db</file>
39+
<password-file>keystore.pw</password-file>
40+
</keystore>
41+
</security>
42+
43+
</gateway-config>

JMS/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# JMS
2+
3+
![jms](jms.png)
4+
5+
The gateway can be configured as a frontend for JMS, talking to a backend JMS broker and allowing websocket JMS clients to connect. Example configurations are shown for:
6+
7+
* [ActiveMQ](activemq)
8+
* IBM WebSphere / IBMQ (example coming soon)
9+
* Amazon SQS JMS Adapter (example coming soon)

JMS/activemq/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# JMS/ActiveMQ with Kaazing Gateway
2+
3+
This tutorial shows how to connect websocket clients to JMS
4+
5+
### Getting Started
6+
7+
To run this you must have installed docker and have added a host file entry for kaazing.example.com, as described [here](../../README.md)
8+
9+
The [docker-compose.yml](docker-compose.yml) describes two containers it will run: the gateway and the ActiveMQ broker. These will be launched in the following configuration
10+
11+
![JMS architecture](../jms.png)
12+
13+
The gateway container will run a jms service that allows WebSocket clients to connect on the front end. Clients will connect on a "wss" address which denotes a TLS secured websocket url. The [gateway config file](gateway/jms-activemq-gateway-config.xml) is configured with a jms service as follows:
14+
15+
```xml
16+
<service>
17+
<name>JMS Tutorial Service</name>
18+
<description>A service that proxys to an JMS backend</description>
19+
<accept>wss://kaazing.example.com:8000/</accept>
20+
21+
<type>jms</type>
22+
23+
<properties>
24+
<connection.factory.name>ConnectionFactory</connection.factory.name>
25+
<context.lookup.topic.format>dynamicTopics/%s</context.lookup.topic.format>
26+
<context.lookup.queue.format>dynamicQueues/%s</context.lookup.queue.format>
27+
<env.java.naming.factory.initial>org.apache.activemq.jndi.ActiveMQInitialContextFactory</env.java.naming.factory.initial>
28+
<env.java.naming.provider.url>tcp://activemq:61616</env.java.naming.provider.url>
29+
</properties>
30+
31+
<cross-site-constraint>
32+
<!-- Only websockets coming from this origin can access this url -->
33+
<allow-origin>https://kaazing.example.com:8000/</allow-origin>
34+
</cross-site-constraint>
35+
</service>
36+
```
37+
38+
### Run
39+
40+
1. Start the containers
41+
```bash
42+
docker-compose up -d
43+
```
44+
45+
2. Connect to the gateway in a web browser via [https://kaazing.example.com:8000/](https://kaazing.example.com:8000/). You may see a security error saying the certificate is not trusted. This is because we are using a self-signed certificate. Proceed anyways (in chrome this is under the advanced drop down displayed). This will temporarily add the generated self-signed certificate to you truststore.
46+
47+
3. Change the connect url of the demo to `wss://kaazing.example.com:8000/` and connect
48+
49+
4. Subscribe/Publish JMS messages as desired
50+
51+
### Next Steps
52+
53+
- Configure JMS for high availability (Example coming soon)
54+
- [Secure your JMS infrastructure with Enterprise Shield](../../enterprise-shield)

0 commit comments

Comments
 (0)