Example showing How to use HTML5 WebSocket with Apache ActiveMQ and Apache Camel
JavaScript Java CSS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
camel-ws-ssl Initial commits for 6.2. This is WIP, and currently does not build Jan 16, 2015
camel-ws Initial commits for 6.2. This is WIP, and currently does not build Jan 16, 2015
features
feeder Initial commits for 6.2. This is WIP, and currently does not build Jan 16, 2015
web Initial commits for 6.2. This is WIP, and currently does not build Jan 16, 2015
README.md Updated to say this is not supported as of 6.3 Oct 10, 2016
pom.xml Updated versions to redhat-621026 Aug 28, 2015

README.md

NOTE: This project is not supported on JBoss Fuse version 6.3 or later

Example showing How to use WebSocket HTML 5 with ActiveMQ and Camel

ActiveMQ

  1. Download ActiveMQ 5.9 from this location http://repo.fusesource.com/nexus/content/repositories/releases/org/apache/activemq/apache-activemq/5.9.0.redhat-610312/

or using Apache Release

http://repo1.maven.org/maven2/org/apache/activemq/apache-activemq/5.9.0/
  1. start Jetty Web Server

    cd websocket-activemq-camel/web mvn jetty:run

  2. Start ActiveMQ 5.x using the config provided in feeder/src/main/config directory

    cd /fuse/servers/apache-activemq-5.x/bin ./activemq console xbean:file:/Fuse/fuse-by-examples/websocket-activemq-camel/feeder/src/main/config/activemq-websocket.xml

  3. Compile and start Feed application

    cd websocket-activemq-camel/feed mvn -P run-trader

  4. Open your web browser at this address

    http://localhost:8282/stocks-activemq.html

and click on connect button

Remark : To connect from the web page to the ActiveMQ broker, the login to be used is guest & password is password

Camel

  1. Start Apache Camel Routes (without using wss://)

    cd websocket-activemq-camel/camel-ws mvn camel:run

  2. Compile and Start Feed application

    cd websocket-activemq-camel/feed mvn -P run-trader

  3. Verify stock and news websockets in your browser

    http://localhost:9090/stocks-camel.html http://localhost:9090/news-camel.html

    and click on connect button

To test SSL & wss:// protocol, execute the follownig command

  1. Start Apache Camel Routes (with wss:// & HTTPS)

    cd websocket-activemq-camel/camel-ws-ssl mvn camel:run

  2. Compile and Start Feed application

    cd websocket-activemq-camel/feed mvn -P run-trader

  3. Verify stock and news websockets in your browser

    https://localhost:8443/news-camel-wss.html

    and click on connect button

JBoss A-MQ

  1. Download JBoss A-MQ (https://access.redhat.com/downloads/) and unzip/untar the project locally

  2. Copy ActiveMQ config file containing ActiveMQ WebSocket transports connectors

    cp ~/Fuse/fuse-by-examples/websocket-activemq-camel/feeder/src/main/config/fuseamq-websocket.xml ~/Fuse/servers/jboss-a-mq-6.1.0.redhat-312/etc/activemq.xml

OR

cp ~/Fuse/fuse-by-examples/websocket-activemq-camel/feeder/src/main/config/org.fusesource.mq.fabric.server-default.cfg ~/Fuse/servers/jboss-a-mq-6.1.0.redhat-312/etc
cp ~/Fuse/fuse-by-examples/websocket-activemq-camel/feeder/src/main/config/fuseamq-websocket.xml ~/Fuse/servers/jboss-a-mq-6.1.0.redhat-312/etc/

3)) Add user guest and password password into the file etc/users.properties guest=password,admin

cp /Users/chmoulli/Fuse/fuse-by-examples/websocket-activemq-camel/feeder/src/main/config/users.properties ~/Fuse/servers/jboss-a-mq-6.1.0.redhat-312/etc
  1. Start JBoss A-MQ and install the web project

    install -s webbundle:mvn:com.fusesource.examples.websocket/web/1.0/war?Web-ContextPath=/activemq-websocket

  2. Connect to the web site http://localhost:8181/activemq-websocket/stocks-activemq.html

JBoss Fuse

! Twitter Demo does not work with current Camel 2.10 release as Twitter API 1.0 has been retired ! Camel 2.11 is required

  1. Download JBoss Fuse (https://access.redhat.com/downloads/) and unzip/untar the project locally

  2. Install features & bundles

Remark : bug discovered with websocket & static resources (https://issues.apache.org/jira/browse/CAMEL-6432) + ssl (https://issues.apache.org/jira/browse/CAMEL-6433)

First, install the XML resources file containing the definition about the modules to be deployed. This features file contains for each module (= a feature), the bundles, configurationss and parameters of the applications to be deployed and also references to others features/modules like camel, camel-twitter ...

features:addurl mvn:com.fusesource.examples.websocket/features/1.0/xml/features
features:install websocket-demo

The project can also be installed without using the features file created for this project but, in this case, using what is provisioned out of the box on JBoss Fuse platform.

features:install camel
features:install camel-websocket
features:install camel-twitter
features:install activemq-camel
install -s mvn:com.fusesource.examples.activemq.websocket/camel-ws/1.0
  1. Compile and Start Feed application

    cd websocket-activemq-camel/feed mvn -P run-trader

  2. Connect to the web site using these addresses :

    http://localhost:9090/news-camel.html http://localhost:9090/stocks-camel.html http://localhost:9090/chat-camel.html

Apache Karaf

  1. Download Apache Karaf (http://karaf.apache.org/index/community/download.html) and unzip/untar the project locally

  2. Install features & bundles

    features:addurl mvn:com.fusesource.examples.websocket/features/1.0/xml/features features:install websocket-demo

  3. Compile and Start Feed application

    cd websocket-activemq-camel/feed mvn -P run-trader

  4. Connect to the web site using these addresses :

    http://localhost:9090/news-camel.html http://localhost:9090/stocks-camel.html http://localhost:9090/chat-camel.html