You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/12 05:46:58 UTC
[04/52] [abbrv] [partial] activemq-artemis git commit: This commit
has improvements on the examples including:
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp-websockets/chat/index.html
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/chat/index.html b/examples/jms/stomp-websockets/chat/index.html
deleted file mode 100644
index d92c6e5..0000000
--- a/examples/jms/stomp-websockets/chat/index.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<!DOCTYPE html>
-<html>
- <head>
- <title>Chat Example Using Stomp Over Web Sockets</title>
- <link rel="stylesheet" href="chat.css" />
- <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script>
- <script src='stomp.js'></script>
- <script src='chat.js'></script>
- <script>
- $(document).ready(function() {
- var supported = ("WebSocket" in window);
- if(!supported) {
- var msg = "Your browser does not support Web Sockets. This example will not work properly.<br>";
- msg += "Please use a Web Browser with Web Sockets support (WebKit or Google Chrome).";
- $("#connect").html(msg);
- }
- });
- </script>
- </head>
- <body>
-
- <div id='connect'>
- <form id='connect_form'>
- <dl>
- <dt><label for=connect_url>Server URL</label></dt>
- <dd><input name=url id='connect_url' value='ws://localhost:61614/stomp'></dd>
- <dt><label for=connect_login>Login</label></dt>
- <dd><input id='connect_login' placeholder="User Login" value="guest"></dd>
- <dt><label for=connect_passcode>Password</label></dt>
- <dd><input id='connect_passcode' type=password placeholder="User Password" value="guest"></dd>
- <dt><label for=destination>Destination</label></dt>
- <dd><input id='destination' placeholder="Destination" value="jms.topic.chat"></dd>
- <dt> </dt>
- <dd><input type=submit id='connect_submit' value="Connect"></dd>
- </dl>
- </form>
-
- <p>Use the form above to connect to the Stomp server and subscribe to the destination.</p>
- <p>Once connected, you can send messages to the destination with the text field at the bottom of this page</p>
- </div>
- <div id="disconnect">
- <form id='disconnect_form'>
- <input type=submit id='disconnect_submit' value="Disconnect">
- </form>
- </div>
- <pre id="debug"></pre>
- <div id="messages">
- </div>
- <form id='send_form'>
- <input id='send_form_input' placeholder="Type your message here" disabled />
- </form>
- </body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp-websockets/chat/stomp.js
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/chat/stomp.js b/examples/jms/stomp-websockets/chat/stomp.js
deleted file mode 100644
index 2d68945..0000000
--- a/examples/jms/stomp-websockets/chat/stomp.js
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-// Generated by CoffeeScript 1.3.3
-(function() {
- var Byte, Client, Frame, Stomp,
- __hasProp = {}.hasOwnProperty;
-
- Byte = {
- LF: '\x0A',
- NULL: '\x00'
- };
-
- Frame = (function() {
-
- function Frame(command, headers, body) {
- this.command = command;
- this.headers = headers != null ? headers : {};
- this.body = body != null ? body : '';
- }
-
- Frame.prototype.toString = function() {
- var lines, name, value, _ref;
- lines = [this.command];
- _ref = this.headers;
- for (name in _ref) {
- if (!__hasProp.call(_ref, name)) continue;
- value = _ref[name];
- lines.push("" + name + ":" + value);
- }
- if (this.body) {
- lines.push("content-length:" + ('' + this.body).length);
- }
- lines.push(Byte.LF + this.body);
- return lines.join(Byte.LF);
- };
-
- Frame._unmarshallSingle = function(data) {
- var body, chr, command, divider, headerLines, headers, i, idx, len, line, start, trim, _i, _j, _ref, _ref1;
- divider = data.search(RegExp("" + Byte.LF + Byte.LF));
- headerLines = data.substring(0, divider).split(Byte.LF);
- command = headerLines.shift();
- headers = {};
- trim = function(str) {
- return str.replace(/^\s+|\s+$/g, '');
- };
- line = idx = null;
- for (i = _i = 0, _ref = headerLines.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
- line = headerLines[i];
- idx = line.indexOf(':');
- headers[trim(line.substring(0, idx))] = trim(line.substring(idx + 1));
- }
- body = '';
- start = divider + 2;
- if (headers['content-length']) {
- len = parseInt(headers['content-length']);
- body = ('' + data).substring(start, start + len);
- } else {
- chr = null;
- for (i = _j = start, _ref1 = data.length; start <= _ref1 ? _j < _ref1 : _j > _ref1; i = start <= _ref1 ? ++_j : --_j) {
- chr = data.charAt(i);
- if (chr === Byte.NULL) {
- break;
- }
- body += chr;
- }
- }
- return new Frame(command, headers, body);
- };
-
- Frame.unmarshall = function(datas) {
- var data;
- return (function() {
- var _i, _len, _ref, _results;
- _ref = datas.split(RegExp("" + Byte.NULL + Byte.LF + "*"));
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- data = _ref[_i];
- if ((data != null ? data.length : void 0) > 0) {
- _results.push(Frame._unmarshallSingle(data));
- }
- }
- return _results;
- })();
- };
-
- Frame.marshall = function(command, headers, body) {
- var frame;
- frame = new Frame(command, headers, body);
- return frame.toString() + Byte.NULL;
- };
-
- return Frame;
-
- })();
-
- Client = (function() {
-
- function Client(ws) {
- this.ws = ws;
- this.ws.binaryType = "arraybuffer";
- this.counter = 0;
- this.connected = false;
- this.heartbeat = {
- outgoing: 10000,
- incoming: 10000
- };
- this.subscriptions = {};
- }
-
- Client.prototype._transmit = function(command, headers, body) {
- var out;
- out = Frame.marshall(command, headers, body);
- if (typeof this.debug === "function") {
- this.debug(">>> " + out);
- }
- return this.ws.send(out);
- };
-
- Client.prototype._setupHeartbeat = function(headers) {
- var serverIncoming, serverOutgoing, ttl, v, _ref, _ref1,
- _this = this;
- if ((_ref = headers.version) !== Stomp.VERSIONS.V1_1 && _ref !== Stomp.VERSIONS.V1_2) {
- return;
- }
- _ref1 = (function() {
- var _i, _len, _ref1, _results;
- _ref1 = headers['heart-beat'].split(",");
- _results = [];
- for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
- v = _ref1[_i];
- _results.push(parseInt(v));
- }
- return _results;
- })(), serverOutgoing = _ref1[0], serverIncoming = _ref1[1];
- if (!(this.heartbeat.outgoing === 0 || serverIncoming === 0)) {
- ttl = Math.max(this.heartbeat.outgoing, serverIncoming);
- if (typeof this.debug === "function") {
- this.debug("send PING every " + ttl + "ms");
- }
- this.pinger = typeof window !== "undefined" && window !== null ? window.setInterval(function() {
- _this.ws.send(Byte.LF);
- return typeof _this.debug === "function" ? _this.debug(">>> PING") : void 0;
- }, ttl) : void 0;
- }
- if (!(this.heartbeat.incoming === 0 || serverOutgoing === 0)) {
- ttl = Math.max(this.heartbeat.incoming, serverOutgoing);
- if (typeof this.debug === "function") {
- this.debug("check PONG every " + ttl + "ms");
- }
- return this.ponger = typeof window !== "undefined" && window !== null ? window.setInterval(function() {
- var delta;
- delta = Date.now() - _this.serverActivity;
- if (delta > ttl * 2) {
- if (typeof _this.debug === "function") {
- _this.debug("did not receive server activity for the last " + delta + "ms");
- }
- return _this._cleanUp();
- }
- }, ttl) : void 0;
- }
- };
-
- Client.prototype.connect = function(login, passcode, connectCallback, errorCallback, vhost) {
- var _this = this;
- this.connectCallback = connectCallback;
- if (typeof this.debug === "function") {
- this.debug("Opening Web Socket...");
- }
- this.ws.onmessage = function(evt) {
- var arr, c, data, frame, onreceive, _i, _len, _ref, _results;
- data = typeof ArrayBuffer !== 'undefined' && evt.data instanceof ArrayBuffer ? (arr = new Uint8Array(evt.data), typeof _this.debug === "function" ? _this.debug("--- got data length: " + arr.length) : void 0, ((function() {
- var _i, _len, _results;
- _results = [];
- for (_i = 0, _len = arr.length; _i < _len; _i++) {
- c = arr[_i];
- _results.push(String.fromCharCode(c));
- }
- return _results;
- })()).join('')) : evt.data;
- _this.serverActivity = Date.now();
- if (data === Byte.LF) {
- if (typeof _this.debug === "function") {
- _this.debug("<<< PONG");
- }
- return;
- }
- if (typeof _this.debug === "function") {
- _this.debug("<<< " + data);
- }
- _ref = Frame.unmarshall(data);
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- frame = _ref[_i];
- switch (frame.command) {
- case "CONNECTED":
- if (typeof _this.debug === "function") {
- _this.debug("connected to server " + frame.headers.server);
- }
- _this.connected = true;
- _this._setupHeartbeat(frame.headers);
- _results.push(typeof _this.connectCallback === "function" ? _this.connectCallback(frame) : void 0);
- break;
- case "MESSAGE":
- onreceive = _this.subscriptions[frame.headers.subscription];
- _results.push(typeof onreceive === "function" ? onreceive(frame) : void 0);
- break;
- case "RECEIPT":
- _results.push(typeof _this.onreceipt === "function" ? _this.onreceipt(frame) : void 0);
- break;
- case "ERROR":
- _results.push(typeof errorCallback === "function" ? errorCallback(frame) : void 0);
- break;
- default:
- _results.push(typeof _this.debug === "function" ? _this.debug("Unhandled frame: " + frame) : void 0);
- }
- }
- return _results;
- };
- this.ws.onclose = function() {
- var msg;
- msg = "Whoops! Lost connection to " + _this.ws.url;
- if (typeof _this.debug === "function") {
- _this.debug(msg);
- }
- return typeof errorCallback === "function" ? errorCallback(msg) : void 0;
- };
- return this.ws.onopen = function() {
- var headers;
- if (typeof _this.debug === "function") {
- _this.debug('Web Socket Opened...');
- }
- headers = {
- "accept-version": Stomp.VERSIONS.supportedVersions(),
- "heart-beat": [_this.heartbeat.outgoing, _this.heartbeat.incoming].join(',')
- };
- if (vhost) {
- headers.host = vhost;
- }
- if (login) {
- headers.login = login;
- }
- if (passcode) {
- headers.passcode = passcode;
- }
- return _this._transmit("CONNECT", headers);
- };
- };
-
- Client.prototype.disconnect = function(disconnectCallback) {
- this._transmit("DISCONNECT");
- this.ws.onclose = null;
- this._cleanUp();
- return typeof disconnectCallback === "function" ? disconnectCallback() : void 0;
- };
-
- Client.prototype._cleanUp = function() {
- this.ws.close();
- this.connected = false;
- if (this.pinger) {
- if (typeof window !== "undefined" && window !== null) {
- window.clearInterval(this.pinger);
- }
- }
- if (this.ponger) {
- return typeof window !== "undefined" && window !== null ? window.clearInterval(this.ponger) : void 0;
- }
- };
-
- Client.prototype.send = function(destination, headers, body) {
- if (headers == null) {
- headers = {};
- }
- if (body == null) {
- body = '';
- }
- headers.destination = destination;
- return this._transmit("SEND", headers, body);
- };
-
- Client.prototype.subscribe = function(destination, callback, headers) {
- if (headers == null) {
- headers = {};
- }
- if (!headers.id) {
- headers.id = "sub-" + this.counter++;
- }
- headers.destination = destination;
- this.subscriptions[headers.id] = callback;
- this._transmit("SUBSCRIBE", headers);
- return headers.id;
- };
-
- Client.prototype.unsubscribe = function(id) {
- delete this.subscriptions[id];
- return this._transmit("UNSUBSCRIBE", {
- id: id
- });
- };
-
- Client.prototype.begin = function(transaction) {
- return this._transmit("BEGIN", {
- transaction: transaction
- });
- };
-
- Client.prototype.commit = function(transaction) {
- return this._transmit("COMMIT", {
- transaction: transaction
- });
- };
-
- Client.prototype.abort = function(transaction) {
- return this._transmit("ABORT", {
- transaction: transaction
- });
- };
-
- Client.prototype.ack = function(messageID, subscription, headers) {
- if (headers == null) {
- headers = {};
- }
- headers["message-id"] = messageID;
- headers.subscription = subscription;
- return this._transmit("ACK", headers);
- };
-
- Client.prototype.nack = function(messageID, subscription, headers) {
- if (headers == null) {
- headers = {};
- }
- headers["message-id"] = messageID;
- headers.subscription = subscription;
- return this._transmit("NACK", headers);
- };
-
- return Client;
-
- })();
-
- Stomp = {
- libVersion: "2.0.0-next",
- VERSIONS: {
- V1_0: '1.0',
- V1_1: '1.1',
- V1_2: '1.2',
- supportedVersions: function() {
- return '1.1,1.0';
- }
- },
- client: function(url, protocols) {
- var klass, ws;
- if (protocols == null) {
- protocols = ['v10.stomp', 'v11.stomp'];
- }
- klass = Stomp.WebSocketClass || WebSocket;
- ws = new klass(url, protocols);
- return new Client(ws);
- },
- over: function(ws) {
- return new Client(ws);
- },
- Frame: Frame
- };
-
- if (typeof window !== "undefined" && window !== null) {
- window.Stomp = Stomp;
- } else {
- exports.Stomp = Stomp;
- Stomp.WebSocketClass = require('./test/server.mock.js').StompServerMock;
- }
-
-}).call(this);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp-websockets/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/pom.xml b/examples/jms/stomp-websockets/pom.xml
deleted file mode 100644
index 06fc747..0000000
--- a/examples/jms/stomp-websockets/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>jms-examples</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>stomp-websockets</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis JMS StompWebSocketExample Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../..</activemq.basedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <!-- specify -PnoServer if you don't want to start the server -->
- <id>noServer</id>
- <properties>
- <noServer>true</noServer>
- </properties>
- </profile>
- </profiles>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>create</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- </configuration>
- </execution>
- <execution>
- <id>start</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.jms.example.StompWebSocketExample</clientClass>
- </configuration>
- </execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>stomp-websockets</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp-websockets/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/readme.html b/examples/jms/stomp-websockets/readme.html
deleted file mode 100644
index 56b2673..0000000
--- a/examples/jms/stomp-websockets/readme.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<html>
- <head>
- <title>ActiveMQ Artemis Stomp WebSockets Example</title>
- <link rel="stylesheet" type="text/css" href="../common/common.css" />
- <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
- <script src="../common/prettify.js"></script>
- </head>
- <body onload="prettyPrint()">
- <h1>Stomp WebSockets Example</h1>
-
- <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>
-
-
- <p>This example shows you how to configure ActiveMQ Artemis to send and receive Stomp messages from modern web browser using Web Sockets.</p>
-
- <p>The example will start a ActiveMQ Artemis server configured with Stomp over Web Sockets and JMS. Web browsers clients and
- Java application will exchange message using a JMS Topic.</p></para>
- <pre class="prettyprint">
-<acceptor name="stomp-websocket">tcp://localhost:61614</acceptor></pre>
-
- <h2>Example step-by-step</h2>
-
- <p><i>To run the example, simply type <code>mvn verify -Pexample</code> from this directory</i></p>
-
- <p>To subscribe to the topic from your web browser, open the <a href="chat/index.html">Chat Example</a> or the <a href="aerogear-chat/aerogear-index.html">JBoss AeroGear STOMP notifier Chat Example</a> from another tab.
- The chat example is preconfigured to connect to the ActiveMQ Artemis server with the URL <code>ws://localhost:61614/stomp</code> and subscribe to the JMS Topic (through its core address
- <code>jms.topic.chat</code>).
- </p>
- <p>You can open as many Web clients as you want and they will all exchange messages through the topic</p>
- <p>If you run again the Java application (with <code>./build.sh</code>), the web clients will also receive its message</p>
-
- <h2>Documentation</h2>
- <p>A JavaScript library is used on the browser side to be able to use Stomp Over Web Sockets (please see its <a href="http://jmesnil.net/stomp-websocket/doc/">documentation</a>
- for a complete description).</p>
- <p>The <a href="aerogear-chat/aerogear-index.html">JBoss AeroGear STOMP notifier Chat Example</a> is using the AeroGear Notifier which is a collection of adapters that provide a unified or similar API for interacting with different messaging services and protocols. The STOMP adapter is used for communicating with STOMP over WebSockets. See more at: <a href="http://aerogear.org/docs/specs/aerogear-js/">JBoss aerogear-js</a> </p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java b/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java
deleted file mode 100644
index d784e6b..0000000
--- a/examples/jms/stomp-websockets/src/main/java/org/apache/activemq/artemis/jms/example/StompWebSocketExample.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import java.util.Date;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.InitialContext;
-
-/**
- * An example where a client will send a JMS message to a Topic.
- * Browser clients connected using Web Sockets will be able to receive the message.
- */
-public class StompWebSocketExample {
-
- public static void main(final String[] args) throws Exception {
- Connection connection = null;
- InitialContext initialContext = null;
- try {
- initialContext = new InitialContext();
- Topic topic = (Topic) initialContext.lookup("topic/chat");
- ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
- connection = cf.createConnection();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageProducer producer = session.createProducer(topic);
- MessageConsumer consumer = session.createConsumer(topic);
-
- // use JMS bytes message with UTF-8 String to send a text to Stomp clients
- String text = "message sent from a Java application at " + new Date();
- //BytesMessage message = session.createBytesMessage();
- //message.writeBytes(text.getBytes("UTF-8"));
- TextMessage message = session.createTextMessage(text);
- System.out.println("Sent message: " + text);
- System.out.println("Open up the chat/index.html file in a browser and press enter");
- System.in.read();
- producer.send(message);
-
- connection.start();
-
- message = (TextMessage) consumer.receive();
- System.out.println("Received message: " + message.getText());
- }
- finally {
- if (connection != null) {
- connection.close();
- }
-
- if (initialContext != null) {
- initialContext.close();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index 6a68013..0000000
--- a/examples/jms/stomp-websockets/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:activemq"
- xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
-
- <jms xmlns="urn:activemq:jms">
- <!--the topic used by the example-->
- <topic name="chat"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Acceptors -->
- <acceptors>
- <!-- a regular Netty acceptor used by the JMS client -->
- <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
- <!-- the stomp-acceptor is configured for the Stomp over Web Sockets and -->
- <!-- will listen on port 61614) -->
- <acceptor name="stomp-websocket">tcp://localhost:61614</acceptor>
- </acceptors>
-
- <!-- Other config -->
-
- <security-settings>
- <!--security for example queue-->
- <security-setting match="jms.topic.chat">
- <permission type="createDurableQueue" roles="guest"/>
- <permission type="deleteDurableQueue" roles="guest"/>
- <permission type="createNonDurableQueue" roles="guest"/>
- <permission type="deleteNonDurableQueue" roles="guest"/>
- <permission type="consume" roles="guest"/>
- <permission type="send" roles="guest"/>
- </security-setting>
- </security-settings>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp-websockets/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp-websockets/src/main/resources/jndi.properties b/examples/jms/stomp-websockets/src/main/resources/jndi.properties
deleted file mode 100644
index 1828f84..0000000
--- a/examples/jms/stomp-websockets/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616
-topic.topic/chat=chat
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/pom.xml b/examples/jms/stomp/pom.xml
deleted file mode 100644
index eca6bee..0000000
--- a/examples/jms/stomp/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>jms-examples</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>stomp</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis JMS Stomp Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../..</activemq.basedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <!-- specify -PnoServer if you don't want to start the server -->
- <id>noServer</id>
- <properties>
- <noServer>true</noServer>
- </properties>
- </profile>
- </profiles>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>create</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- </configuration>
- </execution>
- <execution>
- <id>start</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.jms.example.StompExample</clientClass>
- </configuration>
- </execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>stomp</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/readme.html b/examples/jms/stomp/readme.html
deleted file mode 100644
index 8f07f11..0000000
--- a/examples/jms/stomp/readme.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<html>
- <head>
- <title>ActiveMQ Artemis Stomp Example</title>
- <link rel="stylesheet" type="text/css" href="../common/common.css" />
- <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
- <script type="text/javascript" src="../common/prettify.js"></script>
- </head>
- <body onload="prettyPrint()">
- <h1>Stomp Example</h1>
-
- <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>
-
-
- <p>This example shows you how to configure ActiveMQ Artemis to send and receive Stomp messages.</p>
- <p>The example will start a ActiveMQ Artemis server configured with Stomp and JMS.</p>
- <p>The client will open a socket to send one Stomp message (using TCP directly).
- The client will then consume a message from a JMS Queue and check it is the message sent with Stomp.</p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java b/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
deleted file mode 100644
index e7ea406..0000000
--- a/examples/jms/stomp/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.nio.charset.StandardCharsets;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-/**
- * An example where a client will send a Stomp message on a TCP socket
- * and consume it from a JMS MessageConsumer.
- */
-public class StompExample {
-
- private static final String END_OF_FRAME = "\u0000";
-
- public static void main(final String[] args) throws Exception {
- Connection connection = null;
- InitialContext initialContext = null;
-
- try {
- // Step 1. Create a TCP socket to connect to the Stomp port
- Socket socket = new Socket("localhost", 61613);
-
- // Step 2. Send a CONNECT frame to connect to the server
- String connectFrame = "CONNECT\n" +
- "login: guest\n" +
- "passcode: guest\n" +
- "request-id: 1\n" +
- "\n" +
- END_OF_FRAME;
- sendFrame(socket, connectFrame);
-
- readFrame(socket);
-
- // Step 3. Send a SEND frame (a Stomp message) to the
- // jms.queue.exampleQueue address with a text body
- String text = "Hello, world from Stomp!";
- String message = "SEND\n" +
- "destination: jms.queue.exampleQueue\n" +
- "\n" +
- text +
- END_OF_FRAME;
- sendFrame(socket, message);
- System.out.println("Sent Stomp message: " + text);
-
- // Step 4. Send a DISCONNECT frame to disconnect from the server
- String disconnectFrame = "DISCONNECT\n" +
- "\n" +
- END_OF_FRAME;
- sendFrame(socket, disconnectFrame);
-
- // Step 5. Slose the TCP socket
- socket.close();
-
- // We will now consume from JMS the message sent with Stomp.
-
- // Step 6. Create an initial context to perform the JNDI lookup.
- initialContext = new InitialContext();
-
- // Step 7. Perform a lookup on the queue and the connection factory
- Queue queue = (Queue) initialContext.lookup("queue/exampleQueue");
- ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
-
- // Step 8.Create a JMS Connection, Session and a MessageConsumer on the queue
- connection = cf.createConnection();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer consumer = session.createConsumer(queue);
-
- // Step 9. Start the Connection
- connection.start();
-
- // Step 10. Receive the message
- TextMessage messageReceived = (TextMessage) consumer.receive(5000);
- System.out.println("Received JMS message: " + messageReceived.getText());
- }
- finally {
- // Step 11. Be sure to close our JMS resources!
- if (initialContext != null) {
- initialContext.close();
- }
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- private static void sendFrame(Socket socket, String data) throws Exception {
- byte[] bytes = data.getBytes(StandardCharsets.UTF_8);
- OutputStream outputStream = socket.getOutputStream();
- for (int i = 0; i < bytes.length; i++) {
- outputStream.write(bytes[i]);
- }
- outputStream.flush();
- }
-
- private static String readFrame(Socket socket) throws Exception {
- byte[] bytes = new byte[2048];
- InputStream inputStream = socket.getInputStream();
- int nbytes = inputStream.read(bytes);
- byte[] data = new byte[nbytes];
- System.arraycopy(bytes, 0, data, 0, data.length);
- String resp = new String(data, "UTF-8");
- System.out.println("Got response from server: " + resp);
- return resp;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp/src/main/resources/activemq/server0/artemis-roles.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/src/main/resources/activemq/server0/artemis-roles.properties b/examples/jms/stomp/src/main/resources/activemq/server0/artemis-roles.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/stomp/src/main/resources/activemq/server0/artemis-roles.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp/src/main/resources/activemq/server0/artemis-users.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/src/main/resources/activemq/server0/artemis-users.properties b/examples/jms/stomp/src/main/resources/activemq/server0/artemis-users.properties
deleted file mode 100644
index 4e2d44c..0000000
--- a/examples/jms/stomp/src/main/resources/activemq/server0/artemis-users.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## Licensed to the Apache Software Foundation (ASF) under one or more
-## contributor license agreements. See the NOTICE file distributed with
-## this work for additional information regarding copyright ownership.
-## The ASF licenses this file to You under the Apache License, Version 2.0
-## (the "License"); you may not use this file except in compliance with
-## the License. You may obtain a copy of the License at
-##
-## http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS,
-## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-## See the License for the specific language governing permissions and
-## limitations under the License.
-## ---------------------------------------------------------------------------
-guest=guest
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index c0ada1e..0000000
--- a/examples/jms/stomp/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:activemq"
- xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
-
- <jms xmlns="urn:activemq:jms">
- <!--the queue used by the example-->
- <queue name="exampleQueue"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
-
- <journal-directory>${data.dir:../data}/journal</journal-directory>
-
- <large-messages-directory>${data.dir:../data}/largemessages</large-messages-directory>
-
- <paging-directory>${data.dir:../data}/paging</paging-directory>
-
- <!-- Acceptors -->
- <acceptors>
- <!-- a regular Netty acceptor used by the JMS client -->
- <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
- <!-- the stomp-acceptor is configured for the Stomp protocol only and -->
- <!-- will listen on port 61613 (default Stomp port) -->
- <acceptor name="stomp-acceptor">tcp://localhost:61613?protocols=STOMP</acceptor>
- </acceptors>
-
- <!-- Other config -->
-
- <security-settings>
- <!--security for example queue-->
- <security-setting match="jms.queue.exampleQueue">
- <permission type="createDurableQueue" roles="guest"/>
- <permission type="deleteDurableQueue" roles="guest"/>
- <permission type="createNonDurableQueue" roles="guest"/>
- <permission type="deleteNonDurableQueue" roles="guest"/>
- <permission type="consume" roles="guest"/>
- <permission type="send" roles="guest"/>
- </security-setting>
- </security-settings>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp/src/main/resources/jndi.properties b/examples/jms/stomp/src/main/resources/jndi.properties
deleted file mode 100644
index 93537c4..0000000
--- a/examples/jms/stomp/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616
-queue.queue/exampleQueue=exampleQueue
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.1/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.1/pom.xml b/examples/jms/stomp1.1/pom.xml
deleted file mode 100644
index 68ed6cd..0000000
--- a/examples/jms/stomp1.1/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>jms-examples</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>stomp1.1</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis JMS Stomp Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../..</activemq.basedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <!-- specify -PnoServer if you don't want to start the server -->
- <id>noServer</id>
- <properties>
- <noServer>true</noServer>
- </properties>
- </profile>
- </profiles>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>create</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- </configuration>
- </execution>
- <execution>
- <id>start</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.jms.example.StompExample</clientClass>
- </configuration>
- </execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>stomp1.1</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.1/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.1/readme.html b/examples/jms/stomp1.1/readme.html
deleted file mode 100644
index 5c3fe61..0000000
--- a/examples/jms/stomp1.1/readme.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<html>
- <head>
- <title>ActiveMQ Artemis Stomp 1.1 Example</title>
- <link rel="stylesheet" type="text/css" href="../common/common.css" />
- <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
- <script type="text/javascript" src="../common/prettify.js"></script>
- </head>
- <body onload="prettyPrint()">
- <h1>Stomp 1.1 Example</h1>
-
- <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>
-
-
- <p>This example shows you how to configure ActiveMQ Artemis to send and receive Stomp messages using Stomp 1.1 protocol.</p>
- <p>The example will start a ActiveMQ Artemis server configured with Stomp and JMS.</p>
- <p>The client will open a socket to initiate a Stomp 1.1 connection and then send one Stomp message (using TCP directly).
- The client will then consume a message from a JMS Queue and check it is the message sent with Stomp.</p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java b/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
deleted file mode 100644
index 4e22435..0000000
--- a/examples/jms/stomp1.1/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.nio.charset.StandardCharsets;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-/**
- * An example where a Stomp 1.1 client sends a message on a TCP socket
- * and consumes it from a JMS MessageConsumer.
- */
-public class StompExample {
-
- private static final String END_OF_FRAME = "\u0000";
-
- public static void main(final String[] args) throws Exception {
- Connection connection = null;
- InitialContext initialContext = null;
-
- try {
- // Step 1. Create a TCP socket to connect to the Stomp port
- Socket socket = new Socket("localhost", 61613);
-
- // Step 2. Send a CONNECT frame to connect to the server
- String connectFrame = "CONNECT\n" +
- "accept-version:1.1\n" +
- "host:localhost\n" +
- "login:guest\n" +
- "passcode:guest\n" +
- "request-id:1\n" +
- "\n" +
- END_OF_FRAME;
- sendFrame(socket, connectFrame);
-
- String response = receiveFrame(socket);
- System.out.println("response: " + response);
-
- // Step 3. Send a SEND frame (a Stomp message) to the
- // jms.queue.exampleQueue address with a text body
- String text = "Hello World from Stomp 1.1 !";
- String message = "SEND\n" +
- "destination:jms.queue.exampleQueue\n" +
- "\n" +
- text +
- END_OF_FRAME;
- sendFrame(socket, message);
- System.out.println("Sent Stomp message: " + text);
-
- // Step 4. Send a DISCONNECT frame to disconnect from the server
- String disconnectFrame = "DISCONNECT\n" +
- "\n" +
- END_OF_FRAME;
- sendFrame(socket, disconnectFrame);
-
- // Step 5. Slose the TCP socket
- socket.close();
-
- // We will now consume from JMS the message sent with Stomp.
-
- // Step 6. Create an initial context to perform the JNDI lookup.
- initialContext = new InitialContext();
-
- // Step 7. Perform a lookup on the queue and the connection factory
- Queue queue = (Queue) initialContext.lookup("queue/exampleQueue");
- ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
-
- // Step 8.Create a JMS Connection, Session and a MessageConsumer on the queue
- connection = cf.createConnection();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer consumer = session.createConsumer(queue);
-
- // Step 9. Start the Connection
- connection.start();
-
- // Step 10. Receive the message
- TextMessage messageReceived = (TextMessage) consumer.receive(5000);
- System.out.println("Received JMS message: " + messageReceived.getText());
- }
- finally {
- // Step 11. Be sure to close our JMS resources!
- if (initialContext != null) {
- initialContext.close();
- }
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- private static void sendFrame(Socket socket, String data) throws Exception {
- byte[] bytes = data.getBytes(StandardCharsets.UTF_8);
- OutputStream outputStream = socket.getOutputStream();
- for (int i = 0; i < bytes.length; i++) {
- outputStream.write(bytes[i]);
- }
- outputStream.flush();
- }
-
- private static String receiveFrame(Socket socket) throws Exception {
- InputStream inputStream = socket.getInputStream();
- byte[] buffer = new byte[1024];
- int size = inputStream.read(buffer);
-
- byte[] data = new byte[size];
- System.arraycopy(buffer, 0, data, 0, size);
-
- String frame = new String(data, StandardCharsets.UTF_8);
- return frame;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index fea1cca..0000000
--- a/examples/jms/stomp1.1/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:activemq"
- xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
-
- <jms xmlns="urn:activemq:jms">
- <!--the queue used by the example-->
- <queue name="exampleQueue"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Acceptors -->
- <acceptors>
- <!-- a regular Netty acceptor used by the JMS client -->
- <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
- <!-- the stomp-acceptor is configured for the Stomp protocol only and -->
- <!-- will listen on port 61613 (default Stomp port) -->
- <acceptor name="stomp-acceptor">tcp://localhost:61613?protocols=STOMP</acceptor>
- </acceptors>
-
- <!-- Other config -->
-
- <security-settings>
- <!--security for example queue-->
- <security-setting match="jms.queue.exampleQueue">
- <permission type="createDurableQueue" roles="guest"/>
- <permission type="deleteDurableQueue" roles="guest"/>
- <permission type="createNonDurableQueue" roles="guest"/>
- <permission type="deleteNonDurableQueue" roles="guest"/>
- <permission type="consume" roles="guest"/>
- <permission type="send" roles="guest"/>
- </security-setting>
- </security-settings>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.1/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.1/src/main/resources/jndi.properties b/examples/jms/stomp1.1/src/main/resources/jndi.properties
deleted file mode 100644
index 93537c4..0000000
--- a/examples/jms/stomp1.1/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616
-queue.queue/exampleQueue=exampleQueue
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.2/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.2/pom.xml b/examples/jms/stomp1.2/pom.xml
deleted file mode 100644
index 3cee1db..0000000
--- a/examples/jms/stomp1.2/pom.xml
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>jms-examples</artifactId>
- <version>1.0.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>stomp1.2</artifactId>
- <packaging>jar</packaging>
- <name>ActiveMQ Artemis JMS Stomp 1.2 Example</name>
-
- <properties>
- <activemq.basedir>${project.basedir}/../../..</activemq.basedir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-jms-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <profiles>
- <profile>
- <!-- specify -PnoServer if you don't want to start the server -->
- <id>noServer</id>
- <properties>
- <noServer>true</noServer>
- </properties>
- </profile>
- </profiles>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.activemq</groupId>
- <artifactId>artemis-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>create</id>
- <goals>
- <goal>create</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- </configuration>
- </execution>
- <execution>
- <id>start</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <spawn>true</spawn>
- <testURI>tcp://localhost:61616</testURI>
- <args>
- <param>run</param>
- </args>
- </configuration>
- </execution>
- <execution>
- <id>runClient</id>
- <goals>
- <goal>runClient</goal>
- </goals>
- <configuration>
- <clientClass>org.apache.activemq.artemis.jms.example.StompExample</clientClass>
- </configuration>
- </execution>
- <execution>
- <id>stop</id>
- <goals>
- <goal>cli</goal>
- </goals>
- <configuration>
- <ignore>${noServer}</ignore>
- <args>
- <param>stop</param>
- </args>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.apache.activemq.examples.jms</groupId>
- <artifactId>stomp1.2</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.2/readme.html
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.2/readme.html b/examples/jms/stomp1.2/readme.html
deleted file mode 100644
index 3661f04..0000000
--- a/examples/jms/stomp1.2/readme.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<html>
- <head>
- <title>ActiveMQ Artemis Stomp 1.1 Example</title>
- <link rel="stylesheet" type="text/css" href="../common/common.css" />
- <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
- <script type="text/javascript" src="../common/prettify.js"></script>
- </head>
- <body onload="prettyPrint()">
- <h1>Stomp 1.2 Example</h1>
-
- <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>
-
-
- <p>This example shows you how to configure ActiveMQ Artemis to send and receive Stomp messages using Stomp 1.2 protocol.</p>
- <p>The example will start a ActiveMQ Artemis server configured with Stomp and JMS.</p>
- <p>The client will open a socket to initiate a Stomp 1.2 connection and then send one Stomp message (using TCP directly).
- The client will then consume a message from a JMS Queue and check it is the message sent with Stomp.</p>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java b/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
deleted file mode 100644
index 116e464..0000000
--- a/examples/jms/stomp1.2/src/main/java/org/apache/activemq/artemis/jms/example/StompExample.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.example;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.naming.InitialContext;
-
-/**
- * An example where a Stomp 1.2 client sends a message on a TCP socket
- * and consumes it from a JMS MessageConsumer.
- */
-public class StompExample {
-
- private static final String END_OF_FRAME = "\u0000";
-
- public static void main(final String[] args) throws Exception {
- Connection connection = null;
- InitialContext initialContext = null;
-
- try {
- // Step 1. Create a TCP socket to connect to the Stomp port
- Socket socket = new Socket("localhost", 61613);
-
- // Step 2. Send a CONNECT frame to connect to the server
- String connectFrame = "CONNECT\n" +
- "accept-version:1.2\n" +
- "host:localhost\n" +
- "login:guest\n" +
- "passcode:guest\n" +
- "request-id:1\n" +
- "\n" +
- END_OF_FRAME;
- sendFrame(socket, connectFrame);
-
- String response = receiveFrame(socket);
- System.out.println("response: " + response);
-
- // Step 3. Send a SEND frame (a Stomp message) to the
- // jms.queue.exampleQueue address with a text body
- String text = "Hello World from Stomp 1.2 !";
- String message = "SEND\n" +
- "destination:jms.queue.exampleQueue\n" +
- "\n" +
- text +
- END_OF_FRAME;
- sendFrame(socket, message);
- System.out.println("Sent Stomp message: " + text);
-
- // Step 4. Send a DISCONNECT frame to disconnect from the server
- String disconnectFrame = "DISCONNECT\n" +
- "\n" +
- END_OF_FRAME;
- sendFrame(socket, disconnectFrame);
-
- // Step 5. Slose the TCP socket
- socket.close();
-
- // We will now consume from JMS the message sent with Stomp.
-
- // Step 6. Create an initial context to perform the JNDI lookup.
- initialContext = new InitialContext();
-
- // Step 7. Perform a lookup on the queue and the connection factory
- Queue queue = (Queue) initialContext.lookup("queue/exampleQueue");
- ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("ConnectionFactory");
-
- // Step 8.Create a JMS Connection, Session and a MessageConsumer on the queue
- connection = cf.createConnection();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- MessageConsumer consumer = session.createConsumer(queue);
-
- // Step 9. Start the Connection
- connection.start();
-
- // Step 10. Receive the message
- TextMessage messageReceived = (TextMessage) consumer.receive(5000);
- System.out.println("Received JMS message: " + messageReceived.getText());
- }
- finally {
- // Step 11. Be sure to close our JMS resources!
- if (initialContext != null) {
- initialContext.close();
- }
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- private static void sendFrame(Socket socket, String data) throws Exception {
- byte[] bytes = data.getBytes("UTF-8");
- OutputStream outputStream = socket.getOutputStream();
- for (int i = 0; i < bytes.length; i++) {
- outputStream.write(bytes[i]);
- }
- outputStream.flush();
- }
-
- private static String receiveFrame(Socket socket) throws Exception {
- InputStream inputStream = socket.getInputStream();
- byte[] buffer = new byte[1024];
- int size = inputStream.read(buffer);
-
- byte[] data = new byte[size];
- System.arraycopy(buffer, 0, data, 0, size);
-
- String frame = new String(data, "UTF-8");
- return frame;
- }
-}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml b/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml
deleted file mode 100644
index fea1cca..0000000
--- a/examples/jms/stomp1.2/src/main/resources/activemq/server0/broker.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version='1.0'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="urn:activemq"
- xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
-
- <jms xmlns="urn:activemq:jms">
- <!--the queue used by the example-->
- <queue name="exampleQueue"/>
- </jms>
-
- <core xmlns="urn:activemq:core">
-
- <bindings-directory>./data/bindings</bindings-directory>
-
- <journal-directory>./data/journal</journal-directory>
-
- <large-messages-directory>./data/largemessages</large-messages-directory>
-
- <paging-directory>./data/paging</paging-directory>
-
- <!-- Acceptors -->
- <acceptors>
- <!-- a regular Netty acceptor used by the JMS client -->
- <acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
- <!-- the stomp-acceptor is configured for the Stomp protocol only and -->
- <!-- will listen on port 61613 (default Stomp port) -->
- <acceptor name="stomp-acceptor">tcp://localhost:61613?protocols=STOMP</acceptor>
- </acceptors>
-
- <!-- Other config -->
-
- <security-settings>
- <!--security for example queue-->
- <security-setting match="jms.queue.exampleQueue">
- <permission type="createDurableQueue" roles="guest"/>
- <permission type="deleteDurableQueue" roles="guest"/>
- <permission type="createNonDurableQueue" roles="guest"/>
- <permission type="deleteNonDurableQueue" roles="guest"/>
- <permission type="consume" roles="guest"/>
- <permission type="send" roles="guest"/>
- </security-setting>
- </security-settings>
-
- </core>
-</configuration>
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/21bf4406/examples/jms/stomp1.2/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/stomp1.2/src/main/resources/jndi.properties b/examples/jms/stomp1.2/src/main/resources/jndi.properties
deleted file mode 100644
index 93537c4..0000000
--- a/examples/jms/stomp1.2/src/main/resources/jndi.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
-connectionFactory.ConnectionFactory=tcp://localhost:61616
-queue.queue/exampleQueue=exampleQueue