You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ma...@apache.org on 2015/03/16 18:31:12 UTC
[1/3] activemq-6 git commit: Fix proton-cpp pom missing version Fix
proton-ruby script (update according to proton 0.8) Fix core example doc
Repository: activemq-6
Updated Branches:
refs/heads/master 0d599b856 -> c062d68a4
Fix proton-cpp pom missing version
Fix proton-ruby script (update according to proton 0.8)
Fix core example doc
Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/5ea0a305
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/5ea0a305
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/5ea0a305
Branch: refs/heads/master
Commit: 5ea0a3055dd38e781f172e5247ab3c136cae876d
Parents: 0d599b8
Author: Howard Gao <hg...@redhat.com>
Authored: Mon Mar 16 22:39:00 2015 +0800
Committer: Howard Gao <hg...@redhat.com>
Committed: Mon Mar 16 22:40:47 2015 +0800
----------------------------------------------------------------------
examples/core/embedded-remote/readme.html | 2 +-
examples/core/embedded/readme.html | 2 +-
examples/jms/proton-cpp/pom.xml | 1 +
examples/jms/proton-ruby/src/main/scripts/receive.rb | 9 +++++----
examples/jms/proton-ruby/src/main/scripts/send.rb | 4 ++--
5 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/5ea0a305/examples/core/embedded-remote/readme.html
----------------------------------------------------------------------
diff --git a/examples/core/embedded-remote/readme.html b/examples/core/embedded-remote/readme.html
index 9e8d338..a5cc882 100644
--- a/examples/core/embedded-remote/readme.html
+++ b/examples/core/embedded-remote/readme.html
@@ -33,7 +33,7 @@ under the License.
<h2>Example step-by-step</h2>
- <p><i>To run the example, simply type <code>mvn -Pserver</code> from this directory to start the server and <code>mvn -Pclient</code> to run the client example</i></p>
+ <p><i>To run the example, simply type <code>mvn verify -Pserver</code> from this directory to start the server and <code>mvn verify -Pclient</code> to run the client example</i></p>
<p>In this we don't use any configuration files. (Everything is embedded). We simply instantiate ConfigurationImpl, ActiveMQServer, start it and operate on JMS regularly</p>
<br/>
<ol>
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/5ea0a305/examples/core/embedded/readme.html
----------------------------------------------------------------------
diff --git a/examples/core/embedded/readme.html b/examples/core/embedded/readme.html
index dcec9b6..441a68b 100644
--- a/examples/core/embedded/readme.html
+++ b/examples/core/embedded/readme.html
@@ -38,7 +38,7 @@ under the License.
<p>ActiveMQ Embedded could be used from very simple use cases with only InVM support to very complex cases with clustering, persistence and fail over.</p>
<h2>Example step-by-step</h2>
- <p><i>To run the example, simply type <code>mvn -Pexample</code> from this directory</i></p>
+ <p><i>To run the example, simply type <code>mvn verify -Pexample</code> from this directory</i></p>
<p>In this we don't use any configuration files. (Everything is embedded). We simply instantiate ConfigurationImpl, ActiveMQServer, start it and operate on JMS regularly</p>
<ol>
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/5ea0a305/examples/jms/proton-cpp/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/proton-cpp/pom.xml b/examples/jms/proton-cpp/pom.xml
index 6b3defe..a7888b4 100644
--- a/examples/jms/proton-cpp/pom.xml
+++ b/examples/jms/proton-cpp/pom.xml
@@ -50,6 +50,7 @@ under the License.
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
+ <version>${geronimo.jms.2.spec.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/5ea0a305/examples/jms/proton-ruby/src/main/scripts/receive.rb
----------------------------------------------------------------------
diff --git a/examples/jms/proton-ruby/src/main/scripts/receive.rb b/examples/jms/proton-ruby/src/main/scripts/receive.rb
old mode 100644
new mode 100755
index 4019bd2..93228ff
--- a/examples/jms/proton-ruby/src/main/scripts/receive.rb
+++ b/examples/jms/proton-ruby/src/main/scripts/receive.rb
@@ -20,6 +20,7 @@ require 'qpid_proton'
messenger = Qpid::Proton::Messenger.new()
messenger.incoming_window = 10
+messenger.timeout = 10000
begin
messenger.start
@@ -39,7 +40,7 @@ end
msg = Qpid::Proton::Message.new
begin
- messenger.receive(10)
+ messenger.receive(1)
rescue Qpid::Proton::ProtonError => error
puts "ERROR: #{error.message}"
exit
@@ -49,14 +50,14 @@ msg = Qpid::Proton::Message.new
begin
messenger.get(msg)
# for 0.5:
- messenger.accept()
+ # messenger.accept()
# for 0.4:
#messenger.accept(messenger.incoming_tracker, 0)#1 would mean cumulative
# optional and the same in both versions (messenger will
# settle itself when tracker passes out the window)
- messenger.settle(messenger.incoming_tracker, 0)
+ # messenger.settle(messenger.incoming_tracker)
rescue Qpid::Proton::Error => error
@@ -66,7 +67,7 @@ msg = Qpid::Proton::Message.new
puts "Address: #{msg.address}"
puts "Subject: #{msg.subject}"
- puts "Content: #{msg.content}"
+ puts "Content: #{msg.body}"
puts "Message ID: #{msg.id}"
end
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/5ea0a305/examples/jms/proton-ruby/src/main/scripts/send.rb
----------------------------------------------------------------------
diff --git a/examples/jms/proton-ruby/src/main/scripts/send.rb b/examples/jms/proton-ruby/src/main/scripts/send.rb
old mode 100644
new mode 100755
index ab4a2a4..1287280
--- a/examples/jms/proton-ruby/src/main/scripts/send.rb
+++ b/examples/jms/proton-ruby/src/main/scripts/send.rb
@@ -26,7 +26,7 @@ messenger.start
msg = Qpid::Proton::Message.new
msg.address = address
msg.subject = "The time is #{Time.new}"
-msg.content = "Hello world!"
+msg.body = "Hello world!"
msg.correlation_id = "554545"
begin
@@ -44,6 +44,6 @@ rescue Qpid::Proton::ProtonError => error
exit
end
-puts "SENT: " + msg.content
+puts "SENT: " + msg.body
messenger.stop
[3/3] activemq-6 git commit: Merge PR #187 and #188
Posted by ma...@apache.org.
Merge PR #187 and #188
Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/c062d68a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/c062d68a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/c062d68a
Branch: refs/heads/master
Commit: c062d68a4997fb25d7fbf169df72b9d4298c6874
Parents: 0d599b8 6a45d94
Author: Martyn Taylor <mt...@redhat.com>
Authored: Mon Mar 16 17:30:57 2015 +0000
Committer: Martyn Taylor <mt...@redhat.com>
Committed: Mon Mar 16 17:30:57 2015 +0000
----------------------------------------------------------------------
examples/core/embedded-remote/readme.html | 2 +-
examples/core/embedded/readme.html | 2 +-
examples/jms/proton-cpp/pom.xml | 57 ++++----
.../activemq/jms/example/ProtonCPPExample.java | 141 +++++++++++++++++++
.../src/main/resources/jndi.properties | 20 +++
.../jms/proton-ruby/src/main/scripts/receive.rb | 9 +-
.../jms/proton-ruby/src/main/scripts/send.rb | 4 +-
7 files changed, 200 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
[2/3] activemq-6 git commit: Fixing Proton CPP example
Posted by ma...@apache.org.
Fixing Proton CPP example
For some reason the ProtonCPP is missing a Java class to send and receive messages
also fixing the pom properly accordingly to other examples
This closes #187 as I did some rebasing in top of Howard's
Project: http://git-wip-us.apache.org/repos/asf/activemq-6/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-6/commit/6a45d947
Tree: http://git-wip-us.apache.org/repos/asf/activemq-6/tree/6a45d947
Diff: http://git-wip-us.apache.org/repos/asf/activemq-6/diff/6a45d947
Branch: refs/heads/master
Commit: 6a45d9476945baa83b0782612b26550720756a9e
Parents: 5ea0a30
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Mar 16 11:34:01 2015 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Mar 16 12:37:01 2015 -0400
----------------------------------------------------------------------
examples/jms/proton-cpp/pom.xml | 58 ++++----
.../activemq/jms/example/ProtonCPPExample.java | 141 +++++++++++++++++++
.../src/main/resources/jndi.properties | 20 +++
3 files changed, 191 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/6a45d947/examples/jms/proton-cpp/pom.xml
----------------------------------------------------------------------
diff --git a/examples/jms/proton-cpp/pom.xml b/examples/jms/proton-cpp/pom.xml
index a7888b4..f502319 100644
--- a/examples/jms/proton-cpp/pom.xml
+++ b/examples/jms/proton-cpp/pom.xml
@@ -33,31 +33,14 @@ under the License.
<dependencies>
<dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core-client</artifactId>
+ <groupId>org.apache.activemq.examples.jms</groupId>
+ <artifactId>activemq-jms-examples-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-commons</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
- <version>${geronimo.jms.2.spec.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-amqp-protocol</artifactId>
- <version>${project.version}</version>
</dependency>
-
</dependencies>
<profiles>
@@ -68,6 +51,7 @@ under the License.
<plugin>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-maven-plugin</artifactId>
+ <version>${project.version}</version>
<executions>
<execution>
<id>start</id>
@@ -75,8 +59,6 @@ under the License.
<goal>start</goal>
</goals>
<configuration>
- <waitOnStart>true</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
<systemProperties>
<property>
<name>data.dir</name>
@@ -85,13 +67,29 @@ under the License.
</systemProperties>
</configuration>
</execution>
+ <execution>
+ <id>runClient</id>
+ <goals>
+ <goal>runClient</goal>
+ </goals>
+ <configuration>
+ <clientClass>org.apache.activemq.jms.example.ProtonCPPExample</clientClass>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
</executions>
- <configuration>
- <waitOnStart>false</waitOnStart>
- <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
- </configuration>
<dependencies>
<dependency>
+ <groupId>org.apache.activemq.examples.jms</groupId>
+ <artifactId>activemq-jms-protoncpp</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core-client</artifactId>
<version>${project.version}</version>
@@ -122,15 +120,19 @@ under the License.
<version>${netty.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_2.0_spec</artifactId>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_2.0_spec</artifactId>
+ <version>${geronimo.jms.2.spec.version}</version>
</dependency>
</dependencies>
+ <configuration>
+ <waitOnStart>false</waitOnStart>
+ <configurationDir>${basedir}/target/classes/activemq/server0</configurationDir>
+ </configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
-
</project>
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/6a45d947/examples/jms/proton-cpp/src/main/java/org/apache/activemq/jms/example/ProtonCPPExample.java
----------------------------------------------------------------------
diff --git a/examples/jms/proton-cpp/src/main/java/org/apache/activemq/jms/example/ProtonCPPExample.java b/examples/jms/proton-cpp/src/main/java/org/apache/activemq/jms/example/ProtonCPPExample.java
new file mode 100644
index 0000000..564d827
--- /dev/null
+++ b/examples/jms/proton-cpp/src/main/java/org/apache/activemq/jms/example/ProtonCPPExample.java
@@ -0,0 +1,141 @@
+/**
+ * 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.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueRequestor;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.apache.activemq.api.jms.ActiveMQJMSClient;
+import org.apache.activemq.api.jms.ActiveMQJMSConstants;
+import org.apache.activemq.api.jms.management.JMSManagementHelper;
+
+import org.apache.activemq.common.example.ActiveMQExample;
+
+/**
+ * This example demonstrates the use of ActiveMQ "pre-acknowledge" functionality where
+ * messages are acknowledged before they are delivered to the consumer.
+ *
+ * Please see the readme.html for more details.
+ */
+public class ProtonCPPExample extends ActiveMQExample
+{
+ public static void main(final String[] args)
+ {
+ new ProtonCPPExample().run(args);
+ }
+
+ @Override
+ public boolean runExample() throws Exception
+ {
+ Connection connection = null;
+
+ InitialContext initialContext = null;
+ try
+ {
+ // Step 1. Create an initial context to perform the JNDI lookup.
+ initialContext = new InitialContext();
+
+ // Step 2. Perform the look-ups
+ Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");
+
+ ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("ConnectionFactory");
+
+ // Step 3. Create a the JMS objects
+ connection = cf.createConnection();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+
+ MessageProducer producerAnswer = session.createProducer(queue);
+
+ // Step 4. Start the connection
+ connection.start();
+
+ System.out.println("On a shell script, execute the following:");
+
+ System.out.println("./compile.sh");
+
+ System.out.println("./hello");
+
+ // Step 5. Finally, receive the message
+ Message messageReceived = messageConsumer.receive(5000);
+
+ if (messageReceived == null)
+ {
+ // We are not going to issue this as an error because
+ // we also use this example as part of our tests on activemq6
+ // this is not considered an error, just that no messages arrived (i.e. hello wasn't called)
+ }
+ else
+ {
+ System.out.println("message received: " + messageReceived);
+
+ // Sending message back to client
+ producerAnswer.send(session.createTextMessage("HELLO from Apache ActiveMQ"));
+ }
+
+ return true;
+ }
+ finally
+ {
+ // Step 9. Be sure to close our resources!
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
+ if (connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+
+ // To do this we send a management message to get the message count.
+ // In real life you wouldn't create a new session every time you send a management message
+ private int getMessageCount(final Connection connection) throws Exception
+ {
+ QueueSession session = ((QueueConnection)connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management");
+
+ QueueRequestor requestor = new QueueRequestor(session, managementQueue);
+
+ connection.start();
+
+ Message m = session.createMessage();
+
+ JMSManagementHelper.putAttribute(m, "jms.queue.exampleQueue", "messageCount");
+
+ Message response = requestor.request(m);
+
+ int messageCount = (Integer)JMSManagementHelper.getResult(response);
+
+ return messageCount;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/activemq-6/blob/6a45d947/examples/jms/proton-cpp/src/main/resources/jndi.properties
----------------------------------------------------------------------
diff --git a/examples/jms/proton-cpp/src/main/resources/jndi.properties b/examples/jms/proton-cpp/src/main/resources/jndi.properties
new file mode 100644
index 0000000..1cb3686
--- /dev/null
+++ b/examples/jms/proton-cpp/src/main/resources/jndi.properties
@@ -0,0 +1,20 @@
+# 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.jndi.ActiveMQInitialContextFactory
+connectionFactory.ConnectionFactory=tcp://localhost:61616
+queue.queue/exampleQueue=exampleQueue