activemq git commit: Added a test for browsing offline durable subscriber sub
Repository: activemq Updated Branches: refs/heads/master a439a0c6b -> f4f416a09 Added a test for browsing offline durable subscriber sub Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/f4f416a0 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/f4f416a0 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/f4f416a0 Branch: refs/heads/master Commit: f4f416a09343105ac2d57a84bd020cd2e00dbc7b Parents: a439a0c Author: Christian Posta Authored: Mon Jul 20 09:00:13 2015 -0700 Committer: Christian Posta Committed: Mon Jul 20 09:00:13 2015 -0700 -- .../DurableSubscriptionOfflineTest.java | 42 1 file changed, 42 insertions(+) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/f4f416a0/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java -- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java index a1ce526..db029fd 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java @@ -17,10 +17,15 @@ package org.apache.activemq.usecases; import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.jmx.DurableSubscriptionViewMBean; import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.command.MessageId; import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; import org.apache.activemq.store.kahadb.disk.page.PageFile; +import org.apache.activemq.transport.vm.VMTransport; +import org.apache.activemq.transport.vm.VMTransportFactory; +import org.apache.activemq.transport.vm.VMTransportServer; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; @@ -32,6 +37,8 @@ import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; +import javax.management.ObjectName; +import javax.management.openmbean.CompositeData; import java.util.HashSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -92,6 +99,41 @@ public class DurableSubscriptionOfflineTest extends DurableSubscriptionOfflineTe assertEquals(sent, listener.count); } +@Test(timeout = 60 * 1000) +public void testBrowseOfflineSub() throws Exception { +// create durable subscription +Connection con = createConnection(); +Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE); +session.createDurableSubscriber(topic, "SubsId"); +session.close(); +con.close(); + +// send messages +con = createConnection(); +session = con.createSession(false, Session.AUTO_ACKNOWLEDGE); +MessageProducer producer = session.createProducer(null); + +for (int i = 0; i < 10; i++) { +Message message = session.createMessage(); +message.setStringProperty("filter", "true"); +producer.send(topic, message); +} + +Thread.sleep(1 * 1000); + +session.close(); +con.close(); + +// browse the durable sub +ObjectName[] subs = broker.getAdminView().getInactiveDurableTopicSubscribers(); +assertEquals(1, subs.length); +ObjectName subName = subs[0]; +DurableSubscriptionViewMBean sub = (DurableSubscriptionViewMBean) +broker.getManagementContext().newProxyInstance(subName, DurableSubscriptionViewMBean.class, true); +CompositeData[] data = sub.browse(); +assertNotNull(data); +assertEquals(10, data.length); +} @Test(timeout = 60 * 1000) public void testTwoOfflineSubscriptionCanConsume() throws Exception {
activemq git commit: unit tests for https://issues.apache.org/jira/browse/AMQ-5153 LevelDB does not store subscribedDestination for durable subscriptions
Repository: activemq Updated Branches: refs/heads/master c35fcb3bc -> 01f56d0ca unit tests for https://issues.apache.org/jira/browse/AMQ-5153 LevelDB does not store subscribedDestination for durable subscriptions Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/01f56d0c Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/01f56d0c Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/01f56d0c Branch: refs/heads/master Commit: 01f56d0ca255852bf9c12b889abd8d1297a2b5a9 Parents: c35fcb3 Author: Christian Posta Authored: Mon Apr 20 07:46:03 2015 -0700 Committer: Christian Posta Committed: Mon Apr 20 07:46:41 2015 -0700 -- .../AMQ5153LevelDBSubscribedDestTest.java | 112 +++ 1 file changed, 112 insertions(+) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/01f56d0c/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/AMQ5153LevelDBSubscribedDestTest.java -- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/AMQ5153LevelDBSubscribedDestTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/AMQ5153LevelDBSubscribedDestTest.java new file mode 100644 index 000..3ddad33 --- /dev/null +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/AMQ5153LevelDBSubscribedDestTest.java @@ -0,0 +1,112 @@ +/** + * 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.usecases; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.region.*; +import org.apache.activemq.command.ActiveMQDestination; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jms.*; +import javax.jms.Destination; +import javax.jms.Topic; +import java.net.URI; + +/** + * Created by ceposta + * http://christianposta.com/blog>http://christianposta.com/blog. + */ +public class AMQ5153LevelDBSubscribedDestTest extends org.apache.activemq.TestSupport { + +private static final Logger LOG = LoggerFactory.getLogger(AMQ5153LevelDBSubscribedDestTest.class); +protected BrokerService brokerService; + +@Override +protected void setUp() throws Exception { +super.setUp(); +brokerService = createBroker(); +getConnectionFactory().setClientID(getName()); +} + +@Override +protected void tearDown() throws Exception { +brokerService.stop(); +brokerService.waitUntilStopped(); +} + +protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { +return new ActiveMQConnectionFactory("vm://localhost"); +} + +protected BrokerService createBroker() throws Exception { +BrokerService broker = BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=true")); +setPersistenceAdapter(broker, PersistenceAdapterChoice.LevelDB); +broker.deleteAllMessages(); +broker.start(); +broker.waitUntilStarted(); +return broker; +} + +@Test +public void testWildcardDurableSubscriptions() throws Exception { + +Destination wildcardJmsDest = createDestination("testing.durable.>"); +Destination testJmsDest = createDestination("testing.durable.test"); + +Connection conn = createConnection(); +Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); +MessageConsumer wildcardConsumer = sess.createDurableSubscriber((Topic) wildcardJmsDest, "durable1"); +MessageConsumer testConsumer = sess.createDurableSubscriber((Topic) testJmsDest, "durable2"); + + +MessageProducer producer = sess.createProducer(createDestination("testing.durable.>")); +producer.send(sess.createTextMessage("hello!"
activemq git commit: https://issues.apache.org/jira/browse/AMQ-5672 Added an option for allowing only a single selector for the virtual destination selector cache. also added some JMX views into the s
Repository: activemq Updated Branches: refs/heads/master e16d05436 -> 61da1faa4 https://issues.apache.org/jira/browse/AMQ-5672 Added an option for allowing only a single selector for the virtual destination selector cache. also added some JMX views into the selector cache that can be used at runtime. includes unit tests Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/61da1faa Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/61da1faa Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/61da1faa Branch: refs/heads/master Commit: 61da1faa4c4e49191b373049ee36434aaad58897 Parents: e16d054 Author: Christian Posta Authored: Thu Mar 12 18:14:09 2015 -0700 Committer: Christian Posta Committed: Mon Apr 6 16:12:20 2015 -0700 -- .../activemq/broker/jmx/BrokerMBeanSupport.java | 7 + .../VirtualDestinationSelectorCacheView.java| 49 ++ ...irtualDestinationSelectorCacheViewMBean.java | 36 + .../network/DemandForwardingBridgeSupport.java | 2 +- .../plugin/SubQueueSelectorCacheBroker.java | 157 - .../SubQueueSelectorCacheBrokerPlugin.java | 35 +- .../apache/activemq/util/ProducerThread.java| 68 +- .../activemq/JmsMultipleBrokersTestSupport.java | 21 + ...VirtualTopicSelectorAwareForwardingTest.java | 693 +++ .../org/apache/activemq/util/MessageIdList.java | 5 +- 10 files changed, 1042 insertions(+), 31 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/61da1faa/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerMBeanSupport.java -- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerMBeanSupport.java b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerMBeanSupport.java index e7d888d..43254c5 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerMBeanSupport.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerMBeanSupport.java @@ -161,6 +161,13 @@ public class BrokerMBeanSupport { return createNetworkConnectorName(brokerObjectName.toString(), type, name); } +public static ObjectName createVirtualDestinationSelectorCacheName(ObjectName brokerObjectName, String type, String name) throws MalformedObjectNameException { +String objectNameStr = brokerObjectName.toString(); +objectNameStr += ",service=" + type + ",virtualDestinationSelectoCache="+ JMXSupport.encodeObjectNamePart(name); +ObjectName objectName = new ObjectName(objectNameStr); +return objectName; +} + public static ObjectName createNetworkConnectorName(String brokerObjectName, String type, String name) throws MalformedObjectNameException { String objectNameStr = brokerObjectName; objectNameStr += ",connector=" + type + ",networkConnectorName="+ JMXSupport.encodeObjectNamePart(name); http://git-wip-us.apache.org/repos/asf/activemq/blob/61da1faa/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/VirtualDestinationSelectorCacheView.java -- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/VirtualDestinationSelectorCacheView.java b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/VirtualDestinationSelectorCacheView.java new file mode 100644 index 000..6fbb33e --- /dev/null +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/VirtualDestinationSelectorCacheView.java @@ -0,0 +1,49 @@ +/** + * 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.broker.jmx; + +import org.apache.activemq.plugin.SubQueueSelectorCacheBroker; + +import java.util.Set; + +/** + * Created by ceposta + * http://christianposta.com/blog>http://christianposta.com/blog. + */ +public class VirtualDestinationSelectorCacheView implement
activemq git commit: fix the inconsistency with ElectingLevelDBStore.isMaster() under AMQ-5082 unit test conditions
Repository: activemq Updated Branches: refs/heads/master 3d6bb7c39 -> a6243225c fix the inconsistency with ElectingLevelDBStore.isMaster() under AMQ-5082 unit test conditions Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/a6243225 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/a6243225 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/a6243225 Branch: refs/heads/master Commit: a6243225c5be2f8eaa7121e9616315e1b5661483 Parents: 3d6bb7c Author: James A. Robinson Authored: Tue Mar 31 19:51:15 2015 -0700 Committer: Christian Posta Committed: Wed Apr 1 07:36:52 2015 -0700 -- .../apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/a6243225/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala -- diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala index 331d06b..a47baab 100644 --- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala +++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala @@ -228,6 +228,7 @@ class ElectingLevelDBStore extends ProxyLevelDBStore { master_started.set(true) master.blocking_executor.execute(^{ master.start(); + master_stopped.set(false) master_started_latch.countDown() }) master.blocking_executor.execute(^{
activemq git commit: Fix for https://issues.apache.org/jira/browse/AMQ-5082 ActiveMQ replicatedLevelDB cluster breaks, all nodes stop listening.
Repository: activemq Updated Branches: refs/heads/master 351d4b9de -> a39e51e05 Fix for https://issues.apache.org/jira/browse/AMQ-5082 ActiveMQ replicatedLevelDB cluster breaks, all nodes stop listening. Many thanks to Jim Robinson (jim.robin...@gmail.com) for the patch! Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/a39e51e0 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/a39e51e0 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/a39e51e0 Branch: refs/heads/master Commit: a39e51e0519852332f7779443c3db09b6e691d49 Parents: 351d4b9 Author: Christian Posta Authored: Mon Mar 30 17:07:12 2015 -0700 Committer: Christian Posta Committed: Mon Mar 30 17:07:42 2015 -0700 -- .../replicated/groups/ZooKeeperGroup.scala | 30 -- .../leveldb/test/ElectingLevelDBStoreTest.java | 61 +++ .../leveldb/test/ZooKeeperTestSupport.java | 6 +- .../zookeeper/server/TestServerCnxnFactory.java | 101 +++ 4 files changed, 188 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/a39e51e0/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/groups/ZooKeeperGroup.scala -- diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/groups/ZooKeeperGroup.scala b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/groups/ZooKeeperGroup.scala index 39399d1..99808ed 100644 --- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/groups/ZooKeeperGroup.scala +++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/groups/ZooKeeperGroup.scala @@ -72,7 +72,9 @@ object ZooKeeperGroup { */ class ZooKeeperGroup(val zk: ZKClient, val root: String) extends LifecycleListener with ChangeListenerSupport { - val tree = new ZooKeeperTreeTracker[Array[Byte]](zk, new ZKByteArrayDataReader, root, 1) + var tree = new ZooKeeperTreeTracker[Array[Byte]](zk, new ZKByteArrayDataReader, root, 1) + var rebuildTree = false + val joins = HashMap[String, Int]() var members = new LinkedHashMap[String, Array[Byte]] @@ -82,12 +84,13 @@ class ZooKeeperGroup(val zk: ZKClient, val root: String) extends LifecycleListen zk.registerListener(this) create(root) - tree.track(new NodeEventsListener[Array[Byte]]() { + var treeEventHandler = new NodeEventsListener[Array[Byte]]() { def onEvents(events: Collection[NodeEvent[Array[Byte]]]): Unit = { if( !closed ) -fire_cluster_change +fire_cluster_change; } - }) + } + tree.track(treeEventHandler) fire_cluster_change @volatile @@ -110,7 +113,21 @@ class ZooKeeperGroup(val zk: ZKClient, val root: String) extends LifecycleListen } def connected = zk.isConnected - def onConnected() = fireConnected() + def onConnected() = { +this.synchronized { + // underlying ZooKeeperTreeTracker isn't rebuilding itself after + // the loss of the session, so we need to destroy/rebuild it on + // reconnect. + if (rebuildTree) { +tree.destroy +tree = new ZooKeeperTreeTracker[Array[Byte]](zk, new ZKByteArrayDataReader, root, 1) +tree.track(treeEventHandler) + } else { +rebuildTree = true + } +} +fireConnected() + } def onDisconnected() = { this.members = new LinkedHashMap() fireDisconnected() @@ -187,5 +204,4 @@ class ZooKeeperGroup(val zk: ZKClient, val root: String) extends LifecycleListen } } } - -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/activemq/blob/a39e51e0/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java -- diff --git a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java index 8dcaa8e..4d852de 100644 --- a/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java +++ b/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java @@ -182,6 +182,67 @@ public class ElectingLevelDBStoreTest extends ZooKeeperTestSupport { }); } +/* + * testAMQ5082 tests the behavior of an ElectingLevelDBStore + * pool when ZooKeeper I/O timeouts occur. See issue AMQ-5082. + */ +@Test(timeout = 1000 * 60 * 5) +public void testAMQ5082() throws Throwable { +final ArrayList stores = new ArrayList(); + +LOG.info("Launching 3 stores"); +
activemq git commit: Fix for https://issues.apache.org/jira/browse/AMQ-5689 Queue dispatching hangs when there are redelivered messages that dont match current consumers selectors, refactored out the
not actually get dispatched. if (list != null && !list.isEmpty()) { -if (redeliveredWaitingDispatch.isEmpty() && pagedInPendingDispatch.isEmpty()) { -pagedInPendingDispatch.addAll(doActualDispatch(list)); +if (dispatchPendingList.isEmpty()) { +dispatchPendingList.addAll(doActualDispatch(list)); } else { for (MessageReference qmr : list) { -if (!pagedInPendingDispatch.contains(qmr)) { -pagedInPendingDispatch.addMessageLast(qmr); +if (!dispatchPendingList.contains(qmr)) { +dispatchPendingList.addMessageLast(qmr); } } doWakeUp = true; @@ -2192,10 +2167,10 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index pagedInPendingDispatchLock.writeLock().lock(); try { -for (MessageReference ref : pagedInPendingDispatch) { +for (MessageReference ref : dispatchPendingList) { if (messageId.equals(ref.getMessageId())) { message = (QueueMessageReference)ref; -pagedInPendingDispatch.remove(ref); +dispatchPendingList.remove(ref); break; } } @@ -2245,7 +2220,7 @@ public class Queue extends BaseDestination implements Task, UsageListener, Index throw new JMSException("Slave broker out of sync with master - Message: " + messageDispatchNotification.getMessageId() + " on " + messageDispatchNotification.getDestination() + " does not exist among pending(" -+ pagedInPendingDispatch.size() + ") for subscription: " ++ dispatchPendingList.size() + ") for subscription: " + messageDispatchNotification.getConsumerId()); } return message; http://git-wip-us.apache.org/repos/asf/activemq/blob/efc9a8d5/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java -- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java new file mode 100644 index 000..8c6032b --- /dev/null +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/QueueDispatchPendingList.java @@ -0,0 +1,174 @@ +/** + * 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.broker.region.cursors; + +import org.apache.activemq.broker.region.MessageReference; +import org.apache.activemq.broker.region.QueueMessageReference; +import org.apache.activemq.command.MessageId; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +/** + * An abstraction that keeps the correct order of messages that need to be dispatched + * to consumers, but also hides the fact that there might be redelivered messages that + * should be dispatched ahead of any other paged in messages. + * + * Direct usage of this class is recommended as you can control when redeliveries need + * to be added vs regular pending messages (the next set of messages that can be dispatched) + * + * Created by ceposta + * http://christianposta.com/blog>http://christianposta.com/blog. + */ +public class QueueDispatchPendingList implements PendingList { + +private PendingList pagedInPendingDispatch = new OrderedPendingList(); +private PendingList redeliveredWaitingDispatch = new OrderedPendingList(); + + +@Override +public boolean isEmpty() { +return pagedInPendingDispatch.isEmpty() && redeliveredWaitingDispatch.isEmpty(); +} + +@Override +public void clear() { +pagedInPendingDispatch.clear(); +redeliveredWaitingDispatch.c
activemq git commit: removed logging that snuck in there for https://issues.apache.org/jira/browse/AMQ-5578
Repository: activemq Updated Branches: refs/heads/master 3ef8f492a -> 8e551b4c3 removed logging that snuck in there for https://issues.apache.org/jira/browse/AMQ-5578 Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/8e551b4c Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/8e551b4c Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/8e551b4c Branch: refs/heads/master Commit: 8e551b4c3bab232353e133b0443224262f2aa999 Parents: 3ef8f49 Author: Christian Posta Authored: Thu Mar 5 15:27:59 2015 -0700 Committer: Christian Posta Committed: Thu Mar 5 15:53:44 2015 -0700 -- .../org/apache/activemq/store/kahadb/disk/journal/Journal.java| 3 --- 1 file changed, 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/8e551b4c/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java -- diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java index 54386cb..358652d 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/journal/Journal.java @@ -227,7 +227,6 @@ public class Journal { } private void doPreallocationSparseFile(RecoverableRandomAccessFile file) { -LOG.info("Preallocate journal file with sparse file"); try { file.seek(maxFileLength - 1); file.write((byte)0x00); @@ -237,7 +236,6 @@ public class Journal { } private void doPreallocationZeros(RecoverableRandomAccessFile file) { -LOG.info("Preallocate journal file with zeros"); ByteBuffer buffer = ByteBuffer.allocate(maxFileLength); for (int i = 0; i < maxFileLength; i++) { buffer.put((byte) 0x00); @@ -255,7 +253,6 @@ public class Journal { } private void doPreallocationKernelCopy(RecoverableRandomAccessFile file) { -LOG.info("Preallocate journal file with kernel file copying"); // create a template file that will be used to pre-allocate the journal files File templateFile = createJournalTemplateFile();
activemq git commit: Fix for https://issues.apache.org/jira/browse/AMQ-5551 The DiskBenchmark util doesn't sync (fsync) to disk for sync writes
Repository: activemq Updated Branches: refs/heads/master 4c272e308 -> 2c92c3413 Fix for https://issues.apache.org/jira/browse/AMQ-5551 The DiskBenchmark util doesn't sync (fsync) to disk for sync writes Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/2c92c341 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/2c92c341 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/2c92c341 Branch: refs/heads/master Commit: 2c92c34132d72f013ffe4a867187099714f7b231 Parents: 4c272e3 Author: Christian Posta Authored: Fri Feb 20 09:23:12 2015 -0700 Committer: Christian Posta Committed: Fri Feb 20 09:23:12 2015 -0700 -- .../apache/activemq/store/kahadb/disk/util/DiskBenchmark.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/2c92c341/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DiskBenchmark.java -- diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DiskBenchmark.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DiskBenchmark.java index 4cffa6b..de0a41b 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DiskBenchmark.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DiskBenchmark.java @@ -54,7 +54,7 @@ public class DiskBenchmark { try { File file = new File(f); if (file.exists()) { -System.out.println("File " + file + " allready exists, will not benchmark."); +System.out.println("File " + file + " already exists, will not benchmark."); } else { System.out.println("Benchmarking: " + file.getCanonicalPath()); Report report = benchmark.benchmark(file); @@ -206,7 +206,6 @@ public class DiskBenchmark { rc.size = data.length; RecoverableRandomAccessFile raf = new RecoverableRandomAccessFile(file, "rw"); -//RandomAccessFile raf = new RandomAccessFile(file, "rw"); preallocateDataFile(raf, file.getParentFile()); // Figure out how many writes we can do in the sample interval. @@ -249,7 +248,7 @@ public class DiskBenchmark { for (long i = 0; i + data.length < size; i += data.length) { raf.seek(i); raf.write(data); -raf.getChannel().force(false); +raf.getChannel().force(!SKIP_METADATA_UPDATE); ioCount++; now = System.currentTimeMillis(); if ((now - start) > sampleInterval) { @@ -298,7 +297,6 @@ public class DiskBenchmark { if (tmpFile.exists()) { tmpFile.delete(); } -System.out.println("Using a template file: " + tmpFile.getAbsolutePath()); RandomAccessFile templateFile = new RandomAccessFile(tmpFile, "rw"); templateFile.setLength(size); templateFile.getChannel().force(true);
activemq git commit: Updated for https://issues.apache.org/jira/browse/AMQ-5578 adds unit tests, logging, and removes the preallocated batch stuff that snuck in there with commit https://github.com/ap
rt java.nio.channels.FileChannel; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * Created by ceposta + * http://christianposta.com/blog>http://christianposta.com/blog. + */ +public class PreallocationJournalTest { + +@Test +public void testSparseFilePreallocation() throws Exception { +executeTest("sparse_file"); +} + +@Test +public void testOSCopyPreallocation() throws Exception { +executeTest("os_kernel_copy"); +} + +@Test +public void testZerosPreallocation() throws Exception { +executeTest("zeros"); +} + +private void executeTest(String preallocationStrategy)throws Exception { +Random rand = new Random(); +int randInt = rand.nextInt(100); +File dataDirectory = new File("./target/activemq-data/kahadb" + randInt); + +KahaDBStore store = new KahaDBStore(); +store.deleteAllMessages(); +store.setDirectory(dataDirectory); +store.setPreallocationStrategy(preallocationStrategy); +store.start(); + +// time for files to get there.. i know this is a brittle test! need to find +// a better way (callbacks?) to notify when the journal is completely up +TimeUnit.MILLISECONDS.sleep(500); +File journalLog = new File(dataDirectory, "db-1.log"); +assertTrue(journalLog.exists()); + + +FileInputStream is = new FileInputStream(journalLog); +FileChannel channel = is.getChannel(); +assertEquals(Journal.DEFAULT_MAX_FILE_LENGTH, channel.size()); + +channel.position(1 * 1024 * 1024 + 1); +ByteBuffer buff = ByteBuffer.allocate(1); +channel.read(buff); +buff.flip(); +buff.position(0); +assertEquals(0x00, buff.get()); + +System.out.println("File size: " + channel.size()); + + +store.stop(); +} + + +}
activemq git commit: adding options for https://issues.apache.org/jira/browse/AMQ-5578 to allow configuring the allocation strategy at finer grained controls including zeroing out, OS copying, or spar
Repository: activemq Updated Branches: refs/heads/master 8858dc294 -> 45e59e6e8 adding options for https://issues.apache.org/jira/browse/AMQ-5578 to allow configuring the allocation strategy at finer grained controls including zeroing out, OS copying, or sparse file Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/45e59e6e Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/45e59e6e Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/45e59e6e Branch: refs/heads/master Commit: 45e59e6e839ae89ffc099d32a4180ee307543aae Parents: 8858dc2 Author: Christian Posta Authored: Tue Feb 17 08:02:37 2015 -0700 Committer: Christian Posta Committed: Thu Feb 19 10:49:40 2015 -0700 -- .../store/kahadb/KahaDBPersistenceAdapter.java | 16 +++ .../activemq/store/kahadb/MessageDatabase.java | 31 + .../store/kahadb/disk/journal/DataFile.java | 44 +++ .../kahadb/disk/journal/DataFileAppender.java | 8 +- .../store/kahadb/disk/journal/Journal.java | 132 +-- .../store/kahadb/disk/util/DiskBenchmark.java | 32 - 6 files changed, 248 insertions(+), 15 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/45e59e6e/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java -- diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java index 9b83a0e..ebe12f3 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBPersistenceAdapter.java @@ -511,6 +511,22 @@ public class KahaDBPersistenceAdapter extends LockableServiceSupport implements letter.setBrokerService(brokerService); } +public String getPreallocationScope() { +return letter.getPreallocationScope(); +} + +public void setPreallocationScope(String preallocationScope) { +this.letter.setPreallocationScope(preallocationScope); +} + +public String getPreallocationStrategy() { +return letter.getPreallocationStrategy(); +} + +public void setPreallocationStrategy(String preallocationStrategy) { +this.letter.setPreallocationStrategy(preallocationStrategy); +} + public boolean isArchiveDataLogs() { return letter.isArchiveDataLogs(); } http://git-wip-us.apache.org/repos/asf/activemq/blob/45e59e6e/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java -- diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java index 477f42c..9fc29f4 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java @@ -237,8 +237,11 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe long cleanupInterval = 30*1000; int journalMaxFileLength = Journal.DEFAULT_MAX_FILE_LENGTH; int journalMaxWriteBatchSize = Journal.DEFAULT_MAX_WRITE_BATCH_SIZE; +int preallocationBatchSize = Journal.DEFAULT_PREALLOCATION_BATCH_SIZE; boolean enableIndexWriteAsync = false; int setIndexWriteBatchSize = PageFile.DEFAULT_WRITE_BATCH_SIZE; +private String preallocationScope = Journal.PreallocationScope.ENTIRE_JOURNAL.name(); +private String preallocationStrategy = Journal.PreallocationStrategy.SPARSE_FILE.name(); protected AtomicBoolean opened = new AtomicBoolean(); private boolean ignoreMissingJournalfiles = false; @@ -2487,6 +2490,10 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe manager.setArchiveDataLogs(isArchiveDataLogs()); manager.setSizeAccumulator(journalSize); manager.setEnableAsyncDiskSync(isEnableJournalDiskSyncs()); + manager.setPreallocationScope(Journal.PreallocationScope.valueOf(preallocationScope.trim().toUpperCase())); +manager.setPreallocationStrategy( + Journal.PreallocationStrategy.valueOf(preallocationStrategy.trim().toUpperCase())); +manager.setPreallocationBatchSize(preallocationBatchSize); if (getDirectoryArchive() != null) { IOHelper.mkdirs(getDirectoryArchive()); manager.setDirectoryArchive(getDirectoryArchive()); @@ -3175,4
[1/2] git commit: Test for https://issues.apache.org/jira/browse/AMQ-5290
est/java/org/apache/activemq/transport/mqtt/MQTTTestSupport.java @@ -339,7 +339,7 @@ public class MQTTTestSupport { } protected MQTTClientProvider getMQTTClientProvider() { -return new FuseMQQTTClientProvider(); +return new FuseMQTTClientProvider(); } protected MQTT createMQTTConnection() throws Exception { http://git-wip-us.apache.org/repos/asf/activemq/blob/c42b8749/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java -- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java new file mode 100644 index 000..bf24971 --- /dev/null +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java @@ -0,0 +1,244 @@ +/** + * 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; + +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.TransportConnector; +import org.apache.activemq.broker.jmx.BrokerViewMBean; +import org.apache.activemq.broker.jmx.DurableSubscriptionViewMBean; +import org.apache.activemq.network.DiscoveryNetworkConnector; +import org.apache.activemq.network.NetworkConnector; +import org.apache.activemq.network.NetworkTestSupport; +import org.apache.activemq.store.PersistenceAdapter; +import org.apache.activemq.util.Wait; +import org.apache.commons.lang.ArrayUtils; +import org.fusesource.hawtdispatch.Dispatch; +import org.fusesource.mqtt.client.*; +import org.fusesource.mqtt.client.Topic; +import org.fusesource.mqtt.codec.MQTTFrame; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.jms.*; +import javax.jms.Message; +import javax.management.ObjectName; +import java.net.URI; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/** + * Created by ceposta + * http://christianposta.com/blog>http://christianposta.com/blog. + */ +public class MQTTNetworkOfBrokersFailoverTest extends NetworkTestSupport { + +private static final Logger LOG = LoggerFactory.getLogger(MQTTNetworkOfBrokersFailoverTest.class); + +private final String subName = "Subscriber1"; +private final String subName2 = "Subscriber2"; +private final String topicName = "TEST.FOO"; +private int localBrokerMQTTPort = -1; +private int remoteBrokerMQTTPort = -1; + +protected void setUp() throws Exception { +useJmx=true; +super.setUp(); + +URI ncUri = new URI("static:(" + connector.getConnectUri().toString() + ")"); +NetworkConnector nc = new DiscoveryNetworkConnector(ncUri); +nc.setDuplex(true); +remoteBroker.addNetworkConnector(nc); +nc.start(); + +// mqtt port should have been assigned by now +assertFalse(localBrokerMQTTPort == -1); +assertFalse(remoteBrokerMQTTPort == -1); +} + +protected void tearDown() throws Exception { +if (remoteBroker.isStarted()) { +remoteBroker.stop(); +remoteBroker.waitUntilStopped(); +} +if (broker.isStarted()) { +broker.stop(); +broker.waitUntilStopped(); +} +super.tearDown(); +} + +@Test +public void testNoStaleSubscriptionAcrossNetwork() throws Exception { + +// before we get started, we want an async way to be able to know when +// the durable consumer has been networked so we can assert that it indeed +// would have a durable subscriber. for example, when we subscribe on remote broker, +// a network-sub would be created on local broker and we want to listen for when that +// even happens. we do that with advisory messages and a latch: +CountDownLatch consumerNetworked = listenForConsumersOn(broker); + + +// create a subscription with Clean == 0 (durable sub for QoS==1 && QoS==2) +// on the remote broker. this sub should still be there after we dis
[2/2] git commit: Updated test for https://issues.apache.org/jira/browse/AMQ-5290 after tbish commit for enhancement.
Updated test for https://issues.apache.org/jira/browse/AMQ-5290 after tbish commit for enhancement. Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/0d9eedc6 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/0d9eedc6 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/0d9eedc6 Branch: refs/heads/trunk Commit: 0d9eedc658a84b15cee9efcd0fe991a5345324da Parents: c42b874 Author: Christian Posta Authored: Wed Aug 6 17:02:17 2014 -0700 Committer: Christian Posta Committed: Wed Aug 6 17:02:17 2014 -0700 -- .../MQTTNetworkOfBrokersFailoverTest.java | 32 1 file changed, 19 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/0d9eedc6/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java -- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java index bf24971..e1ab183 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/MQTTNetworkOfBrokersFailoverTest.java @@ -24,7 +24,6 @@ import org.apache.activemq.network.DiscoveryNetworkConnector; import org.apache.activemq.network.NetworkConnector; import org.apache.activemq.network.NetworkTestSupport; import org.apache.activemq.store.PersistenceAdapter; -import org.apache.activemq.util.Wait; import org.apache.commons.lang.ArrayUtils; import org.fusesource.hawtdispatch.Dispatch; import org.fusesource.mqtt.client.*; @@ -48,10 +47,6 @@ import java.util.concurrent.TimeUnit; public class MQTTNetworkOfBrokersFailoverTest extends NetworkTestSupport { private static final Logger LOG = LoggerFactory.getLogger(MQTTNetworkOfBrokersFailoverTest.class); - -private final String subName = "Subscriber1"; -private final String subName2 = "Subscriber2"; -private final String topicName = "TEST.FOO"; private int localBrokerMQTTPort = -1; private int remoteBrokerMQTTPort = -1; @@ -99,11 +94,12 @@ public class MQTTNetworkOfBrokersFailoverTest extends NetworkTestSupport { BlockingConnection remoteConn = remoteMqtt.blockingConnection(); remoteConn.connect(); remoteConn.subscribe(new Topic[]{new Topic("foo/bar", QoS.AT_LEAST_ONCE)}); + +assertTrue("No destination detected!", consumerNetworked.await(1, TimeUnit.SECONDS)); +assertQueueExistsOn(remoteBroker, "Consumer.foo_AT_LEAST_ONCE.VirtualTopic.foo.bar"); +assertQueueExistsOn(broker, "Consumer.foo_AT_LEAST_ONCE.VirtualTopic.foo.bar"); remoteConn.disconnect(); -consumerNetworked.await(1, TimeUnit.SECONDS); -assertOneDurableSubOn(remoteBroker, "foo"); -assertOneDurableSubOn(broker, "NC_localhost_inbound_local"); // now we reconnect the same sub on the local broker, again with clean==0 MQTT localMqtt = createMQTTTcpConnection("foo", false, localBrokerMQTTPort); @@ -139,17 +135,16 @@ public class MQTTNetworkOfBrokersFailoverTest extends NetworkTestSupport { final CountDownLatch latch = new CountDownLatch(1); URI brokerUri = broker.getVmConnectorURI(); -System.out.println(brokerUri.toASCIIString()); final ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(brokerUri.toASCIIString()); final Connection connection = cf.createConnection(); +connection.start(); final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); -Destination dest = session.createTopic("ActiveMQ.Advisory.Consumer.Topic.foo.bar.>"); +Destination dest = session.createTopic("ActiveMQ.Advisory.Consumer.Queue.Consumer.foo:AT_LEAST_ONCE.VirtualTopic.foo.bar"); MessageConsumer consumer = session.createConsumer(dest); consumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { -System.out.println("got message! " + message); latch.countDown(); // shutdown this connection Dispatch.getGlobalQueue().execute(new Runnable() { @@ -170,6 +165,13 @@ public class MQTTNetworkOfBrokersFailoverTest extends NetworkTestSupport { return latch; } +private void assertQueueExistsOn(BrokerService broker, String queueName) throws Exception { +BrokerViewMBean brokerView = broker.getAdminView(); +ObjectName[] queueNames = brokerView.getQueues(); +assertEquals(1, queueNames.length); + +assertTrue
git commit: Enhancement for https://issues.apache.org/jira/browse/AMQ-5076 -- pooled session creation blocks
Repository: activemq Updated Branches: refs/heads/trunk c3d8ca716 -> dc607bbf3 Enhancement for https://issues.apache.org/jira/browse/AMQ-5076 -- pooled session creation blocks Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/dc607bbf Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/dc607bbf Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/dc607bbf Branch: refs/heads/trunk Commit: dc607bbf3565bd955b7f5237047fdf3bec4cb7bd Parents: c3d8ca7 Author: Christian Posta Authored: Thu Feb 27 08:39:38 2014 -0700 Committer: Christian Posta Committed: Thu Feb 27 08:41:16 2014 -0700 -- .../activemq/jms/pool/ConnectionPool.java | 28 .../jms/pool/PooledConnectionFactory.java | 34 +++- ...PooledSessionExhaustionBlockTimeoutTest.java | 156 +++ .../jms/pool/PooledSessionExhaustionTest.java | 47 +- 4 files changed, 261 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/dc607bbf/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java -- diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java index 08d2038..eced588 100644 --- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java +++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java @@ -296,6 +296,34 @@ public class ConnectionPool { return this.sessionPool.getWhenExhaustedAction() == GenericObjectPool.WHEN_EXHAUSTED_BLOCK; } +/** + * Returns the timeout to use for blocking creating new sessions + * + * @return true if the pooled Connection createSession method will block when the limit is hit. + * @see #setBlockIfSessionPoolIsFull(boolean) + */ +public long getBlockIfSessionPoolIsFullTimeout() { +return this.sessionPool.getMaxWait(); +} + +/** + * Controls the behavior of the internal session pool. By default the call to + * Connection.getSession() will block if the session pool is full. This setting + * will affect how long it blocks and throws an exception after the timeout. + * + * The size of the session pool is controlled by the @see #maximumActive + * property. + * + * Whether or not the call to create session blocks is controlled by the @see #blockIfSessionPoolIsFull + * property + * + * @param blockIfSessionPoolIsFullTimeout - if blockIfSessionPoolIsFullTimeout is true, + *then use this setting to configure how long to block before retry + */ +public void setBlockIfSessionPoolIsFullTimeout(long blockIfSessionPoolIsFullTimeout) { +this.sessionPool.setMaxWait(blockIfSessionPoolIsFullTimeout); +} + @Override public String toString() { return "ConnectionPool[" + connection + "]"; http://git-wip-us.apache.org/repos/asf/activemq/blob/dc607bbf/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java -- diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java index 9ac853d..86f5972 100644 --- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java +++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java @@ -68,6 +68,7 @@ public class PooledConnectionFactory implements ConnectionFactory { private int maximumActiveSessionPerConnection = 500; private int idleTimeout = 30 * 1000; private boolean blockIfSessionPoolIsFull = true; +private long blockIfSessionPoolIsFullTimeout = -1L; private long expiryTimeout = 0l; private boolean createConnectionOnStartup = true; private boolean useAnonymousProducers = true; @@ -102,6 +103,9 @@ public class PooledConnectionFactory implements ConnectionFactory { connection.setExpiryTimeout(getExpiryTimeout()); connection.setMaximumActiveSessionPerConnection(getMaximumActiveSessionPerConnection()); connection.setBlockIfSessionPoolIsFull(isBlockIfSessionPoolIsFull()); +if (isBlockIfSessionPoolIsFull() && getBlockIfSessionPoolIsFullTimeout() > 0) { + connection.setBlockIfSessionPoolIsFullTimeout(getBlockIfSessionPoolIsFullTimeout()); +} conn
git commit: tidy up some things for the 1.7 release including license, notice, and website version
Repository: activemq-apollo Updated Branches: refs/heads/trunk 4cbe349ac -> 1637f4b51 tidy up some things for the 1.7 release including license, notice, and website version Project: http://git-wip-us.apache.org/repos/asf/activemq-apollo/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-apollo/commit/1637f4b5 Tree: http://git-wip-us.apache.org/repos/asf/activemq-apollo/tree/1637f4b5 Diff: http://git-wip-us.apache.org/repos/asf/activemq-apollo/diff/1637f4b5 Branch: refs/heads/trunk Commit: 1637f4b5130683cccec6fa87a6e35f3c5a3182b0 Parents: 4cbe349 Author: Christian Posta Authored: Mon Feb 24 11:44:11 2014 -0700 Committer: Christian Posta Committed: Mon Feb 24 11:44:11 2014 -0700 -- LICENSE | 421 ++ NOTICE | 4 +- apollo-website/ext/Website.scala | 3 +- 3 files changed, 425 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq-apollo/blob/1637f4b5/LICENSE -- diff --git a/LICENSE b/LICENSE index d645695..b318fda 100644 --- a/LICENSE +++ b/LICENSE @@ -200,3 +200,424 @@ 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. + +== +Twitter Bootstrap license: +Font Awesome license: +html5shim licnese: +== +The MIT License (MIT) + +Copyright (c) 2011-2014 Twitter, Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + += +Ember.js license: += +Copyright (c) 2014 Yehuda Katz, Tom Dale and Ember.js contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +=== +The ACE Editor license: +=== +Copyright (c) 2010, Ajax.org B.V. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of Ajax.org B.V. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIM
[1/4] Fix for https://issues.apache.org/jira/browse/AMQ-3621 - Integrate Apache Shiro with ActiveMQ as "security solution" - many thanks to Les Hazlewood (lhazlewood) for the patch!
Repository: activemq Updated Branches: refs/heads/trunk e7e317dc7 -> f9451e56e http://git-wip-us.apache.org/repos/asf/activemq/blob/f9451e56/activemq-shiro/src/test/resources/org/apache/activemq/shiro/no-ini-config.xml -- diff --git a/activemq-shiro/src/test/resources/org/apache/activemq/shiro/no-ini-config.xml b/activemq-shiro/src/test/resources/org/apache/activemq/shiro/no-ini-config.xml new file mode 100644 index 000..f8e04a8 --- /dev/null +++ b/activemq-shiro/src/test/resources/org/apache/activemq/shiro/no-ini-config.xml @@ -0,0 +1,78 @@ + + + + + +http://www.springframework.org/schema/beans"; + xmlns:amq="http://activemq.apache.org/schema/core"; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd + http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd";> + +http://activemq.apache.org/schema/core"; +useJmx="false" persistent="false" populateJMSXUserID="true"> + + + + + + + + + + + +http://www.springframework.org/schema/beans";> + + + + + + + + + + + + + + + + + + +system = manager,system + + + + +system = * + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/activemq/blob/f9451e56/activemq-shiro/src/test/resources/shiro.ini -- diff --git a/activemq-shiro/src/test/resources/shiro.ini b/activemq-shiro/src/test/resources/shiro.ini new file mode 100644 index 000..5231365 --- /dev/null +++ b/activemq-shiro/src/test/resources/shiro.ini @@ -0,0 +1,64 @@ +# +# 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. +# + +[main] + +# Shiro object graph configuration here if desired/necessary + +[users] + +# users section format: +# +# username = password [, assignedRole1, assignedRole2, ..., assignedRoleN] +# +# for example: +# +# scott = tiger, users, administrators, advisory +# +# Roles and permissions assigned to roles are defined in the [roles] section +# below. By transitive association, any user assigned a role is granted the +# role's permissions. + +# ActiveMQ System User +# needed for in-VM/local connections when authentication is enabled: +system = manager, system + +[roles] + +# roles section format: +# +# roleName = wildcardPermission1, wildcardPermission2, ..., wildcardPermissionN + +# The 'system' role is assigned all permissions (*). Be careful when assigning +# this to actual users other than then system user: +system = * + +# Full access rights should generally be given to the ActiveMQ.Advisory.* +# destinations because by default an ActiveMQConnection uses advisory topics to +# get early knowledge of temp destination creation and deletion. For more info: +# +# http://activemq.apache.org/security.html +# +# So we create an 'advisory' role here with a wildcard/catch-all permissions +# for all advisory topics. To make your life easy, ensure you assign this to +# any/all users, e.g. +# +# jsmith = password, advisory, ... + +advisory = topic:ActiveMQ.Advisory* \ No newline at end of file http://git-wip-us.apache.org/repos/asf/activemq/blob/f9451e56/assembly/pom.xml -- diff --git a/assembly/pom.xml b/assembly/pom.xml index a25c085..4c29cf8 100755 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -177,6 +177,10 @@ ${project.groupId} + activemq-shiro + + + ${project.groupId} activemq-spring @@ -286,6 +290,14 @@ geronimo-jta_1.0.1B_spec +
git commit: added time unit for "send timeout" in the javadocs
Updated Branches: refs/heads/trunk d0f1dd666 -> b21dc69e8 added time unit for "send timeout" in the javadocs Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/b21dc69e Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/b21dc69e Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/b21dc69e Branch: refs/heads/trunk Commit: b21dc69e815a97da922f5122d124d317aab7b78e Parents: d0f1dd6 Author: Christian Posta Authored: Mon Dec 9 09:14:38 2013 -0700 Committer: Christian Posta Committed: Mon Dec 9 09:14:38 2013 -0700 -- .../src/main/java/org/apache/activemq/ActiveMQConnection.java| 4 ++-- .../main/java/org/apache/activemq/ActiveMQConnectionFactory.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/b21dc69e/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java -- diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java index 5057323..ec4d38a 100755 --- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java +++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnection.java @@ -1777,14 +1777,14 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon } /** - * @return the sendTimeout + * @return the sendTimeout (in milliseconds) */ public int getSendTimeout() { return sendTimeout; } /** - * @param sendTimeout the sendTimeout to set + * @param sendTimeout the sendTimeout to set (in milliseconds) */ public void setSendTimeout(int sendTimeout) { this.sendTimeout = sendTimeout; http://git-wip-us.apache.org/repos/asf/activemq/blob/b21dc69e/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java -- diff --git a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java index fbbfc2b..58fee6e 100755 --- a/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java +++ b/activemq-client/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java @@ -616,14 +616,14 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne } /** - * @return the sendTimeout + * @return the sendTimeout (in milliseconds) */ public int getSendTimeout() { return sendTimeout; } /** - * @param sendTimeout the sendTimeout to set + * @param sendTimeout the sendTimeout to set (in milliseconds) */ public void setSendTimeout(int sendTimeout) { this.sendTimeout = sendTimeout;
svn commit: r1541592 - in /activemq/activemq-website/template: cms.cfg main.cfg nms.cfg template.vm
Author: ceposta Date: Wed Nov 13 16:29:24 2013 New Revision: 1541592 URL: http://svn.apache.org/r1541592 Log: fix for https://issues.apache.org/jira/browse/AMQ-4880 -- fix the website Modified: activemq/activemq-website/template/cms.cfg activemq/activemq-website/template/main.cfg activemq/activemq-website/template/nms.cfg activemq/activemq-website/template/template.vm Modified: activemq/activemq-website/template/cms.cfg URL: http://svn.apache.org/viewvc/activemq/activemq-website/template/cms.cfg?rev=1541592&r1=1541591&r2=1541592&view=diff == --- activemq/activemq-website/template/cms.cfg (original) +++ activemq/activemq-website/template/cms.cfg Wed Nov 13 16:29:24 2013 @@ -3,4 +3,5 @@ pageCacheFile:/cache/cms.pageCache templateName:template/template.vm outputDir:/cms globalPages:Navigation,Banner,QuickLinks +mainDivClass:wiki-content maincontent Modified: activemq/activemq-website/template/main.cfg URL: http://svn.apache.org/viewvc/activemq/activemq-website/template/main.cfg?rev=1541592&r1=1541591&r2=1541592&view=diff == --- activemq/activemq-website/template/main.cfg (original) +++ activemq/activemq-website/template/main.cfg Wed Nov 13 16:29:24 2013 @@ -3,4 +3,4 @@ pageCacheFile:cache/main.pageCache templateName:template/template.vm outputDir:/ globalPages:Navigation,Banner,QuickLinks - +mainDivClass:wiki-content maincontent Modified: activemq/activemq-website/template/nms.cfg URL: http://svn.apache.org/viewvc/activemq/activemq-website/template/nms.cfg?rev=1541592&r1=1541591&r2=1541592&view=diff == --- activemq/activemq-website/template/nms.cfg (original) +++ activemq/activemq-website/template/nms.cfg Wed Nov 13 16:29:24 2013 @@ -3,4 +3,4 @@ pageCacheFile:/cache/nms.pageCache templateName:template/template.vm outputDir:/nms globalPages:Navigation,Banner,QuickLinks - +mainDivClass:wiki-content maincontent Modified: activemq/activemq-website/template/template.vm URL: http://svn.apache.org/viewvc/activemq/activemq-website/template/template.vm?rev=1541592&r1=1541591&r2=1541592&view=diff == --- activemq/activemq-website/template/template.vm (original) +++ activemq/activemq-website/template/template.vm Wed Nov 13 16:29:24 2013 @@ -81,10 +81,7 @@ $content - -#set($content = $exporter.unwrap($page.getContent())) -$content - +$body
svn commit: r886521 - in /websites/production/activemq/content/cache: cms.pageCache main.pageCache nms.pageCache
Author: ceposta Date: Wed Nov 13 16:29:53 2013 New Revision: 886521 Log: fix for https://issues.apache.org/jira/browse/AMQ-4880 -- fix the website Removed: websites/production/activemq/content/cache/cms.pageCache websites/production/activemq/content/cache/main.pageCache websites/production/activemq/content/cache/nms.pageCache
svn commit: r886370 - in /websites/production/activemq/content/cache: cms.pageCache main.pageCache nms.pageCache
Author: ceposta Date: Tue Nov 12 21:45:18 2013 New Revision: 886370 Log: clear caches Removed: websites/production/activemq/content/cache/cms.pageCache websites/production/activemq/content/cache/main.pageCache websites/production/activemq/content/cache/nms.pageCache
svn commit: r1541242 - /activemq/activemq-website/bin/update-site
Author: ceposta Date: Tue Nov 12 21:24:12 2013 New Revision: 1541242 URL: http://svn.apache.org/r1541242 Log: added 'clean' goal for the mvn build Modified: activemq/activemq-website/bin/update-site Modified: activemq/activemq-website/bin/update-site URL: http://svn.apache.org/viewvc/activemq/activemq-website/bin/update-site?rev=1541242&r1=1541241&r2=1541242&view=diff == --- activemq/activemq-website/bin/update-site (original) +++ activemq/activemq-website/bin/update-site Tue Nov 12 21:24:12 2013 @@ -1,4 +1,4 @@ #!/bin/sh -mvn -Pconfluence,nochecks -e package exec:java $@ +mvn -Pconfluence,nochecks -e clean package exec:java $@ [ $? -eq 0 ] || exit -1
svn commit: r1541237 - /activemq/activemq-website/pom.xml
Author: ceposta Date: Tue Nov 12 21:10:01 2013 New Revision: 1541237 URL: http://svn.apache.org/r1541237 Log: patch applied to use latest versions of libraries. trying to remedy the website code-snippets issue Modified: activemq/activemq-website/pom.xml Modified: activemq/activemq-website/pom.xml URL: http://svn.apache.org/viewvc/activemq/activemq-website/pom.xml?rev=1541237&r1=1541236&r2=1541237&view=diff == --- activemq/activemq-website/pom.xml (original) +++ activemq/activemq-website/pom.xml Tue Nov 12 21:10:01 2013 @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent -5.7.0 +5.9.0 org.apache.activemq @@ -34,7 +34,6 @@ -2.5.2 @@ -44,23 +43,9 @@ -org.apache.cxf -cxf-rt-frontend-jaxws -${cxf.version} - - -org.apache.cxf -cxf-rt-transports-http -${cxf.version} - - -org.apache.velocity -velocity - - -org.ccil.cowan.tagsoup -tagsoup -1.2.1 +org.apache.cxf.site-export +cxf-site-export +1.0-SNAPSHOT
svn commit: r886360 - in /websites/production/activemq/content/cache: cms.pageCache main.pageCache nms.pageCache
Author: ceposta Date: Tue Nov 12 21:14:20 2013 New Revision: 886360 Log: clear cache Removed: websites/production/activemq/content/cache/cms.pageCache websites/production/activemq/content/cache/main.pageCache websites/production/activemq/content/cache/nms.pageCache
svn commit: r1541238 - /activemq/activemq-website/
Author: ceposta Date: Tue Nov 12 21:11:12 2013 New Revision: 1541238 URL: http://svn.apache.org/r1541238 Log: remove svn:externals property Modified: activemq/activemq-website/ (props changed) Propchange: activemq/activemq-website/ ('svn:externals' removed)
svn commit: r886346 - in /websites/production/activemq/content/cache: cms.pageCache docs.pageCache nms.pageCache
Author: ceposta Date: Tue Nov 12 18:56:14 2013 New Revision: 886346 Log: removed cms,docs,nms cache files to regenerate the website Removed: websites/production/activemq/content/cache/cms.pageCache websites/production/activemq/content/cache/docs.pageCache websites/production/activemq/content/cache/nms.pageCache
svn commit: r886345 - /websites/production/activemq/content/cache/main.pageCache
Author: ceposta Date: Tue Nov 12 18:49:51 2013 New Revision: 886345 Log: clear cache for website Removed: websites/production/activemq/content/cache/main.pageCache
git commit: Fix for https://issues.apache.org/jira/browse/AMQ-4823 NetworkConnector not registered in JMX when created from Broker View + unit tests
Updated Branches: refs/heads/trunk ec97d0aad -> c2eb4863a Fix for https://issues.apache.org/jira/browse/AMQ-4823 NetworkConnector not registered in JMX when created from Broker View + unit tests Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/c2eb4863 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/c2eb4863 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/c2eb4863 Branch: refs/heads/trunk Commit: c2eb4863a8cc4de79a7f63fea915bf9397981bb8 Parents: ec97d0a Author: Christian Posta Authored: Thu Oct 24 10:36:00 2013 -0700 Committer: Christian Posta Committed: Thu Oct 24 10:36:00 2013 -0700 -- .../apache/activemq/broker/BrokerService.java | 2 +- .../apache/activemq/broker/jmx/BrokerView.java | 1 + .../apache/activemq/jmx/JmxCreateNCTest.java| 67 3 files changed, 69 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/c2eb4863/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java -- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java index 93ca692..eecab9d 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -2061,7 +2061,7 @@ public class BrokerService implements Service { return BrokerMBeanSupport.createConnectorName(getBrokerObjectName(), "clientConnectors", connector.getName()); } -protected void registerNetworkConnectorMBean(NetworkConnector connector) throws IOException { +public void registerNetworkConnectorMBean(NetworkConnector connector) throws IOException { NetworkConnectorViewMBean view = new NetworkConnectorView(connector); try { ObjectName objectName = createNetworkConnectorObjectName(connector); http://git-wip-us.apache.org/repos/asf/activemq/blob/c2eb4863/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java -- diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java index 91e9609..5bad48b 100755 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/BrokerView.java @@ -352,6 +352,7 @@ public class BrokerView implements BrokerViewMBean { if (connector == null) { throw new NoSuchElementException("Not connector matched the given name: " + discoveryAddress); } +brokerService.registerNetworkConnectorMBean(connector); connector.start(); return connector.getName(); } http://git-wip-us.apache.org/repos/asf/activemq/blob/c2eb4863/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxCreateNCTest.java -- diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxCreateNCTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxCreateNCTest.java new file mode 100644 index 000..e96c596 --- /dev/null +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/jmx/JmxCreateNCTest.java @@ -0,0 +1,67 @@ +/** + * 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.jmx; + +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.jmx.BrokerViewMBean; +import org.apache.activemq.broker.jmx.NetworkConnectorViewMBean; +import org.junit.Test; + +import javax.management.ObjectName; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +/** + * This test shows that when we create a network connector via JMX, + * the NC/bridge
git commit: Fix for https://issues.apache.org/jira/browse/AMQ-4695 where user could not subscribe anonymously even though authn and authz was set up for it
Updated Branches: refs/heads/trunk a3a22efb2 -> a63a8320e Fix for https://issues.apache.org/jira/browse/AMQ-4695 where user could not subscribe anonymously even though authn and authz was set up for it Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/a63a8320 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/a63a8320 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/a63a8320 Branch: refs/heads/trunk Commit: a63a8320eabbe4e988b6d67eb6cf84aa0d294e0a Parents: a3a22ef Author: Christian Posta Authored: Tue Sep 3 12:03:02 2013 -0700 Committer: Christian Posta Committed: Tue Sep 3 12:05:00 2013 -0700 -- .../transport/mqtt/MQTTProtocolConverter.java | 4 +- .../activemq/transport/mqtt/MQTTNioTest.java| 49 2 files changed, 51 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/activemq/blob/a63a8320/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java -- diff --git a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java index 2abc741..ac598e7 100644 --- a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java +++ b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java @@ -209,11 +209,11 @@ public class MQTTProtocolConverter { clientId = connect.clientId().toString(); } -String userName = ""; +String userName = null; if (connect.userName() != null) { userName = connect.userName().toString(); } -String passswd = ""; +String passswd = null; if (connect.password() != null) { passswd = connect.password().toString(); } http://git-wip-us.apache.org/repos/asf/activemq/blob/a63a8320/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNioTest.java -- diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNioTest.java b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNioTest.java index b0d5914..b64a84f 100644 --- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNioTest.java +++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTNioTest.java @@ -16,11 +16,18 @@ */ package org.apache.activemq.transport.mqtt; +import org.apache.activemq.broker.BrokerPlugin; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.command.ActiveMQTopic; +import org.apache.activemq.filter.DestinationMapEntry; +import org.apache.activemq.security.*; import org.apache.activemq.util.Wait; import org.fusesource.mqtt.client.BlockingConnection; import org.fusesource.mqtt.client.MQTT; import org.junit.Test; +import java.util.LinkedList; + import static org.junit.Assert.assertTrue; public class MQTTNioTest extends MQTTTest { @@ -35,6 +42,7 @@ public class MQTTNioTest extends MQTTTest { addMQTTConnector("maxInactivityDuration=-1"); brokerService.start(); MQTT mqtt = createMQTTConnection(); +mqtt.setClientId("test-mqtt"); mqtt.setKeepAlive((short)2); final BlockingConnection connection = mqtt.blockingConnection(); connection.connect(); @@ -49,4 +57,45 @@ public class MQTTNioTest extends MQTTTest { connection.disconnect(); } +@Test +public void testAnonymousUserConnect() throws Exception { +addMQTTConnector(); +configureAuthentication(brokerService); +brokerService.start(); +brokerService.waitUntilStarted(); +MQTT mqtt = createMQTTConnection(); +mqtt.setCleanSession(true); +mqtt.setUserName((String)null); +mqtt.setPassword((String)null); +final BlockingConnection connection = mqtt.blockingConnection(); +connection.connect(); + +System.out.println("Connected!"); + +connection.disconnect(); + +} + +private void configureAuthentication(BrokerService brokerService) throws Exception { +LinkedList users = new LinkedList(); +users.add(new AuthenticationUser("user1", "user1", "anonymous,user1group")); +final SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users); + +DefaultAuthorizationMap map = new DefaultAuthorizationMap(); +LinkedList authz = new LinkedList(); +AuthorizationEntry entry = new AuthorizationEntry(); +entry.setDestination(new ActiveMQTopic(">")); +entry.s
svn commit: r1517556 - in /activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt: AbstractMQTTTest.java MQTTTest.java
Author: ceposta Date: Mon Aug 26 15:21:15 2013 New Revision: 1517556 URL: http://svn.apache.org/r1517556 Log: added test from mailing list to show MQTT --> JMS mapping works with BytesMessage Modified: activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/AbstractMQTTTest.java activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java Modified: activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/AbstractMQTTTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/AbstractMQTTTest.java?rev=1517556&r1=1517555&r2=1517556&view=diff == --- activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/AbstractMQTTTest.java (original) +++ activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/AbstractMQTTTest.java Mon Aug 26 15:21:15 2013 @@ -41,6 +41,7 @@ import static org.junit.Assert.assertArr public abstract class AbstractMQTTTest extends AutoFailTestSupport { protected TransportConnector mqttConnector; +protected TransportConnector openwireConnector; public static final int AT_MOST_ONCE =0; public static final int AT_LEAST_ONCE = 1; @@ -382,6 +383,10 @@ public abstract class AbstractMQTTTest e mqttConnector = brokerService.addConnector(getProtocolScheme()+"://localhost:0?" + config); } +protected void addOpenwireConnector() throws Exception { +openwireConnector = brokerService.addConnector("tcp://localhost:0"); +} + protected void initializeConnection(MQTTClientProvider provider) throws Exception { provider.connect("tcp://localhost:"+mqttConnector.getConnectUri().getPort()); } Modified: activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java?rev=1517556&r1=1517555&r2=1517556&view=diff == --- activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java (original) +++ activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java Mon Aug 26 15:21:15 2013 @@ -18,6 +18,7 @@ package org.apache.activemq.transport.mq import java.util.concurrent.TimeUnit; +import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.util.Wait; import org.fusesource.mqtt.client.BlockingConnection; import org.fusesource.mqtt.client.MQTT; @@ -30,6 +31,8 @@ import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.jms.*; + public class MQTTTest extends AbstractMQTTTest { private static final Logger LOG = LoggerFactory.getLogger(MQTTTest.class); @@ -76,10 +79,58 @@ public class MQTTTest extends AbstractMQ connection.disconnect(); } -@Test(timeout=30) +@Test(timeout = 30) +public void testJmsMapping() throws Exception { +addMQTTConnector(); +addOpenwireConnector(); +brokerService.start(); + +// start up jms consumer +ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:" + openwireConnector.getConnectUri().getPort()); +Connection jmsConn = factory.createConnection(); +Session session = jmsConn.createSession(false, Session.AUTO_ACKNOWLEDGE); +Destination dest = session.createTopic("test.foo"); +MessageConsumer consumer = session.createConsumer(dest); +jmsConn.start(); + +// set up mqtt producer +MQTT mqtt = createMQTTConnection(); +mqtt.setClientId("foo3"); +mqtt.setKeepAlive((short)2); +final BlockingConnection connection = mqtt.blockingConnection(); +connection.connect(); + +int messagesToSend = 5; + +// publish +for (int i = 0; i < messagesToSend; ++i) { +connection.publish("test/foo", "hello world".getBytes(), QoS.AT_LEAST_ONCE, false); +} + +connection.disconnect(); + +for (int i = 0; i < messagesToSend; i++) { + +javax.jms.Message message = consumer.receive(2 * 1000); +assertNotNull(message); +assertTrue(message instanceof BytesMessage); +BytesMessage bytesMessage = (BytesMessage) message; + +int length = (int) bytesMessage.getBodyLength(); +byte[] buffer = new byte[length]; +bytesMessage.readBytes(buffer); +assertEquals("hello world", new String(buffer)); +} + +jmsConn.close(); + +} + +@Test(timeout
svn commit: r1513995 - /activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala
Author: ceposta Date: Wed Aug 14 18:08:17 2013 New Revision: 1513995 URL: http://svn.apache.org/r1513995 Log: updated test for https://issues.apache.org/jira/browse/APLO-335 Modified: activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala Modified: activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala?rev=1513995&r1=1513994&r2=1513995&view=diff == --- activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala (original) +++ activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala Wed Aug 14 18:08:17 2013 @@ -41,9 +41,16 @@ class MqttExistingSessionTest extends Mq } test("Subscribe") { + connect() -subscribe("foo/#") -publish("foo/A", "1", EXACTLY_ONCE) -should_receive("1", "foo/A") + +var client2 = create_client +client2.setCleanSession(false); +client2.setClientId("another") +connect(c = client2) + +subscribe(topic = "1/#", c = client2) +publish("1/data/apps/crm/Opportunity/60", "2", EXACTLY_ONCE) +should_receive(body = "2", topic = "1/data/apps/crm/Opportunity/60", c = client2) } }
svn commit: r1513655 - /activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
Author: ceposta Date: Tue Aug 13 21:09:40 2013 New Revision: 1513655 URL: http://svn.apache.org/r1513655 Log: added quick test for cleanSession=false and wildcard sub for MQTT from IRC chat Modified: activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java Modified: activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java?rev=1513655&r1=1513654&r2=1513655&view=diff == --- activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java (original) +++ activemq/trunk/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java Tue Aug 13 21:09:40 2013 @@ -92,8 +92,9 @@ public class MQTTTest extends AbstractMQ final BlockingConnection connection = mqtt.blockingConnection(); connection.connect(); -Topic[] topics = {new Topic("TopicA", QoS.EXACTLY_ONCE), new Topic("TopicB", QoS.EXACTLY_ONCE)}; -connection.subscribe(topics); +Topic[] topics = {new Topic("Topic/A", QoS.EXACTLY_ONCE), new Topic("Topic/B", QoS.EXACTLY_ONCE)}; +Topic[] wildcardTopic = {new Topic("Topic/#", QoS.AT_LEAST_ONCE)}; +connection.subscribe(wildcardTopic); for (Topic topic : topics) { connection.publish(topic.name().toString(), payload, QoS.AT_LEAST_ONCE, false);
svn commit: r1513607 - /activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala
Author: ceposta Date: Tue Aug 13 18:23:13 2013 New Revision: 1513607 URL: http://svn.apache.org/r1513607 Log: Added test for cleanSession=false and subscribing to wildcard dest Modified: activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala Modified: activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala?rev=1513607&r1=1513606&r2=1513607&view=diff == --- activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala (original) +++ activemq/activemq-apollo/trunk/apollo-mqtt/src/test/scala/org/apache/activemq/apollo/mqtt/test/MqttExistingSessionTest.scala Tue Aug 13 18:23:13 2013 @@ -39,4 +39,11 @@ class MqttExistingSessionTest extends Mq publish("existing/sub", "1", EXACTLY_ONCE) should_receive("1", "existing/sub") } + + test("Subscribe") { +connect() +subscribe("foo/#") +publish("foo/A", "1", EXACTLY_ONCE) +should_receive("1", "foo/A") + } }
svn commit: r1509817 - in /activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources: apollo-openwire-bdb.xml apollo-openwire-leveldb.xml
Author: ceposta Date: Fri Aug 2 19:08:17 2013 New Revision: 1509817 URL: http://svn.apache.org/r1509817 Log: fixed tests that inherited from OpenwireParallelTest after I added DLQ tests. Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml?rev=1509817&r1=1509816&r2=1509817&view=diff == --- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml (original) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-bdb.xml Fri Aug 2 19:08:17 2013 @@ -22,8 +22,9 @@ localhost + - + Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml?rev=1509817&r1=1509816&r2=1509817&view=diff == --- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml (original) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire-leveldb.xml Fri Aug 2 19:08:17 2013 @@ -22,6 +22,7 @@ localhost +
svn commit: r1508902 - in /activemq/activemq-apollo/trunk/apollo-openwire/src/test: resources/apollo-openwire.xml scala/org/apache/activemq/apollo/openwire/test/OpenwireParallelTest.scala
Author: ceposta Date: Wed Jul 31 15:07:20 2013 New Revision: 1508902 URL: http://svn.apache.org/r1508902 Log: Added test for openwire DLQ handling w/ redelivery policy to answer question from mailing list Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/test/OpenwireParallelTest.scala Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml?rev=1508902&r1=1508901&r2=1508902&view=diff == --- activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml (original) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/resources/apollo-openwire.xml Wed Jul 31 15:07:20 2013 @@ -21,6 +21,7 @@ localhost + Modified: activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/test/OpenwireParallelTest.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/test/OpenwireParallelTest.scala?rev=1508902&r1=1508901&r2=1508902&view=diff == --- activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/test/OpenwireParallelTest.scala (original) +++ activemq/activemq-apollo/trunk/apollo-openwire/src/test/scala/org/apache/activemq/apollo/openwire/test/OpenwireParallelTest.scala Wed Jul 31 15:07:20 2013 @@ -18,6 +18,7 @@ package org.apache.activemq.apollo.openw import javax.jms._ import org.apache.activemq.apollo.broker.BrokerParallelTestExecution +import org.apache.activemq.{ActiveMQConnection, RedeliveryPolicy} class OpenwireParallelTest extends OpenwireTestSupport with BrokerParallelTestExecution { @@ -747,4 +748,39 @@ class OpenwireParallelTest extends Openw receive_text(localConsumer) should equal("1") receive_text(localConsumer) should equal("3") } + + test("Rollback moves messages to DLQ"){ +connect() +val redelivery_policy = new RedeliveryPolicy +redelivery_policy.setMaximumRedeliveries(1) + default_connection.asInstanceOf[ActiveMQConnection].setRedeliveryPolicy(redelivery_policy) + +// send our message +val producerSession = default_connection.createSession(false, Session.AUTO_ACKNOWLEDGE) +val destination = producerSession.createQueue("nacker.test") +val producer = producerSession.createProducer(destination) +producer.send(producerSession.createTextMessage("yo")) +producerSession.close() + +// consume and rollback +val consumerSession = default_connection.createSession(true, Session.SESSION_TRANSACTED) +val destination2 = consumerSession.createQueue("nacker.test") +val consumer = consumerSession.createConsumer(destination2) + +var msg = consumer.receive(1000) +msg should not be null +consumerSession.rollback() + +msg = consumer.receive(1500) +msg should not be null +consumerSession.rollback() + +consumerSession.close() + +val dlqSession = default_connection.createSession(false, Session.AUTO_ACKNOWLEDGE) +val dlq = dlqSession.createQueue("dlq.nacker.test") +val dlqConsumer = dlqSession.createConsumer(dlq) +val dlqMsg = dlqConsumer.receive(1000) +dlqMsg should not be null + } } \ No newline at end of file
svn commit: r1508672 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala
Author: ceposta Date: Tue Jul 30 22:30:07 2013 New Revision: 1508672 URL: http://svn.apache.org/r1508672 Log: if there are transport failures, let's raise the level of logging so we see what they are Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala?rev=1508672&r1=1508671&r2=1508672&view=diff == --- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala (original) +++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/Protocol.scala Tue Jul 30 22:30:07 2013 @@ -96,7 +96,7 @@ trait ProtocolHandler { def create_connection_status(debug:Boolean) = new ConnectionStatusDTO def on_transport_failure(error:IOException) = { -trace(error) +info(error) connection.stop(NOOP) }
svn commit: r1508628 - /activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo
Author: ceposta Date: Tue Jul 30 21:11:03 2013 New Revision: 1508628 URL: http://svn.apache.org/r1508628 Log: fix for https://issues.apache.org/jira/browse/APLO-332 - Apollo not starting with cygwin under windows7 Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo?rev=1508628&r1=1508627&r2=1508628&view=diff == --- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo (original) +++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo Tue Jul 30 21:11:03 2013 @@ -110,6 +110,7 @@ fi # For Cygwin, switch paths to Windows format before running java if $cygwin; then + BOOTDIRS=`cygpath --path --windows "${APOLLO_BASE}/lib\:${APOLLO_HOME}/lib"` APOLLO_HOME=`cygpath --windows "$APOLLO_HOME"` if [ ! -z "$APOLLO_BASE" ] ; then APOLLO_BASE=`cygpath --windows "$APOLLO_BASE"`
svn commit: r1508450 - in /activemq/activemq-apollo/trunk: apollo-cli/src/test/resources/example-broker/etc/ apollo-stomp/src/test/resources/ apollo-stomp/src/test/scala/org/apache/activemq/apollo/sto
Author: ceposta Date: Tue Jul 30 14:00:19 2013 New Revision: 1508450 URL: http://svn.apache.org/r1508450 Log: added tests for APLO-325 for broker-side config of max_text_message_size Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgWebSocketTest.scala activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/WebSocketSupport.scala Modified: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/StompWebSocketTests.scala Modified: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties?rev=1508450&r1=1508449&r2=1508450&view=diff == --- activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties (original) +++ activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties Tue Jul 30 14:00:19 2013 @@ -18,7 +18,7 @@ # # Setup the default logging levels # -log4j.rootLogger=DEBUG, console, apollo +log4j.rootLogger=INFO, console, apollo log4j.logger.org.apache.activemq.apollo=DEBUG @@ -35,7 +35,7 @@ log4j.logger.org.apache.activemq.apollo= log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%-5p | %m%n -log4j.appender.console.threshold=DEBUG +log4j.appender.console.threshold=INFO # File Settings log4j.appender.apollo=org.apache.log4j.RollingFileAppender Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml?rev=1508450&view=auto == --- activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml (added) +++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/resources/apollo-stomp-websocket-large.xml Tue Jul 30 14:00:19 2013 @@ -0,0 +1,31 @@ + + +http://activemq.apache.org/schema/activemq/apollo";> + This broker configuration is what the unit tests in this module load up. + + +localhost + + + + + + + + + \ No newline at end of file Added: activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala?rev=1508450&view=auto == --- activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala (added) +++ activemq/activemq-apollo/trunk/apollo-stomp/src/test/scala/org/apache/activemq/apollo/stomp/test/LargeMsgSecureWebSocketTest.scala Tue Jul 30 14:00:19 2013 @@ -0,0 +1,56 @@ +/** + * 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.apollo.stomp.test + +import org.openqa.selenium.By +import java.util.concurrent.TimeUnit._ +/** + * + * @author http://www.christianposta.com/blog";>Christian Posta + */ +class LargeMsgSecureWebSocketTest extends WebSocketSupport with FirefoxWebDriverTrait { + + override def broker_config_uri = "xml:classpath:apollo-stomp-websocket-large.xml" + + // client sends broker large message.. + test("websockets large text messa
svn commit: r1508448 - in /activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc: apollo.ks log4j.properties
Author: ceposta Date: Tue Jul 30 13:59:56 2013 New Revision: 1508448 URL: http://svn.apache.org/r1508448 Log: added log4j and keystore to the dir that IDERunner looks so running from IDE works a little better and can switch to ssl connectors easier Added: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.ks (with props) activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties Added: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.ks URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.ks?rev=1508448&view=auto == Files activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.ks (added) and activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.ks Tue Jul 30 13:59:56 2013 differ Propchange: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.ks -- svn:executable = * Added: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties?rev=1508448&view=auto == --- activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties (added) +++ activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/log4j.properties Tue Jul 30 13:59:56 2013 @@ -0,0 +1,47 @@ +## --- +## 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. +## --- + +# +# Setup the default logging levels +# +log4j.rootLogger=DEBUG, console, apollo +log4j.logger.org.apache.activemq.apollo=DEBUG + + +# +# Uncomment one of the following to enable debug logging +# +# log4j.logger.org.apache.activemq.apollo.broker=DEBUG +# log4j.logger.org.apache.activemq.apollo.broker.store=DEBUG +# log4j.logger.org.apache.activemq.apollo.stomp=DEBUG +# log4j.logger.org.apache.activemq.apollo.web=DEBUG +# log4j.logger.org.apache.activemq.apollo.cli=DEBUG + +# Console Settings +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=%-5p | %m%n +log4j.appender.console.threshold=DEBUG + +# File Settings +log4j.appender.apollo=org.apache.log4j.RollingFileAppender +log4j.appender.apollo.file=${basedir}/target/test.log +log4j.appender.apollo.maxFileSize=5MB +log4j.appender.apollo.maxBackupIndex=5 +log4j.appender.apollo.append=true +log4j.appender.apollo.layout=org.apache.log4j.PatternLayout +log4j.appender.apollo.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
svn commit: r1507037 - /activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
Author: ceposta Date: Thu Jul 25 16:02:09 2013 New Revision: 1507037 URL: http://svn.apache.org/r1507037 Log: add documentation for APLO-325 Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1507037&r1=1507036&r2=1507037&view=diff == --- activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md (original) +++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Thu Jul 25 16:02:09 2013 @@ -267,7 +267,6 @@ to bind. For example: * `ws://[::]:61623` binds to all IPv4 and IPv6 interfaces on port 61623 * `wss://127.0.0.1:0` binds to the loopback interface on a dynamic port - One thing worth noting is that web sockets (just as Ajax) implements the same origin policy, so by default you can access only brokers running on the same host as
svn commit: r871173 - in /websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website: ./ blog/ blog/releases/ community/ documentation/ documentation/schema/ images/ scripts/ style
Author: ceposta Date: Thu Jul 25 16:04:28 2013 New Revision: 871173 Log: [maven-svn-wagon] websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/index.rss websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta1.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta2.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta3.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta4.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta5.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta6.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.0.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.1.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.2.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.3.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.4.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.5.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.6.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/building.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/contributing.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/developers.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/faq.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/release-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/site.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/source.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/support.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/amqp-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/architecture.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/extending-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/getting-started.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/management-api.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/migration-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/module-organization.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/performance-scaling.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/schema/apollo.xsd websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/stomp-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/user-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/verification.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/download.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/images/module-deps-graph.png websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/images/project-logo-vector.png websites/production/activemq
svn commit: r871171 [2/2] - in /websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website: ./ blog/ blog/releases/ community/ documentation/ documentation/schema/ images/ scripts/
Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html == --- websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html (original) +++ websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html Thu Jul 25 15:59:37 2013 @@ -89,11 +89,17 @@ as an MQTT connection. You don't have to all be auto-detected). To force specific protocols over a certain connector there are two ways you can do this. You can choose to not use protocol detection at all and set the connector to be specifically for mqtt: -+ + + Alternatively, you can limit which protocols can be “detected” using the configuration element like this: - + + + + The protocols attribute in the+ element takes space delimited protoco values. The protocol attribtue of the element takes a single protocol, not space delimited. It defaults to @@ -102,7 +108,11 @@ The protocol attribtue of t If you wish to tune the MQTT defaults, you can use the mqtt configuration element within the connector element in the apollo.xml configuration file : - + + + + The mqtt element supports the following configuration attributes: Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html == --- websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html (original) +++ websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html Thu Jul 25 15:59:37 2013 @@ -84,7 +84,11 @@ to the broker, the protocol version that in the apollo.xml configuration file to change the default settings used in the OpenWire protocol implementation. -+ + + + + The openwire element supports the following configuration attributes: @@ -109,7 +113,11 @@ and actually closing it. Default is An example of configuring the OpenWire protocol -+ + + + + Protocol Detection (different that open-wire vesion detection) @@ -120,11 +128,17 @@ the broker, and means you only need to o If you would like to specify a certain connector for OpenWire and another connector for a different protocol, you can explicitly configure the connector to be an OpenWire connector: -+ + + + You can also support a limited subset of protocols: - + + + + Or you can leave it open to any of the supported protocols (default), and the correct protocol will be used depending on what the client is using. You do this by not specifying any protocol settings. @@ -246,7 +260,16 @@ a value of “me”, pass a sele Here's an example of producing the message: -MessageProducer producer = session.createProducer(destination); for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) { TextMessage message = session.createTextMessage("Message #" + i); LOG.info("Sending message #" + i); producer.send(message); Thread.sleep(DELAY); } + +MessageProducer producer = session.createProducer(destination); + +for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) { +TextMessage message = session.createTextMessage("Message #" + i); +LOG.info("Sending message #" + i); +producer.send(message); +Thread.sleep(DELAY); +} + Browing Subscription Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/performance-scaling.html == (empty) Modified: websites/production/activemq/content/apollo+
svn commit: r1507032 - /activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
Author: ceposta Date: Thu Jul 25 15:55:38 2013 New Revision: 1507032 URL: http://svn.apache.org/r1507032 Log: add documentation for APLO-325 Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1507032&r1=1507031&r2=1507032&view=diff == --- activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md (original) +++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Thu Jul 25 15:55:38 2013 @@ -273,7 +273,12 @@ the settings used on the socket: * `binary_transfers` : Should data be sent to the client as binary blobs. Currently not all browsers support binary WebSocket data. Defaults to false. - +* `cors_origin` : Specify cross-origin resource sharing limmitations, including `*` all or individual server + names +* `max_text_message_size` : Specify the size of text messages that the websocket connector can handle +* `max_binary_message_size` : Specify the size of binary messages that the websocket connector can handle +* `max_idle_time` : timeout limitations of the underlying websocket socket + Example configuraiton: {pygmentize:: xml}
svn commit: r1506395 - /activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java
Author: ceposta Date: Wed Jul 24 04:09:15 2013 New Revision: 1506395 URL: http://svn.apache.org/r1506395 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4648 - fix script created by ./bin/activemq create to be able to pass command line args and run in the background Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java?rev=1506395&r1=1506394&r2=1506395&view=diff == --- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java (original) +++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java Wed Jul 24 04:09:15 2013 @@ -289,7 +289,7 @@ public class CreateCommand extends Abstr res.append("#export ACTIVEMQ_OPTS=\"$ACTIVEMQ_OPTS_MEMORY -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties\"\n\n"); res.append("export ACTIVEMQ_HOME=${activemq.home}\n"); res.append("export ACTIVEMQ_BASE=$ACTIVEMQ_BASE\n\n"); - res.append("${ACTIVEMQ_HOME}/bin/activemq \"$*\""); + res.append("${ACTIVEMQ_HOME}/bin/activemq \"$@\""); return res.toString(); }
svn commit: r1503755 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala
Author: ceposta Date: Tue Jul 16 15:23:35 2013 New Revision: 1503755 URL: http://svn.apache.org/r1503755 Log: fixed CORS response headers for allowable methods: Access-Control-Allow-Methods Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala?rev=1503755&r1=1503754&r2=1503755&view=diff == --- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala (original) +++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/AllowAnyOriginFilter.scala Tue Jul 16 15:23:35 2013 @@ -46,7 +46,7 @@ class AllowAnyOriginFilter(val allowed:S } if ( req.getMethod == "OPTIONS" ) { -response.addHeader("Access-Control-Request-Method", "GET, POST, PUT, DELETE"); +response.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE"); req.getHeader("Access-Control-Request-Headers") match { case headers:String=> response.addHeader("Access-Control-Allow-Headers", headers); case _ =>
svn commit: r1503466 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-filter-factory.index
Author: ceposta Date: Mon Jul 15 20:42:57 2013 New Revision: 1503466 URL: http://svn.apache.org/r1503466 Log: updated the protocol-filter-factory to use ProtocolFilter3 and not the deprecrated 2.. the new SimpleProtocolFilter3Factory can deal with backward incompatibility issues Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-filter-factory.index Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-filter-factory.index URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-filter-factory.index?rev=1503466&r1=1503465&r2=1503466&view=diff == --- activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-filter-factory.index (original) +++ activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/protocol-filter-factory.index Mon Jul 15 20:42:57 2013 @@ -14,4 +14,4 @@ ## See the License for the specific language governing permissions and ## limitations under the License. ## --- -org.apache.activemq.apollo.broker.protocol.SimpleProtocolFilter2Factory \ No newline at end of file +org.apache.activemq.apollo.broker.protocol.SimpleProtocolFilter3Factory
svn commit: r1502092 - /activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
Author: ceposta Date: Thu Jul 11 03:09:48 2013 New Revision: 1502092 URL: http://svn.apache.org/r1502092 Log: added a test to AMQP JMSTestClient showing selectors works Modified: activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java Modified: activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java?rev=1502092&r1=1502091&r2=1502092&view=diff == --- activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java (original) +++ activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java Thu Jul 11 03:09:48 2013 @@ -16,20 +16,13 @@ */ package org.apache.activemq.transport.amqp; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.Enumeration; -import javax.jms.Connection; -import javax.jms.ExceptionListener; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.QueueBrowser; -import javax.jms.Session; -import javax.jms.TextMessage; +import javax.jms.*; import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin; import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl; @@ -72,6 +65,44 @@ public class JMSClientTest extends AmqpT } +@Test +public void testSelectors() throws Exception{ +ActiveMQAdmin.enableJMSFrameTracing(); +QueueImpl queue = new QueueImpl("queue://txqueue"); + +Connection connection = createConnection(); +{ +Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); +MessageProducer p = session.createProducer(queue); + +TextMessage message = session.createTextMessage(); +message.setText("hello"); +p.send(message, DeliveryMode.PERSISTENT, 5, 0); + +message = session.createTextMessage(); +message.setText("hello + 9"); +p.send(message, DeliveryMode.PERSISTENT, 9, 0); + +QueueBrowser browser = session.createBrowser(queue); +Enumeration enumeration = browser.getEnumeration(); +int count = 0; +while (enumeration.hasMoreElements()) { +Message m = (Message) enumeration.nextElement(); +assertTrue(m instanceof TextMessage); +count ++; +} + +assertEquals(2, count); + +MessageConsumer consumer = session.createConsumer(queue, "JMSPriority > 8"); +Message msg = consumer.receive(TestConfig.TIMEOUT); +assertNotNull(msg); +assertTrue(msg instanceof TextMessage); +assertEquals("hello + 9", ((TextMessage) msg).getText()); +} +connection.close(); +} + private Connection createConnection() throws JMSException { final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "admin", "password"); final Connection connection = factory.createConnection();
svn commit: r1495926 - in /activemq/activemq-apollo/trunk/apollo-util/src/test: resources/META-INF/services/org.apache.activemq.apollo/ scala/org/apache/activemq/apollo/dto/ scala/org/apache/activemq/
Author: ceposta Date: Mon Jun 24 05:26:14 2013 New Revision: 1495926 URL: http://svn.apache.org/r1495926 Log: Fixed the package names I used, which otherwise broke XmlCodecTest Added: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule1.java - copied, changed from r1495907, activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule2.java - copied, changed from r1495907, activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule3.java - copied, changed from r1495907, activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule3.java Removed: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule3.java Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index?rev=1495926&r1=1495925&r2=1495926&view=diff == --- activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index (original) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index Mon Jun 24 05:26:14 2013 @@ -1,3 +1,3 @@ -org.apache.activemq.apollo.util.test.DtoModule1 -org.apache.activemq.apollo.util.test.DtoModule2 -org.apache.activemq.apollo.util.test.DtoModule3 \ No newline at end of file +org.apache.activemq.apollo.dto.DtoModule1 +org.apache.activemq.apollo.dto.DtoModule2 +org.apache.activemq.apollo.dto.DtoModule3 \ No newline at end of file Copied: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule1.java (from r1495907, activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java) URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule1.java?p2=activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule1.java&p1=activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java&r1=1495907&r2=1495926&rev=1495926&view=diff == --- activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java (original) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule1.java Mon Jun 24 05:26:14 2013 @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.activemq.apollo.util.test; +package org.apache.activemq.apollo.dto; import org.apache.activemq.apollo.util.DtoModule; @@ -26,7 +26,7 @@ public class DtoModule1 implements DtoMo @Override public String dto_package() { -return "org.apache.activemq.apollo.util.test"; +return "org.apache.activemq.apollo.dto"; } @Override Copied: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule2.java (from r1495907, activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java) URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule2.java?p2=activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/dto/DtoModule2.java&p1=activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java&r1=1495907&r2=1495926&rev=1495926&view=diff == --- activemq/activemq-apollo/trunk/apollo-util/src/te
svn commit: r1495907 - in /activemq/activemq-apollo/trunk/apollo-util/src/test: resources/META-INF/services/org.apache.activemq.apollo/ scala/org/apache/activemq/apollo/util/ scala/org/apache/activemq
Author: ceposta Date: Mon Jun 24 02:50:04 2013 New Revision: 1495907 URL: http://svn.apache.org/r1495907 Log: previously committed wrong version of DtoModuleTest.. fixed it up now.. Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule3.java Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index?rev=1495907&r1=1495906&r2=1495907&view=diff == --- activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index (original) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index Mon Jun 24 02:50:04 2013 @@ -1,3 +1,3 @@ org.apache.activemq.apollo.util.test.DtoModule1 org.apache.activemq.apollo.util.test.DtoModule2 -org.apache.activemq.apollo1.util.test.DtoModule3 \ No newline at end of file +org.apache.activemq.apollo.util.test.DtoModule3 \ No newline at end of file Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java?rev=1495907&r1=1495906&r2=1495907&view=diff == --- activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java (original) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java Mon Jun 24 02:50:04 2013 @@ -27,6 +27,9 @@ public class DtoModuleTest { @Test public void testDtoSingletons() { -assertEquals(0, DtoModule$.MODULE$.packages().length); +assertEquals(3, DtoModule$.MODULE$.extension_classes().length); + +// why should this return 3?? there is really only one pacakge +assertEquals(3, DtoModule$.MODULE$.packages().length); } } Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java?rev=1495907&r1=1495906&r2=1495907&view=diff == --- activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java (original) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java Mon Jun 24 02:50:04 2013 @@ -31,6 +31,6 @@ public class DtoModule1 implements DtoMo @Override public Class[] extension_classes() { -return new Class[0]; +return new Class[]{DtoModule1.class, DtoModule2.class, DtoModule3.class}; } } Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java?rev=1495907&r1=1495906&r2=1495907&view=diff == --- activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java (original) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java Mon Jun 24 02:50:04 2013 @@ -29,6 +29,6 @@ public class DtoModule2 implements DtoMo @Override public Class[] extension_classes() { -return new Class[0]; +return new Class[] {DtoModule1.class, DtoModule2.class, DtoModule3.class}; } } Modified: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule3.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule3.
svn commit: r1495901 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/KeyStorage.scala
Author: ceposta Date: Mon Jun 24 02:28:54 2013 New Revision: 1495901 URL: http://svn.apache.org/r1495901 Log: fixed typo in creating key stores Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/KeyStorage.scala Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/KeyStorage.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/KeyStorage.scala?rev=1495901&r1=1495900&r2=1495901&view=diff == --- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/KeyStorage.scala (original) +++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/KeyStorage.scala Mon Jun 24 02:28:54 2013 @@ -39,7 +39,7 @@ class KeyStorage(val config:KeyStorageDT } def create_key_store = { -if( trust_managers==null ) { +if( key_store == null ) { key_store = { val store = KeyStore.getInstance(opt(config.store_type).getOrElse("JKS")) store.load(new FileInputStream(config.file), opt(config.password).getOrElse("").toCharArray())
svn commit: r1495900 - in /activemq/activemq-apollo/trunk/apollo-util/src/test: resources/META-INF/ resources/META-INF/services/ resources/META-INF/services/org.apache.activemq.apollo/ scala/org/apach
Author: ceposta Date: Mon Jun 24 02:28:28 2013 New Revision: 1495900 URL: http://svn.apache.org/r1495900 Log: added simple tests for classloading dto moduels Added: activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/ activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/ activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/ activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule2.java activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule3.java Added: activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index?rev=1495900&view=auto == --- activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index (added) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index Mon Jun 24 02:28:28 2013 @@ -0,0 +1,3 @@ +org.apache.activemq.apollo.util.test.DtoModule1 +org.apache.activemq.apollo.util.test.DtoModule2 +org.apache.activemq.apollo1.util.test.DtoModule3 \ No newline at end of file Added: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java?rev=1495900&view=auto == --- activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java (added) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/DtoModuleTest.java Mon Jun 24 02:28:28 2013 @@ -0,0 +1,32 @@ +/** + * 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.apollo.util; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + */ +public class DtoModuleTest { + +@Test +public void testDtoSingletons() { +assertEquals(0, DtoModule$.MODULE$.packages().length); +} +} Added: activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java?rev=1495900&view=auto == --- activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java (added) +++ activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/test/DtoModule1.java Mon Jun 24 02:28:28 2013 @@ -0,0 +1,36 @@ +/** + * 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/LICENS
svn commit: r1489280 - /activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java
Author: ceposta Date: Tue Jun 4 03:19:05 2013 New Revision: 1489280 URL: http://svn.apache.org/r1489280 Log: wrote a test to answer question on mailing list consumer propogation for virtual topics across a network of two brokers Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java?rev=1489280&view=auto == --- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java (added) +++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java Tue Jun 4 03:19:05 2013 @@ -0,0 +1,205 @@ +/** + * 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.usecases; + +import org.apache.activemq.JmsMultipleBrokersTestSupport; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.region.Destination; +import org.apache.activemq.command.ActiveMQDestination; +import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.command.ActiveMQTopic; +import org.apache.activemq.network.NetworkConnector; +import org.apache.activemq.store.kahadb.KahaDBStore; +import org.apache.activemq.util.MessageIdList; + +import javax.jms.MessageConsumer; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.util.LinkedList; + +import static junit.framework.Assert.assertNotNull; +import static junit.framework.Assert.assertNull; +import static org.apache.activemq.TestSupport.*; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + */ +public class TwoBrokerVirtualTopicForwardingTest extends JmsMultipleBrokersTestSupport { + +public void testBridgeVirtualTopicQueues() throws Exception { + +bridgeAndConfigureBrokers("BrokerA", "BrokerB"); +startAllBrokers(); +waitForBridgeFormation(); + +MessageConsumer clientA = createConsumer("BrokerA", createDestination("Consumer.A.VirtualTopic.tempTopic", false)); +MessageConsumer clientB = createConsumer("BrokerB", createDestination("Consumer.B.VirtualTopic.tempTopic", false)); + + +// give a sec to let advisories propogate +Thread.sleep(500); + +ActiveMQQueue queueA = new ActiveMQQueue("Consumer.A.VirtualTopic.tempTopic"); +Destination destination = getDestination(brokers.get("BrokerA").broker, queueA); +assertEquals(1, destination.getConsumers().size()); + +ActiveMQQueue queueB = new ActiveMQQueue("Consumer.B.VirtualTopic.tempTopic"); +destination = getDestination(brokers.get("BrokerA").broker, queueB); +assertEquals(1, destination.getConsumers().size()); + +ActiveMQTopic virtualTopic = new ActiveMQTopic("VirtualTopic.tempTopic"); +assertNull(getDestination(brokers.get("BrokerA").broker, virtualTopic)); +assertNull(getDestination(brokers.get("BrokerB").broker, virtualTopic)); + +// send some messages +sendMessages("BrokerA", virtualTopic, 1); + +MessageIdList msgsA = getConsumerMessages("BrokerA", clientA); +MessageIdList msgsB = getConsumerMessages("BrokerB", clientB); + +msgsA.waitForMessagesToArrive(1); +msgsB.waitForMessagesToArrive(1); + +// ensure we don't get any more messages +Thread.sleep(2000); + +assertEquals(1, msgsA.getMessageCount()); +assertEquals(1, msgsB.getMessageCount()); + +} + +public void testDontBridgeQueuesWithOnlyQueueConsumers() throws Exception{ +dontBridgeVirtualTopicConsumerQueues("BrokerA", "BrokerB"); + +
svn commit: r1489275 - /activemq/trunk/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
Author: ceposta Date: Tue Jun 4 02:34:00 2013 New Revision: 1489275 URL: http://svn.apache.org/r1489275 Log: wrote a test to answer question on mailing list, shows wildcard subscription with STOMP Modified: activemq/trunk/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java Modified: activemq/trunk/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java?rev=1489275&r1=1489274&r2=1489275&view=diff == --- activemq/trunk/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java (original) +++ activemq/trunk/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java Tue Jun 4 02:34:00 2013 @@ -593,6 +593,44 @@ public class Stomp11Test extends StompTe } @Test +public void testSubscribeWithWildcardSubscription() throws Exception { +String connectFrame = "STOMP\n" + +"login:system\n" + +"passcode:manager\n" + +"accept-version:1.1\n" + +"host:localhost\n" + +"\n" + Stomp.NULL; +stompConnection.sendFrame(connectFrame); + +String f = stompConnection.receiveFrame(); +LOG.debug("Broker sent: " + f); + +assertTrue(f.startsWith("CONNECTED")); + +String message = "SEND\n" + "destination:/queue/a.b.c" + +"\n\n" + "Hello World" + Stomp.NULL; +stompConnection.sendFrame(message); + +message = "SEND\n" + "destination:/queue/a.b" + +"\n\n" + "Hello World" + Stomp.NULL; +stompConnection.sendFrame(message); + + +String frame = "SUBSCRIBE\n" + "destination:/queue/a.b.>" + "\n" + +"id:12345\n" + "ack:auto\n\n" + Stomp.NULL; +stompConnection.sendFrame(frame); + +StompFrame received = stompConnection.receive(); +assertNotNull(received); + +received = stompConnection.receive(); +assertNotNull(received); + +frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL; +stompConnection.sendFrame(frame); +} + +@Test public void testQueueBrowerSubscription() throws Exception { final int MSG_COUNT = 10;
svn commit: r1482180 - /activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala
Author: ceposta Date: Tue May 14 03:37:39 2013 New Revision: 1482180 URL: http://svn.apache.org/r1482180 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4534 When using ElectingLevelDBStore cannot delete all messages on startup Modified: activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala Modified: activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala?rev=1482180&r1=1482179&r2=1482180&view=diff == --- activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala (original) +++ activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala Tue May 14 03:37:39 2013 @@ -264,6 +264,15 @@ class ElectingLevelDBStore extends Proxy this.brokerName = brokerName } + + override def deleteAllMessages { +if(proxy_target != null) proxy_target.deleteAllMessages +else { + info("You instructed the broker to delete all messages (on startup?). " + +"Cannot delete all messages from an ElectingLevelDBStore because we need to decide who the master is first") +} + } + def configure(store: ReplicatedLevelDBStoreTrait) { store.directory = directory store.indexFactory = indexFactory
svn commit: r1480060 - in /activemq/trunk/activemq-leveldb-store/src: main/scala/org/apache/activemq/leveldb/replicated/MasterLevelDBStore.scala test/java/org/apache/activemq/leveldb/test/MasterLevelD
Author: ceposta Date: Tue May 7 20:29:56 2013 New Revision: 1480060 URL: http://svn.apache.org/r1480060 Log: fix for https://issues.apache.org/jira/browse/AMQ-4519 - MasterLevelDBStore does not shutdown its protocol server when stopped made fix and added test Added: activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java Modified: activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterLevelDBStore.scala Modified: activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterLevelDBStore.scala URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterLevelDBStore.scala?rev=1480060&r1=1480059&r2=1480060&view=diff == --- activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterLevelDBStore.scala (original) +++ activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterLevelDBStore.scala Tue May 7 20:29:56 2013 @@ -58,7 +58,7 @@ class MasterLevelDBStore extends LevelDB override def doStop(stopper: ServiceStopper): Unit = { if( transport_server!=null ) { - transport_server.start(NOOP) + stop_protocol_server transport_server = null } super.doStop(stopper) Added: activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java?rev=1480060&view=auto == --- activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java (added) +++ activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/MasterLevelDBStoreTest.java Tue May 7 20:29:56 2013 @@ -0,0 +1,85 @@ +/** + * 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.leveldb.test; + +import junit.framework.TestCase; +import org.apache.activemq.leveldb.replicated.MasterLevelDBStore; + +import java.net.BindException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.URI; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + */ +public class MasterLevelDBStoreTest extends TestCase { + +public void testStoppingStoreStopsTransport() throws Exception { +final MasterLevelDBStore store = new MasterLevelDBStore(); +store.setReplicas(0); + +ExecutorService threads = Executors.newFixedThreadPool(1); +threads.execute(new Runnable() { +@Override +public void run() { +try { +store.start(); +} catch (Exception e) { +e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. +} +} +}); + +// give some time to come up.. +Thread.sleep(2000); +String address = store.transport_server().getBoundAddress(); +URI bindAddress = new URI(address); +System.out.println(address); +Socket socket = new Socket(); +try { +socket.bind(new InetSocketAddress(bindAddress.getHost(), bindAddress.getPort())); +fail("We should not have been able to connect..."); +} catch (BindException e) { +System.out.println("Good. We cannot bind."); +} + + +threads.execute(new Runnable() { +@Override +public void run() { +try { +store.stop(); +} catch (Exception e) { +e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. +
svn commit: r1480059 - in /activemq/trunk/activemq-leveldb-store/src: main/scala/org/apache/activemq/leveldb/replicated/ test/java/org/apache/activemq/leveldb/test/
Author: ceposta Date: Tue May 7 20:29:45 2013 New Revision: 1480059 URL: http://svn.apache.org/r1480059 Log: fixed some small code mistypes in replicated leveldb. Modified: activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterElector.scala activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java Modified: activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala?rev=1480059&r1=1480058&r2=1480059&view=diff == --- activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala (original) +++ activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/ElectingLevelDBStore.scala Tue May 7 20:29:45 2013 @@ -126,7 +126,6 @@ class ElectingLevelDBStore extends Proxy var zk_client: ZKClient = _ var zk_group: Group = _ - var master_elector: MasterElector = _ var position: Long = -1L Modified: activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterElector.scala URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterElector.scala?rev=1480059&r1=1480058&r2=1480059&view=diff == --- activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterElector.scala (original) +++ activemq/trunk/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/MasterElector.scala Tue May 7 20:29:45 2013 @@ -54,7 +54,7 @@ class MasterElector(store: ElectingLevel def join: Unit = this.synchronized { last_state = create_state join(last_state) -add(changle_listener) +add(change_listener) } def elector = this @@ -76,7 +76,7 @@ class MasterElector(store: ElectingLevel rc } - object changle_listener extends ChangeListener { + object change_listener extends ChangeListener { def connected = changed def disconnected = changed Modified: activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java?rev=1480059&r1=1480058&r2=1480059&view=diff == --- activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java (original) +++ activemq/trunk/activemq-leveldb-store/src/test/java/org/apache/activemq/leveldb/test/ElectingLevelDBStoreTest.java Tue May 7 20:29:45 2013 @@ -214,7 +214,7 @@ public class ElectingLevelDBStoreTest ex private ElectingLevelDBStore createStoreNode() { ElectingLevelDBStore store = new ElectingLevelDBStore(); store.setSecurityToken("foo"); -store.setLogSize(1023 * 200); +store.setLogSize(1024 * 200); store.setReplicas(2); store.setZkAddress("localhost:" + connector.getLocalPort()); store.setZkPath("/broker-stores");
svn commit: r1479925 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java activemq-unit-tests/src/test/java/org/apache/activemq/bugs/MessageExpirationReaper
Author: ceposta Date: Tue May 7 14:39:25 2013 New Revision: 1479925 URL: http://svn.apache.org/r1479925 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4516 - Don't decrement topic enqueues when messages are expired Removed the call to decrement the counters, and added unit test Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java?rev=1479925&r1=1479924&r2=1479925&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java Tue May 7 14:39:25 2013 @@ -731,7 +731,6 @@ public class Topic extends BaseDestinati // AMQ-2586: Better to leave this stat at zero than to give the user // misleading metrics. // destinationStatistics.getMessages().decrement(); -destinationStatistics.getEnqueues().decrement(); destinationStatistics.getExpired().increment(); MessageAck ack = new MessageAck(); ack.setAckType(MessageAck.STANDARD_ACK_TYPE); Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java?rev=1479925&r1=1479924&r2=1479925&view=diff == --- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java (original) +++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/MessageExpirationReaperTest.java Tue May 7 14:39:25 2013 @@ -19,12 +19,7 @@ package org.apache.activemq.bugs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import javax.jms.ConnectionFactory; -import javax.jms.MessageProducer; -import javax.jms.Queue; -import javax.jms.QueueBrowser; -import javax.jms.Session; -import javax.jms.TextMessage; +import javax.jms.*; import javax.management.ObjectName; import org.apache.activemq.ActiveMQConnection; @@ -34,6 +29,7 @@ import org.apache.activemq.broker.jmx.De import org.apache.activemq.broker.region.policy.PolicyEntry; import org.apache.activemq.broker.region.policy.PolicyMap; import org.apache.activemq.command.ActiveMQDestination; +import org.apache.activemq.command.ActiveMQTopic; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -60,6 +56,7 @@ public class MessageExpirationReaperTest factory = createConnectionFactory(); connection = (ActiveMQConnection) factory.createConnection(); +connection.setClientID("test-connection"); connection.start(); } @@ -135,6 +132,45 @@ public class MessageExpirationReaperTest assertEquals("Wrong inFlightCount: " + view.getInFlightCount(), 0, view.getInFlightCount()); } +@Test +public void testExpiredMessagesOnTopic() throws Exception{ +Session session = createSession(); + +// use a zero prefetch so messages don't go inflight +ActiveMQTopic destination = new ActiveMQTopic(destinationName + "?consumer.prefetchSize=0"); + +MessageProducer producer = session.createProducer(destination); + +// should have a durable sub because it's a little tricky to get messages to expire in +// non-durable subs.. with durable subs, we can just expire in the topic using the expire +// period.. also.. durable sub has to be "inactive" for the expire checker to actually +// expire the messages +MessageConsumer consumer = session.createDurableSubscriber(destination, "test-durable"); + +producer.setTimeToLive(500); + +final int count = 3; +// Send some messages with an expiration +for (int i = 0; i < count; i++) { +TextMessage message = session.createTextMessage("" + i); +producer.send(message); +} + +DestinationViewMBean view = createView(destination); +// not expired yet... +assertEquals("Incorrect enqueue count", 3, view.getEnqueueCount() ); + +// close consumer so topic thinks consumer is inactive +consumer.close(); + +// Let the messages reach an expiry time +Thread.sleep(2000); + +assertEquals("Incorrect i
svn commit: r1478266 - /activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/BrowseDLQTest.java
Author: ceposta Date: Thu May 2 04:33:10 2013 New Revision: 1478266 URL: http://svn.apache.org/r1478266 Log: test to help debug hawtio not being able to browse DLQ... Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/BrowseDLQTest.java Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/BrowseDLQTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/BrowseDLQTest.java?rev=1478266&view=auto == --- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/BrowseDLQTest.java (added) +++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/BrowseDLQTest.java Thu May 2 04:33:10 2013 @@ -0,0 +1,109 @@ +/** + * 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.usecases; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.jmx.QueueViewMBean; +import org.apache.activemq.broker.region.policy.PolicyEntry; +import org.apache.activemq.broker.region.policy.PolicyMap; +import org.apache.activemq.command.ActiveMQQueue; +import org.junit.After; +import org.junit.Test; + +import javax.jms.*; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.OpenDataException; +import javax.management.openmbean.TabularData; + +import java.util.concurrent.TimeUnit; + +import static junit.framework.Assert.assertNotNull; +import static junit.framework.TestCase.assertTrue; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + */ +public class BrowseDLQTest { + +private static final int NUM_MESSAGES = 100; +private BrokerService brokerService; +private ActiveMQQueue testQueue = new ActiveMQQueue("TEST.FOO"); +private ActiveMQQueue dlq = new ActiveMQQueue("ActiveMQ.DLQ"); + +@Test +public void testCannotBrowseDLQAsTable() throws Exception { +startBroker(); +// send 100 messages to queue with TTL of 1 second +sendMessagesToBeExpired(); + +// let's let the messages expire +TimeUnit.SECONDS.sleep(2); + +assertCanBrowse(); +} + +private void assertCanBrowse() throws MalformedObjectNameException, OpenDataException { +ObjectName queueViewMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=ActiveMQ.DLQ"); +QueueViewMBean queue = (QueueViewMBean) + brokerService.getManagementContext().newProxyInstance(queueViewMBeanName, QueueViewMBean.class, true); +// make sure we have messages here +assertTrue(queue.getQueueSize() > 0); + +CompositeData[] regularBrowse = queue.browse(); +assertNotNull(regularBrowse); + +TabularData tableData = queue.browseAsTable(); +assertNotNull(tableData); + +} + + + +@After +public void tearDown() throws Exception { +brokerService.stop(); +brokerService.waitUntilStopped(); +} + +private void startBroker() throws Exception { +brokerService = BrokerFactory.createBroker("broker:()/localhost?deleteAllMessagesOnStartup=true"); + +PolicyMap policyMap = new PolicyMap(); +PolicyEntry policyEntry = new PolicyEntry(); +policyEntry.setExpireMessagesPeriod(1000); +policyMap.setDefaultEntry(policyEntry); +brokerService.setDestinationPolicy(policyMap); +brokerService.start(); +brokerService.waitUntilStarted(); +} + +private void sendMessagesToBeExpired() throws JMSException, InterruptedException { +ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost"); +Connection connection = factory.createConnection(); +Session session = connection.createSession(fal
svn commit: r1478231 - /activemq/trunk/assembly/src/sample-conf/activemq-leveldb-replicating.xml
Author: ceposta Date: Wed May 1 23:29:15 2013 New Revision: 1478231 URL: http://svn.apache.org/r1478231 Log: added sample config for replicated leveldb store. Added: activemq/trunk/assembly/src/sample-conf/activemq-leveldb-replicating.xml Added: activemq/trunk/assembly/src/sample-conf/activemq-leveldb-replicating.xml URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/sample-conf/activemq-leveldb-replicating.xml?rev=1478231&view=auto == --- activemq/trunk/assembly/src/sample-conf/activemq-leveldb-replicating.xml (added) +++ activemq/trunk/assembly/src/sample-conf/activemq-leveldb-replicating.xml Wed May 1 23:29:15 2013 @@ -0,0 +1,173 @@ + + +http://www.springframework.org/schema/beans"; +xmlns:amq="http://activemq.apache.org/schema/core"; +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; +xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd";> + + + + +file:${activemq.conf}/credentials.properties + + + + +http://activemq.apache.org/schema/core"; brokerName="replicating-broker" dataDirectory="${activemq.data}"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +http://www.springframework.org/schema/beans"; class="org.apache.activemq.hooks.SpringContextHook" /> + + + + + + + + +
svn commit: r1468733 - /activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java
Author: ceposta Date: Wed Apr 17 03:19:59 2013 New Revision: 1468733 URL: http://svn.apache.org/r1468733 Log: updated for https://issues.apache.org/jira/browse/AMQ-4473 Allow enabling remote debug from newly created broker instance Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java?rev=1468733&r1=1468732&r2=1468733&view=diff == --- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java (original) +++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java Wed Apr 17 03:19:59 2013 @@ -282,6 +282,8 @@ public class CreateCommand extends Abstr res.append("ACTIVEMQ_BASE=`dirname \"$PRG\"`/..\n"); res.append("cd \"$saveddir\"\n\n"); res.append("ACTIVEMQ_BASE=`cd \"$ACTIVEMQ_BASE\" && pwd`\n\n"); + res.append("## Enable remote debugging\n"); + res.append("#export ACTIVEMQ_DEBUG_OPTS=\"-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005\"\n\n"); res.append("## Add system properties for this instance here (if needed), e.g\n"); res.append("#export ACTIVEMQ_OPTS_MEMORY=\"-Xms256M -Xmx1G\"\n"); res.append("#export ACTIVEMQ_OPTS=\"$ACTIVEMQ_OPTS_MEMORY -Dorg.apache.activemq.UseDedicatedTaskRunner=true -Djava.util.logging.config.file=logging.properties\"\n\n");
svn commit: r1466499 - in /activemq/trunk/activemq-tooling: activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/maven/ activemq-perf-maven-plugin/ activemq-perf-maven-plugin/src/main/java/
Author: ceposta Date: Wed Apr 10 14:47:28 2013 New Revision: 1466499 URL: http://svn.apache.org/r1466499 Log: Merge branch 'perf-tool-broker-gplus-thread' into trunk Modified: activemq/trunk/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/maven/MemtestMojo.java activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/pom.xml activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/maven/ServerMojo.java Modified: activemq/trunk/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/maven/MemtestMojo.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/maven/MemtestMojo.java?rev=1466499&r1=1466498&r2=1466499&view=diff == --- activemq/trunk/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/maven/MemtestMojo.java (original) +++ activemq/trunk/activemq-tooling/activemq-memtest-maven-plugin/src/main/java/org/apache/activemq/maven/MemtestMojo.java Wed Apr 10 14:47:28 2013 @@ -29,79 +29,79 @@ import org.apache.maven.plugin.MojoExecu public class MemtestMojo extends AbstractMojo { /** - * @parameter property="${url} + * @parameter property="url" */ private String url; /** - * @parameter property="${topic}" default-value="true" + * @parameter property="topic" default-value="true" * @required */ private String topic; /** - * @parameter property="${connectionCheckpointSize}" default-value="-1" + * @parameter property="connectionCheckpointSize" default-value="-1" * @required */ private String connectionCheckpointSize; /** - * @parameter property="${durable}" default-value="false" + * @parameter property="durable" default-value="false" * @required */ private String durable; /** - * @parameter property="${producerCount}" default-value="1" + * @parameter property="producerCount" default-value="1" * @required */ private String producerCount; /** - * @parameter property="${prefetchSize}" default-value="-1" + * @parameter property="prefetchSize" default-value="-1" * @required */ private String prefetchSize; /** - * @parameter property="${consumerCount}" default-value="1" + * @parameter property="consumerCount" default-value="1" * @required */ private String consumerCount; /** - * @parameter property="${messageCount}" default-value="10" + * @parameter property="messageCount" default-value="10" * @required */ private String messageCount; /** - * @parameter property="${messageSize}" default-value="10240" + * @parameter property="messageSize" default-value="10240" * @required */ private String messageSize; /** - * @parameter property="${checkpointInterval}" default-value="2" + * @parameter property="checkpointInterval" default-value="2" * @required */ private String checkpointInterval; /** - * @parameter property="${destinationName}" default-value="FOO.BAR" + * @parameter property="destinationName" default-value="FOO.BAR" * @required */ private String destinationName; /** - * @parameter property="${reportName}" + * @parameter property="$reportName" *default-value="activemq-memory-usage-report" * @required */ private String reportName; /** - * @parameter property="${reportDirectory}" + * @parameter property="reportDirectory" *default-value="${project.build.directory}/test-memtest" * @required */ Modified: activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/pom.xml URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/pom.xml?rev=1466499&r1=1466498&r2=1466499&view=diff == --- activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/pom.xml (original) +++ activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/pom.xml Wed Apr 10 14:47:28 2013 @@ -39,6 +39,10 @@ activemq-broker +org.apache.activemq +activemq-spring + +
svn commit: r1461153 - /activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java
Author: ceposta Date: Tue Mar 26 14:30:36 2013 New Revision: 1461153 URL: http://svn.apache.org/r1461153 Log: Updated to take into account scenario from mailing list where durable sub would connect.reconnect every second message Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java?rev=1461153&r1=1461152&r2=1461153&view=diff == --- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java (original) +++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableConsumerCloseAndReconnectTest.java Tue Mar 26 14:30:36 2013 @@ -28,10 +28,15 @@ import javax.jms.TextMessage; import javax.jms.Topic; import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; +import org.apache.activemq.store.kahadb.KahaDBStore; import org.apache.activemq.test.TestSupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.IOException; + /** * */ @@ -39,6 +44,8 @@ public class DurableConsumerCloseAndReco protected static final long RECEIVE_TIMEOUT = 5000L; private static final Logger LOG = LoggerFactory.getLogger(DurableConsumerCloseAndReconnectTest.class); +BrokerService brokerService; + protected Connection connection; private Session session; private MessageConsumer consumer; @@ -46,29 +53,64 @@ public class DurableConsumerCloseAndReco private Destination destination; private int messageCount; +private String vmConnectorURI; + @Override protected void setUp() throws Exception { +createBroker(); super.setUp(); -deleteAllMessages(); } @Override protected void tearDown() throws Exception { +stopBroker(); super.tearDown(); -deleteAllMessages(); } -private void deleteAllMessages() throws Exception { -ActiveMQConnectionFactory fac = new ActiveMQConnectionFactory("vm://localhost?broker.deleteAllMessagesOnStartup=true"); -Connection dummyConnection = fac.createConnection(); +protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { +return new ActiveMQConnectionFactory(vmConnectorURI); +} + +protected void createBroker() throws Exception { +brokerService = new BrokerService(); +brokerService.setUseJmx(false); +brokerService.setPersistent(false); +KahaDBPersistenceAdapter store = new KahaDBPersistenceAdapter(); +brokerService.setPersistenceAdapter(store); +brokerService.start(); +brokerService.waitUntilStarted(); +vmConnectorURI = brokerService.getVmConnectorURI().toString(); +} + +protected void stopBroker() throws Exception { +brokerService.stop(); +brokerService.waitUntilStopped(); +} + +public void testDurableSubscriberReconnectMultipleTimes() throws Exception { +Connection dummyConnection = createConnection(); dummyConnection.start(); + +makeConsumer(Session.AUTO_ACKNOWLEDGE); +closeConsumer(); + +publish(30); + +int counter = 1; +for (int i = 0; i < 15; i++) { +makeConsumer(Session.AUTO_ACKNOWLEDGE); +Message message = consumer.receive(RECEIVE_TIMEOUT); +assertTrue("Should have received a message!", message != null); +LOG.info("Received message " + counter++); +message = consumer.receive(RECEIVE_TIMEOUT); +assertTrue("Should have received a message!", message != null); +LOG.info("Received message " + counter++); +closeConsumer(); +} + dummyConnection.close(); } - -protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { -return new ActiveMQConnectionFactory("vm://localhost?broker.deleteAllMessagesOnStartup=false"); -} public void testCreateDurableConsumerCloseThenReconnect() throws Exception { // force the server to stay up across both connection tests @@ -84,10 +126,11 @@ public class DurableConsumerCloseAndReco } protected void consumeMessagesDeliveredWhileConsumerClosed() throws Exception { +// default to client ack for consumer makeConsumer(); closeConsumer(); -publish(); +publish(1);
svn commit: r854288 - in /websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website: ./ blog/ blog/releases/ community/ documentation/ documentation/schema/ images/ scripts/ style
Author: ceposta Date: Wed Mar 13 15:13:49 2013 New Revision: 854288 Log: [maven-svn-wagon] websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/index.rss websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta1.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta2.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta3.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta4.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta5.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta6.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.0.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.1.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.2.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.3.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.4.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.5.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.6.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/building.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/contributing.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/developers.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/faq.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/release-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/site.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/source.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/support.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/amqp-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/architecture.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/extending-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/getting-started.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/management-api.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/migration-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/module-organization.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/performance-scaling.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/schema/apollo.xsd websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/stomp-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/user-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/verification.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/download.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/images/module-deps-graph.png websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/images/project-logo-vector.png websites/production/activemq
svn commit: r1455988 - /activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
Author: ceposta Date: Wed Mar 13 15:07:41 2013 New Revision: 1455988 URL: http://svn.apache.org/r1455988 Log: Changed some text for the manual to align with what Lionel suggested in https://issues.apache.org/jira/browse/APLO-304 Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1455988&r1=1455987&r2=1455988&view=diff == --- activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md (original) +++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Wed Mar 13 15:07:41 2013 @@ -231,9 +231,9 @@ settings used on the socket at the time * `max_write_rate` : Sets the maximum bytes per second that this transport will send data at. This setting throttles writes so that the rate is not exceeded. Defaults to 0 which disables throttling. -* `receive_buffer_size` : Sets the size of the internal socket receive +* `receive_buffer_size` : Sets the initial size of the internal socket receive buffer (aka setting the socket's SO_RCVBUF) -* `send_buffer_size` : Sets the size of the internal socket send buffer +* `send_buffer_size` : Sets the initial size of the internal socket send buffer (aka setting the socket's SO_SNDBUF) Example which uses a couple of options: @@ -242,11 +242,10 @@ Example which uses a couple of options: {pygmentize} -Note that `&` was used to separate the option values instead of just `&` since the -URI being written within an XML file. Also note that using `receive_buffer_size` and `send_buffer_size` -in the URI string is slightly different than as an attribute of the `` element. In the URI -string, we specify what the buffer sizes should be when the socket is created, while when set on the -`` element, we specify the value to use instead of relying on auto-tuning. +Note that {pygmentize:: xml}&{pygmentize}was used to separate the option values instead of just `&` since the +URI is within an XML file. In the URI string, we specify what the buffer sizes +should be when the socket is created, but their values can change if auto-tuning is enabled. + # WebSocket Transports
svn commit: r854085 - in /websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website: ./ blog/ blog/releases/ community/ documentation/ documentation/schema/ images/ scripts/ style
Author: ceposta Date: Tue Mar 12 04:13:57 2013 New Revision: 854085 Log: [maven-svn-wagon] websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/index.rss websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta1.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta2.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta3.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta4.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta5.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1-0-beta6.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.0.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.1.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.2.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.3.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.4.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.5.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/blog/releases/release-1.6.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/building.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/contributing.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/developers.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/faq.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/release-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/site.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/source.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/community/support.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/amqp-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/architecture.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/extending-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/getting-started.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/index.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/management-api.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/migration-guide.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/module-organization.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/performance-scaling.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/schema/apollo.xsd websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/stomp-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/user-manual.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/verification.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/download.html websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/images/module-deps-graph.png websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/images/project-logo-vector.png websites/production/activemq
svn commit: r1455404 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/ apollo-broker/src/test/resources/org/apache/activemq/apollo/broker/transport/
Author: ceposta Date: Tue Mar 12 04:06:28 2013 New Revision: 1455404 URL: http://svn.apache.org/r1455404 Log: Changed to use boolean transport buffer auto tune settings and made docs more clear https://issues.apache.org/jira/browse/APLO-304 Added: activemq/activemq-apollo/trunk/apollo-broker/src/test/resources/org/apache/activemq/apollo/broker/transport/ activemq/activemq-apollo/trunk/apollo-broker/src/test/resources/org/apache/activemq/apollo/broker/transport/auto-tune-config.xml activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/transport/ConfigForSocketAutoTuningTest.scala Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AcceptingConnectorDTO.java activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala?rev=1455404&r1=1455403&r2=1455404&view=diff == --- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala (original) +++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connector.scala Tue Mar 12 04:06:28 2013 @@ -137,6 +137,8 @@ class AcceptingConnector(val broker:Brok var dead_messages_received:Long = 0 var dead_read_counter:Long = 0 var dead_write_counter:Long = 0 + var receive_buffer_auto_tune = true; + var send_buffer_auto_tune = true; def status = { val result = new ConnectorStatusDTO @@ -235,8 +237,8 @@ class AcceptingConnector(val broker:Brok def mem_size(value:String) = Option(value).map(MemoryPropertyEditor.parse(_).toInt) assert(config!=null, "Connector must be configured before it is started.") -send_buffer_size = mem_size(config.send_buffer_size) -receive_buffer_size = mem_size(config.receive_buffer_size) +receive_buffer_auto_tune = config.receive_buffer_auto_tune +send_buffer_auto_tune = config.send_buffer_auto_tune accepted.set(0) connected.set(0) @@ -282,23 +284,29 @@ class AcceptingConnector(val broker:Brok transport_server match { case transport_server: TcpTransportServer => -val next_receive_buffer_size = receive_buffer_size.getOrElse(broker.auto_tuned_send_receiver_buffer_size) -if( next_receive_buffer_size!=last_receive_buffer_size ) { - debug("%s connector receive_buffer_size set to: %d", id, next_receive_buffer_size) - - // lets avoid updating the socket settings each period. - transport_server.setReceiveBufferSize(next_receive_buffer_size) - last_receive_buffer_size = next_receive_buffer_size +if(receive_buffer_auto_tune){ + val next_receive_buffer_size = broker.auto_tuned_send_receiver_buffer_size + if( next_receive_buffer_size!=last_receive_buffer_size ) { +debug("%s connector receive_buffer_size set to: %d", id, next_receive_buffer_size) + +// lets avoid updating the socket settings each period. +transport_server.setReceiveBufferSize(next_receive_buffer_size) +last_receive_buffer_size = next_receive_buffer_size + } } -val next_send_buffer_size = send_buffer_size.getOrElse(broker.auto_tuned_send_receiver_buffer_size) -if( next_send_buffer_size!=last_send_buffer_size ) { - debug("%s connector send_buffer_size set to: %d", id, next_send_buffer_size) - // lets avoid updating the socket settings each period. - transport_server.setSendBufferSize(next_send_buffer_size) - last_send_buffer_size = next_send_buffer_size + +if(send_buffer_auto_tune){ + val next_send_buffer_size = broker.auto_tuned_send_receiver_buffer_size + if( next_send_buffer_size!=last_send_buffer_size ) { +debug("%s connector send_buffer_size set to: %d", id, next_send_buffer_size) +// lets avoid updating the socket settings each period. +transport_server.setSendBufferSize(next_send_buffer_size) +last_send_buffer_size = next_send_buffer_size + } } + case _ => } } Added: activemq/activemq-apollo/trunk/apollo-broker/src/test/resources/org/apache/activemq/apollo/broker/transport/auto-tune-config.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/test/resources/org/apache/activem
svn commit: r852875 [2/2] - in /websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website: ./ blog/ blog/releases/ community/ documentation/ documentation/schema/ images/ scripts/
Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html == --- websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html (original) +++ websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/mqtt-manual.html Mon Mar 4 03:36:37 2013 @@ -89,11 +89,17 @@ as an MQTT connection. You don't have to all be auto-detected). To force specific protocols over a certain connector there are two ways you can do this. You can choose to not use protocol detection at all and set the connector to be specifically for mqtt: -+ + + Alternatively, you can limit which protocols can be “detected” using the configuration element like this: - + + + + The protocols attribute in the+ element takes space delimited protoco values. The protocol attribtue of the element takes a single protocol, not space delimited. It defaults to @@ -102,7 +108,11 @@ The protocol attribtue of t If you wish to tune the MQTT defaults, you can use the mqtt configuration element within the connector element in the apollo.xml configuration file : - + + + + The mqtt element supports the following configuration attributes: Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html == --- websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html (original) +++ websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/openwire-manual.html Mon Mar 4 03:36:37 2013 @@ -84,7 +84,11 @@ to the broker, the protocol version that in the apollo.xml configuration file to change the default settings used in the OpenWire protocol implementation. -+ + + + + The openwire element supports the following configuration attributes: @@ -109,7 +113,11 @@ and actually closing it. Default is An example of configuring the OpenWire protocol -+ + + + + Protocol Detection (different that open-wire vesion detection) @@ -120,11 +128,17 @@ the broker, and means you only need to o If you would like to specify a certain connector for OpenWire and another connector for a different protocol, you can explicitly configure the connector to be an OpenWire connector: -+ + + + You can also support a limited subset of protocols: - + + + + Or you can leave it open to any of the supported protocols (default), and the correct protocol will be used depending on what the client is using. You do this by not specifying any protocol settings. @@ -246,7 +260,16 @@ a value of “me”, pass a sele Here's an example of producing the message: -MessageProducer producer = session.createProducer(destination); for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) { TextMessage message = session.createTextMessage("Message #" + i); LOG.info("Sending message #" + i); producer.send(message); Thread.sleep(DELAY); } + +MessageProducer producer = session.createProducer(destination); + +for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) { +TextMessage message = session.createTextMessage("Message #" + i); +LOG.info("Sending message #" + i); +producer.send(message); +Thread.sleep(DELAY); +} + Browing Subscription Modified: websites/production/activemq/content/apollo/versions/99-trunk-SNAPSHOT/website/documentation/performance-scaling.html == (empty) Modified: websites/production/activemq/content/apoll+
svn commit: r1452177 - /activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
Author: ceposta Date: Mon Mar 4 03:29:53 2013 New Revision: 1452177 URL: http://svn.apache.org/r1452177 Log: Updated docs to be more clear about the different uses of the receive_buffer_size/send_buffer_size in the URI string vs in the attribute of the connector per https://issues.apache.org/jira/browse/APLO-304 Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1452177&r1=1452176&r2=1452177&view=diff == --- activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md (original) +++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md Mon Mar 4 03:29:53 2013 @@ -90,7 +90,7 @@ configure it to use this [apollo.xsd](sc The simplest valid `apollo.xml` defines a single virtual host and a single connector. -{pygmentize:: xml} +{pygmentize:: xml} s http://activemq.apache.org/schema/activemq/apollo";> @@ -161,10 +161,12 @@ A `connector` element can be configured supported protocols can connect via this transport. * `receive_buffer_size` : Sets the size of the internal socket receive - buffer (aka setting the socket's SO_RCVBUF). + buffer (aka setting the socket's SO_RCVBUF) to a fixed value, and auto + tuning will not be used. * `send_buffer_size` : Sets the size of the internal socket send buffer - (aka setting the socket's SO_SNDBUF). + (aka setting the socket's SO_SNDBUF) to a fixed value, and auto-tuning + will not be used. When the `receive_buffer_size` or `send_buffer_size` attributes are not set, then the broker will 'auto-tune' them to be between '64k' and '2k' based on the @@ -211,7 +213,7 @@ and port to determine to which local int * `tcp://127.0.0.1:0` binds to the loopback interface on a dynamic port The TCP URI also supports several query parameters to fine tune the -settings used on the socket. The supported parameters are: +settings used on the socket at the time of creation. The supported parameters are: * `backlog` : Sets the listen backlog size. Defaults to 100. @@ -229,6 +231,10 @@ settings used on the socket. The suppor * `max_write_rate` : Sets the maximum bytes per second that this transport will send data at. This setting throttles writes so that the rate is not exceeded. Defaults to 0 which disables throttling. +* `receive_buffer_size` : Sets the size of the internal socket receive + buffer (aka setting the socket's SO_RCVBUF) +* `send_buffer_size` : Sets the size of the internal socket send buffer + (aka setting the socket's SO_SNDBUF) Example which uses a couple of options: @@ -237,7 +243,10 @@ Example which uses a couple of options: {pygmentize} Note that `&` was used to separate the option values instead of just `&` since the -URI being written within an XML file. +URI being written within an XML file. Also note that using `receive_buffer_size` and `send_buffer_size` +in the URI string is slightly different than as an attribute of the `` element. In the URI +string, we specify what the buffer sizes should be when the socket is created, while when set on the +`` element, we specify the value to use instead of relying on auto-tuning. # WebSocket Transports
svn commit: r1449562 - in /activemq/trunk/activemq-amqp/src: main/java/org/apache/activemq/transport/amqp/AmqpTransportFilter.java test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java
Author: ceposta Date: Sun Feb 24 22:42:09 2013 New Revision: 1449562 URL: http://svn.apache.org/r1449562 Log: Added tests for AMQP to JMS transformations Added: activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java Modified: activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpTransportFilter.java Modified: activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpTransportFilter.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpTransportFilter.java?rev=1449562&r1=1449561&r2=1449562&view=diff == --- activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpTransportFilter.java (original) +++ activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpTransportFilter.java Sun Feb 24 22:42:09 2013 @@ -33,7 +33,7 @@ import java.security.cert.X509Certificat /** * The AMQPTransportFilter normally sits on top of a TcpTransport that has been - * configured with the StompWireFormat and is used to convert AMQP commands to + * configured with the AmqpWireFormat and is used to convert AMQP commands to * ActiveMQ commands. All of the conversion work is done by delegating to the * AMQPProtocolConverter */ Added: activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java?rev=1449562&view=auto == --- activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java (added) +++ activemq/trunk/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/AmqpTransformerTest.java Sun Feb 24 22:42:09 2013 @@ -0,0 +1,226 @@ +/** + * 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.transport.amqp; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.TransportConnector; +import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl; +import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl; +import org.junit.After; +import org.junit.Test; + +import javax.jms.*; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + */ +public class AmqpTransformerTest { + +private static final String AMQP_URL = "amqp://0.0.0.0:0%s"; +private BrokerService brokerService; +private int amqpPort; +private int openwirePort; +private static final String TEST_QUEUE = "txqueue"; + +@Test +public void testNativeTransformation() throws Exception { + +// default is native +startBrokerWithAmqpTransport(String.format(AMQP_URL, "?transport.transformer=native")); + +// send "text message" with AMQP JMS API +Connection amqpConnection = createAmqpConnection(); +QueueImpl queue = new QueueImpl("queue://" + TEST_QUEUE); + +Session amqpSession = amqpConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); +MessageProducer p = amqpSession.createProducer(queue); +p.setPriority(7); + +TextMessage amqpMessage = amqpSession.createTextMessage(); +amqpMessage.setText("hello"); +p.send(amqpMessage); + +p.close(); +amqpSession.close(); +amqpConnection.close(); + + +// receive with openwire JMS +ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://0.0.0.0:" + openwirePort); +Connection openwireConn = factory.createConnection(); +openwireConn.start(); +Session session = openwireConn.createSession(false, Session.AUTO_ACKNOWLEDGE); +
svn commit: r1446979 - /activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubInBrokerNetworkTest.java
Author: ceposta Date: Sun Feb 17 00:05:41 2013 New Revision: 1446979 URL: http://svn.apache.org/r1446979 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4000 Added test for multiple durable consumers across the network, per Gary's comments Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubInBrokerNetworkTest.java Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubInBrokerNetworkTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubInBrokerNetworkTest.java?rev=1446979&r1=1446978&r2=1446979&view=diff == --- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubInBrokerNetworkTest.java (original) +++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubInBrokerNetworkTest.java Sun Feb 17 00:05:41 2013 @@ -26,8 +26,6 @@ import javax.jms.TopicSubscriber; import javax.management.ObjectName; -import junit.framework.Assert; - import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.network.DiscoveryNetworkConnector; import org.apache.activemq.network.NetworkConnector; @@ -46,6 +44,7 @@ public class DurableSubInBrokerNetworkTe private static final Logger LOG = LoggerFactory.getLogger(NetworkConnector.class); // protected BrokerService localBroker; private final String subName = "Subscriber1"; +private final String subName2 = "Subscriber2"; private final String topicName = "TEST.FOO"; protected void setUp() throws Exception { @@ -94,22 +93,11 @@ public class DurableSubInBrokerNetworkTe // query durable sub on local and remote broker // raise an error if not found -boolean foundSub = false; -ObjectName[] subs = broker.getAdminView().getDurableTopicSubscribers(); - -for (int i=0 ; i
svn commit: r1446447 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/advisory/ activemq-broker/src/main/java/org/apache/activemq/network/ activemq-unit-tests/src/test/java/org/
Author: ceposta Date: Fri Feb 15 05:22:08 2013 New Revision: 1446447 URL: http://svn.apache.org/r1446447 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4000 Durable subscription not getting unregistered on networked broker, thanks torsten for the unit test! Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubInBrokerNetworkTest.java Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java?rev=1446447&r1=1446446&r2=1446447&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java Fri Feb 15 05:22:08 2013 @@ -29,25 +29,13 @@ import org.apache.activemq.broker.region import org.apache.activemq.broker.region.MessageReference; import org.apache.activemq.broker.region.Subscription; import org.apache.activemq.broker.region.TopicSubscription; -import org.apache.activemq.command.ActiveMQDestination; -import org.apache.activemq.command.ActiveMQMessage; -import org.apache.activemq.command.ActiveMQTopic; -import org.apache.activemq.command.BrokerInfo; -import org.apache.activemq.command.Command; -import org.apache.activemq.command.ConnectionId; -import org.apache.activemq.command.ConnectionInfo; -import org.apache.activemq.command.ConsumerId; -import org.apache.activemq.command.ConsumerInfo; -import org.apache.activemq.command.DestinationInfo; -import org.apache.activemq.command.Message; -import org.apache.activemq.command.MessageId; -import org.apache.activemq.command.ProducerId; -import org.apache.activemq.command.ProducerInfo; +import org.apache.activemq.command.*; import org.apache.activemq.security.SecurityContext; import org.apache.activemq.state.ProducerState; import org.apache.activemq.usage.Usage; import org.apache.activemq.util.IdGenerator; import org.apache.activemq.util.LongSequenceGenerator; +import org.apache.activemq.util.SubscriptionKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,6 +53,7 @@ public class AdvisoryBroker extends Brok protected final ConcurrentHashMap producers = new ConcurrentHashMap(); protected final ConcurrentHashMap destinations = new ConcurrentHashMap(); protected final ConcurrentHashMap networkBridges = new ConcurrentHashMap(); +protected final ConcurrentHashMap durableSubscriptions = new ConcurrentHashMap(); protected final ProducerId advisoryProducerId = new ProducerId(); private final LongSequenceGenerator messageIdGenerator = new LongSequenceGenerator(); @@ -92,6 +81,12 @@ public class AdvisoryBroker extends Brok // Don't advise advisory topics. if (!AdvisorySupport.isAdvisoryTopic(info.getDestination())) { +if (info.getDestination().isTopic() && info.isDurable()) { +SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); +if (!this.durableSubscriptions.contains(key)) { +this.durableSubscriptions.put(key, (ActiveMQTopic)info.getDestination()); +} +} ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(info.getDestination()); consumers.put(info.getConsumerId(), info); fireConsumerAdvisory(context, info.getDestination(), topic, info); @@ -264,6 +259,26 @@ public class AdvisoryBroker extends Brok } @Override +public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception { +super.removeSubscription(context, info); + +SubscriptionKey key = new SubscriptionKey(context.getClientId(), info.getSubscriptionName()); + +ActiveMQTopic dest = durableSubscriptions.get(key); +if (dest == null) { +LOG.warn("We cannot send an advisory message for a durable sub removal when we don't know about the durable sub"); +} + +// Don't advise advisory topics. +if (!AdvisorySupport.isAdvisoryTopic(dest)) { +ActiveMQTopic topic = AdvisorySupport.getConsumerAdvisoryTopic(dest); +durableSubscriptions.remove(key); +fireConsumerAdvisory(context,dest, topic, info); +} + +} + +@Override public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception { super.removeProducer(context, info); Modif
svn commit: r1445995 - /activemq/trunk/assembly/src/main/descriptors/common-bin.xml
Author: ceposta Date: Thu Feb 14 00:05:50 2013 New Revision: 1445995 URL: http://svn.apache.org/r1445995 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4315 duplicate files (leveldb and activemq-spring) in distribution Modified: activemq/trunk/assembly/src/main/descriptors/common-bin.xml Modified: activemq/trunk/assembly/src/main/descriptors/common-bin.xml URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/main/descriptors/common-bin.xml?rev=1445995&r1=1445994&r2=1445995&view=diff == --- activemq/trunk/assembly/src/main/descriptors/common-bin.xml (original) +++ activemq/trunk/assembly/src/main/descriptors/common-bin.xml Thu Feb 14 00:05:50 2013 @@ -149,7 +149,6 @@ ${pom.groupId}:activemq-leveldb-store ${pom.groupId}:activemq-log4j-appender ${pom.groupId}:activemq-pool -${pom.groupId}:activemq-spring ${pom.groupId}:activeio-core commons-beanutils:commons-beanutils commons-collections:commons-collections @@ -189,11 +188,8 @@ /lib/extra false runtime - true - -org.apache.activemq:activemq-leveldb org.fusesource.mqtt-client:mqtt-client
svn commit: r1445772 - /activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/VirtualTopicNetworkClusterReactivationTest.java
Author: ceposta Date: Wed Feb 13 17:58:30 2013 New Revision: 1445772 URL: http://svn.apache.org/r1445772 Log: Added a test that shows using virtual topics in a network of brokers to resolve some of the pain that comes up with durable subscriptions across a network. This test demonstrates the use of Virtual Topics and ConditionalNetworkBridgeFilterFactory with replayWhenNoConsumers=true Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/VirtualTopicNetworkClusterReactivationTest.java Added: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/VirtualTopicNetworkClusterReactivationTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/VirtualTopicNetworkClusterReactivationTest.java?rev=1445772&view=auto == --- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/VirtualTopicNetworkClusterReactivationTest.java (added) +++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/VirtualTopicNetworkClusterReactivationTest.java Wed Feb 13 17:58:30 2013 @@ -0,0 +1,176 @@ +/** + * 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.usecases; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.JmsMultipleBrokersTestSupport; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.region.policy.PolicyEntry; +import org.apache.activemq.broker.region.policy.PolicyMap; +import org.apache.activemq.command.ActiveMQDestination; +import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.command.ActiveMQTopic; +import org.apache.activemq.network.ConditionalNetworkBridgeFilterFactory; + +import javax.jms.*; +import java.net.URI; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + */ +public class VirtualTopicNetworkClusterReactivationTest extends JmsMultipleBrokersTestSupport { + +private static final String BROKER_A = "brokerA"; +private static final String BROKER_B = "brokerB"; +private static final String BROKER_A_TRANSPORT_URL = "tcp://localhost:61616"; +private static final String BROKER_B_TRANSPORT_URL = "tcp://localhost:61617"; +private static final long DEFAULT_SLEEP_MS = 1000; + +private ActiveMQTopic topic = new ActiveMQTopic("VirtualTopic.FOO.TEST"); +private ActiveMQQueue queue = new ActiveMQQueue("Consumer.FOO.VirtualTopic.FOO.TEST"); + + +/** + * This test shows how to use pub/sub to mimic durable subscribers in a network of brokers. + * + * When using durable subscribers in a broker cluster, you can encounter a situation where a + * subscription gets orphaned on a broker when the client disconnects and reattaches to another + * broker in the cluster. Since the clientID/durableName only need to be unique within a single + * broker, it's possible to have a durable sub on multiple brokers in a cluster. + * + * FOR EXAMPLE: + * Broker A and B are networked together in both directions to form a full mesh. If durable + * subscriber 'foo' subscribes to failover(A,B) and ends up on B, and a producer on A, messages + * will be demand forwarded from A to B. But if the durable sub 'foo' disconnects from B, + * then reconnects to failover(A,B) but this time gets connected to A, the subscription on + * B will still be there are continue to receive messages (and possibly have missed messages + * sent there while gone) + * + * We can avoid all of this mess with virtual topics as seen below: + * + * + * @throws JMSException + */ +public void testDurableSubReconnectFromAtoB() throws JMSException { +// create consumer on broker B +ActiveMQConnectionFactory bConnFactory = new ActiveMQConnectionFactory(BROKER_B_TRANSPORT_URL+ "?jms.prefetchPolicy.queuePrefetch=0"); +Connection bConn = bConnFactory.createConnection(); +
svn commit: r1445642 - in /activemq/trunk/activemq-ra/src: main/java/org/apache/activemq/ra/ test/java/org/apache/activemq/ra/ test/resources/
Author: ceposta Date: Wed Feb 13 14:57:38 2013 New Revision: 1445642 URL: http://svn.apache.org/r1445642 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4305 Support destination lookup by JNDI name in resource adapter, patch applied, thanks Harald Wellmann. Also added unit tests Added: activemq/trunk/activemq-ra/src/test/resources/jndi.properties (with props) Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/MessageActivationSpec.java activemq/trunk/activemq-ra/src/test/java/org/apache/activemq/ra/MDBTest.java Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java?rev=1445642&r1=1445641&r2=1445642&view=diff == --- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java (original) +++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQActivationSpec.java Wed Feb 13 14:57:38 2013 @@ -74,6 +74,7 @@ public class ActiveMQActivationSpec impl private String enableBatch = "false"; private String maxMessagesPerBatch = "10"; private RedeliveryPolicy redeliveryPolicy; +private boolean useJndi; /** * @see javax.resource.spi.ActivationSpec#validate() @@ -452,7 +453,7 @@ public class ActiveMQActivationSpec impl public String toString() { return "ActiveMQActivationSpec{" + "acknowledgeMode='" + acknowledgeMode + "'" + ", destinationType='" + destinationType + "'" + ", messageSelector='" + messageSelector + "'" + ", destination='" + destination + "'" + ", clientId='" + clientId + "'" + ", subscriptionName='" + subscriptionName + "'" + ", subscriptionDurability='" + subscriptionDurability - + "'" + "}"; + + "'" + ", useJndi='"+ useJndi + "'" +"}"; } public int getAcknowledgeModeForSession() { @@ -665,4 +666,12 @@ public class ActiveMQActivationSpec impl } return redeliveryPolicy; } + +public void setUseJndi(boolean useJndi) { +this.useJndi = useJndi; +} + +public boolean isUseJndi() { +return useJndi; +} } Modified: activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java?rev=1445642&r1=1445641&r2=1445642&view=diff == --- activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java (original) +++ activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java Wed Feb 13 14:57:38 2013 @@ -28,6 +28,8 @@ import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.Session; import javax.jms.Topic; +import javax.naming.InitialContext; +import javax.naming.NamingException; import javax.resource.ResourceException; import javax.resource.spi.endpoint.MessageEndpointFactory; import javax.resource.spi.work.Work; @@ -200,14 +202,28 @@ public class ActiveMQEndpointWorker { }; MessageActivationSpec activationSpec = endpointActivationKey.getActivationSpec(); -if ("javax.jms.Queue".equals(activationSpec.getDestinationType())) { -dest = new ActiveMQQueue(activationSpec.getDestination()); -} else if ("javax.jms.Topic".equals(activationSpec.getDestinationType())) { -dest = new ActiveMQTopic(activationSpec.getDestination()); -} else { -throw new ResourceException("Unknown destination type: " + activationSpec.getDestinationType()); +if (activationSpec.isUseJndi()) { +try { +InitialContext initialContext = new InitialContext(); +dest = (ActiveMQDestination) initialContext.lookup(activationSpec.getDestination()); +} +catch (NamingException exc) { +throw new ResourceException("JNDI lookup failed for " ++ activationSpec.getDestination()); +} +} +else { +if ("javax.jms.Queue".equals(activationSpec.getDest
svn commit: r1445476 - /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/HealthView.java
Author: ceposta Date: Wed Feb 13 05:45:43 2013 New Revision: 1445476 URL: http://svn.apache.org/r1445476 Log: https://issues.apache.org/jira/browse/AMQ-4303 Health status MBean - Feeling ill, hard to read "ill" in jconsole... changed to "getting worried" Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/HealthView.java Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/HealthView.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/HealthView.java?rev=1445476&r1=1445475&r2=1445476&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/HealthView.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/HealthView.java Wed Feb 13 05:45:43 2013 @@ -174,7 +174,7 @@ public class HealthView implements Healt } if (answer != null && !answer.isEmpty()){ - this.currentState = "Feeling Ill {"; + this.currentState = "Getting Worried {"; for (HealthStatus hs: answer){ currentState += hs + " , "; }
svn commit: r1445474 - /activemq/trunk/activemq-client/src/main/java/org/apache/activemq/usage/Usage.java
Author: ceposta Date: Wed Feb 13 05:18:21 2013 New Revision: 1445474 URL: http://svn.apache.org/r1445474 Log: Fix for https://issues.apache.org/jira/browse/AMQ-4309 Add usage limit check when limit for destinations is present Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/usage/Usage.java Modified: activemq/trunk/activemq-client/src/main/java/org/apache/activemq/usage/Usage.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-client/src/main/java/org/apache/activemq/usage/Usage.java?rev=1445474&r1=1445473&r2=1445474&view=diff == --- activemq/trunk/activemq-client/src/main/java/org/apache/activemq/usage/Usage.java (original) +++ activemq/trunk/activemq-client/src/main/java/org/apache/activemq/usage/Usage.java Wed Feb 13 05:18:21 2013 @@ -295,6 +295,10 @@ public abstract class Usage parent.getLimit()) { + LOG.info("Usage({}) limit={} should be smaller than its parent limit={}", +new Object[]{getName(), getLimit(), parent.getLimit()}); +} } for (T t:children) { t.start();
svn commit: r1445299 - in /activemq/trunk: activemq-http/src/main/java/org/apache/activemq/transport/ activemq-http/src/main/java/org/apache/activemq/transport/http/ activemq-http/src/main/java/org/ap
Author: ceposta Date: Tue Feb 12 18:27:53 2013 New Revision: 1445299 URL: http://svn.apache.org/r1445299 Log: https://issues.apache.org/jira/browse/AMQ-4298 Add mutual authentication (needClientAuth) to https transport added tests as well Added: activemq/trunk/activemq-http/src/test/java/org/apache/activemq/transport/https/HttpsNeedClientAuthBrokerTest.java activemq/trunk/activemq-http/src/test/java/org/apache/activemq/transport/https/HttpsNeedClientAuthSendAndReceiveTest.java activemq/trunk/activemq-http/src/test/java/org/apache/activemq/transport/https/HttpsWantClientAuthSendAndReceiveTest.java activemq/trunk/activemq-http/src/test/resources/activemq-https-need-client-auth.xml activemq/trunk/activemq-http/src/test/resources/activemq-https-want-client-auth.xml Modified: activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/https/HttpsClientTransport.java activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslBrokerServiceTest.java Modified: activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java?rev=1445299&r1=1445298&r2=1445299&view=diff == --- activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java (original) +++ activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/SecureSocketConnectorFactory.java Tue Feb 12 18:27:53 2013 @@ -31,6 +31,10 @@ public class SecureSocketConnectorFactor private String keyPassword = System.getProperty("javax.net.ssl.keyPassword"); private String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword"); private String keyStore = System.getProperty("javax.net.ssl.keyStore"); +private String trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword"); +private String trustStore = System.getProperty("javax.net.ssl.trustStore"); +private boolean needClientAuth; +private boolean wantClientAuth; private String keyStoreType; private String secureRandomCertficateAlgorithm; private String trustCertificateAlgorithm; @@ -94,8 +98,18 @@ public class SecureSocketConnectorFactor if (protocol != null) { factory.setProtocol(protocol); } +if (trustStore != null) { +factory.setTrustStore(trustStore); +} +if (trustStorePassword != null) { +factory.setTrustStorePassword(trustStorePassword); +} + } +factory.setNeedClientAuth(needClientAuth); +factory.setWantClientAuth(wantClientAuth); + return sslConnector; } @@ -179,4 +193,36 @@ public class SecureSocketConnectorFactor public void setAuth(String auth) { this.auth = auth; } + +public boolean isWantClientAuth() { +return wantClientAuth; +} + +public void setWantClientAuth(boolean wantClientAuth) { +this.wantClientAuth = wantClientAuth; +} + +public boolean isNeedClientAuth() { +return needClientAuth; +} + +public void setNeedClientAuth(boolean needClientAuth) { +this.needClientAuth = needClientAuth; +} + +public String getTrustStore() { +return trustStore; +} + +public void setTrustStore(String trustStore) { +this.trustStore = trustStore; +} + +public String getTrustStorePassword() { +return trustStorePassword; +} + +public void setTrustStorePassword(String trustStorePassword) { +this.trustStorePassword = trustStorePassword; +} } Modified: activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java?rev=1445299&r1=1445298&r2=1445299&view=diff == --- activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java (original) +++ activemq/trunk/activemq-http/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java Tue Feb 12 18:27:53 2013 @@ -45,6 +45,7 @@ import org.apache.http.client.methods.Ht import org.apache.http.client.methods.HttpHead; import org.apache.http.client.methods.HttpOptions; import org.apache.http.client.metho
svn commit: r1441584 - /activemq/sandbox/activemq-perftest/pom.xml
Author: ceposta Date: Fri Feb 1 19:06:00 2013 New Revision: 1441584 URL: http://svn.apache.org/viewvc?rev=1441584&view=rev Log: Updated to use 5.8-SNAPSHOT and added snapshot repos. Modified: activemq/sandbox/activemq-perftest/pom.xml Modified: activemq/sandbox/activemq-perftest/pom.xml URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-perftest/pom.xml?rev=1441584&r1=1441583&r2=1441584&view=diff == --- activemq/sandbox/activemq-perftest/pom.xml (original) +++ activemq/sandbox/activemq-perftest/pom.xml Fri Feb 1 19:06:00 2013 @@ -29,31 +29,60 @@ jar ActiveMQ :: Performance Test Performance Testing Framework for ActiveMQ - + + +5.8-SNAPSHOT + - org.apache.activemq.tooling activemq-perf-maven-plugin -5.8.0 +${activemq-version} org.apache.activemq.tooling activemq-memtest-maven-plugin -5.8.0 - - --> - -org.apache.activemq.tooling -maven-activemq-perf-plugin -5.7.0 - - -org.apache.activemq.tooling -maven-activemq-memtest-plugin -5.7.0 +${activemq-version} + + + + apache-plugins-snapshots + Apache Snapshots + +false +always +warn + + +true +never +fail + + http://repository.apache.org/snapshots/ + default + + + + + apache-snapshots + Apache Snapshots + +false +always +warn + + +true +never +fail + + http://repository.apache.org/snapshots/ + default + +
svn commit: r1441277 - /activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java
Author: ceposta Date: Fri Feb 1 00:25:56 2013 New Revision: 1441277 URL: http://svn.apache.org/viewvc?rev=1441277&view=rev Log: Fix for https://issues.apache.org/jira/browse/AMQ-4289 activemq-perf-maven-plugin is unusable because of bug in ReflectionUtil helper class previous commit actually had fix commented out. this has the fix. Modified: activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java Modified: activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java?rev=1441277&r1=1441276&r2=1441277&view=diff == --- activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java (original) +++ activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java Fri Feb 1 00:25:56 2013 @@ -213,8 +213,7 @@ public final class ReflectionUtil { } else { try { Object val = getterMethods[i].invoke(targetObject, null); -//if (val != null && val != targetObject) { -if (val != null ) { +if (val != null && val != targetObject) { props.putAll(retrieveClassProperties(propertyName + ".", val.getClass(), val)); } } catch (InvocationTargetException e) {
svn commit: r1441270 - in /activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src: main/java/org/apache/activemq/tool/properties/ReflectionUtil.java test/java/org/apache/activemq/tool/Reflecti
Author: ceposta Date: Fri Feb 1 00:02:30 2013 New Revision: 1441270 URL: http://svn.apache.org/viewvc?rev=1441270&view=rev Log: Fix for https://issues.apache.org/jira/browse/AMQ-4289 activemq-perf-maven-plugin is unusable because of bug in ReflectionUtil helper class also added test to show error Modified: activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java Modified: activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java?rev=1441270&r1=1441269&r2=1441270&view=diff == --- activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java (original) +++ activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/main/java/org/apache/activemq/tool/properties/ReflectionUtil.java Fri Feb 1 00:02:30 2013 @@ -213,7 +213,8 @@ public final class ReflectionUtil { } else { try { Object val = getterMethods[i].invoke(targetObject, null); -if (val != null) { +//if (val != null && val != targetObject) { +if (val != null ) { props.putAll(retrieveClassProperties(propertyName + ".", val.getClass(), val)); } } catch (InvocationTargetException e) { Modified: activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java?rev=1441270&r1=1441269&r2=1441270&view=diff == --- activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java (original) +++ activemq/trunk/activemq-tooling/activemq-perf-maven-plugin/src/test/java/org/apache/activemq/tool/ReflectionUtilTest.java Fri Feb 1 00:02:30 2013 @@ -280,6 +280,10 @@ public class ReflectionUtilTest extends public void setTestData(TestClass3 testData) { this.testData = testData; } + +public TestClass3 getRecursiveData() { +return this; +} } public class TestClass4 {
svn commit: r1439420 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java
Author: ceposta Date: Mon Jan 28 14:22:47 2013 New Revision: 1439420 URL: http://svn.apache.org/viewvc?rev=1439420&view=rev Log: Added a test to the QueueBrowser to browse "large number of messages (1000)" Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java?rev=1439420&r1=1439419&r2=1439420&view=diff == --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java Mon Jan 28 14:22:47 2013 @@ -25,6 +25,7 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.QueueBrowser; import javax.jms.Session; +import javax.jms.Connection; import javax.jms.TextMessage; import javax.management.ObjectName; import javax.management.openmbean.CompositeData; @@ -303,6 +304,36 @@ public class JmsQueueBrowserTest extends producer.close(); } + +public void testLargeNumberOfMessages() throws Exception { +Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); +ActiveMQQueue destination = new ActiveMQQueue("TEST"); +connection.start(); + +MessageProducer producer = session.createProducer(destination); + +for (int i = 0; i < 1000; i++) { +producer.send(session.createTextMessage("Message: " + i)); +} + +QueueBrowser browser = session.createBrowser(destination); +Enumeration enumeration = browser.getEnumeration(); + +assertTrue(enumeration.hasMoreElements()); + +int numberBrowsed = 0; + +while (enumeration.hasMoreElements()) { +enumeration.nextElement(); +numberBrowsed++; +} + +System.out.println("Number browsed: " + numberBrowsed); +assertEquals(1000, numberBrowsed); +browser.close(); +producer.close(); + +} public void testQueueBrowserWith2Consumers() throws Exception { final int numMessages = 1000;
svn commit: r1439193 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/broker/jmx/ activemq-web-console/src/main/webapp/
Author: ceposta Date: Sun Jan 27 21:44:55 2013 New Revision: 1439193 URL: http://svn.apache.org/viewvc?rev=1439193&view=rev Log: Fix for https://issues.apache.org/jira/browse/AMQ-4272 updated queueConsumers.jsp to only allow the link to connection page for connections directly to the broker, but go to network.jsp for bridge consumers Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java activemq/trunk/activemq-web-console/src/main/webapp/queueConsumers.jsp Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java?rev=1439193&r1=1439192&r2=1439193&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionView.java Sun Jan 27 21:44:55 2013 @@ -209,6 +209,15 @@ public class SubscriptionView implements return true; } +@Override +public boolean isNetwork() { +ConsumerInfo info = getConsumerInfo(); +if (info != null) { +return info.isNetworkSubscription(); +} +return false; +} + /** * The subscription should release as may references as it can to help the * garbage collector reclaim memory. Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java?rev=1439193&r1=1439192&r2=1439193&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java Sun Jan 27 21:44:55 2013 @@ -90,6 +90,9 @@ public interface SubscriptionViewMBean { @MBeanInfo("Subscription is active (connected and receiving messages).") boolean isActive(); +@MBeanInfo("Subscription was created by a demand-forwarding network bridge") +boolean isNetwork(); + /** * @return number of messages pending delivery */ Modified: activemq/trunk/activemq-web-console/src/main/webapp/queueConsumers.jsp URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/queueConsumers.jsp?rev=1439193&r1=1439192&r2=1439193&view=diff == --- activemq/trunk/activemq-web-console/src/main/webapp/queueConsumers.jsp (original) +++ activemq/trunk/activemq-web-console/src/main/webapp/queueConsumers.jsp Sun Jan 27 21:44:55 2013 @@ -52,9 +52,16 @@ - ${row.clientId} - ${row.connectionId} - + + +${row.clientId} + + +${row.clientId} + + +${row.connectionId} + ${row.sessionId} ${row.selector} ${row.enqueueCounter}
svn commit: r1438738 [2/2] - in /activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire: ./ advanced-scenarios/ advanced-scenarios/jms-example-composite-destinations/ advanced
Copied: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/readme.md (from r1438023, activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/readme.md) URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/readme.md?p2=activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/readme.md&p1=activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/readme.md&r1=1438023&r2=1438738&rev=1438738&view=diff == (empty) Copied: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Publisher.java (from r1438023, activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/src/main/java/example/topic/Publisher.java) URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Publisher.java?p2=activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Publisher.java&p1=activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/src/main/java/example/topic/Publisher.java&r1=1438023&r2=1438738&rev=1438738&view=diff == --- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/src/main/java/example/topic/Publisher.java (original) +++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Publisher.java Fri Jan 25 22:06:13 2013 @@ -16,7 +16,6 @@ */ package example.topic; -import example.util.Util; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; @@ -25,16 +24,17 @@ import javax.jms.*; * @author http://www.christianposta.com/blog";>Christian Posta */ public class Publisher { -private static final String BROKER_HOST = "tcp://localhost:%d"; -private static final int BROKER_PORT = Util.getBrokerPort(); -private static final String BROKER_URL = String.format(BROKER_HOST, BROKER_PORT); +private static final String BROKER_URL = "tcp://localhost:61613"; private static final Boolean NON_TRANSACTED = false; private static final int NUM_MESSAGES_TO_SEND = 100; private static final long DELAY = 100; public static void main(String[] args) { - -ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", BROKER_URL); +String url = BROKER_URL; +if (args.length > 0) { +url = args[0].trim(); +} +ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("admin", "password", url); Connection connection = null; try { Copied: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Subscriber.java (from r1438023, activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/src/main/java/example/topic/Subscriber.java) URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Subscriber.java?p2=activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Subscriber.java&p1=activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/src/main/java/example/topic/Subscriber.java&r1=1438023&r2=1438738&rev=1438738&view=diff == --- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/jms-example-topic/src/main/java/example/topic/Subscriber.java (original) +++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/openwire/advanced-scenarios/jms-example-topic/src/main/java/example/topic/Subscriber.java Fri Jan 25 22:06:13 2013 @@ -16,7 +16,6 @@ */ package example.topic; -import example.util.Util; import org.apache.activemq.ActiveMQConnectionFactory; import javax.jms.*; @@ -26,10 +25,8 @@ import java.util.concurrent.CountDownLat * @author http://www.christianposta.com/blog";>Christian Posta */ public class Subscriber implements MessageListener { +private static final String BROKER_URL = "tcp
svn commit: r1438666 - in /activemq/trunk/activemq-web: ./ src/main/java/org/apache/activemq/web/ src/test/ src/test/java/ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/activem
Author: ceposta Date: Fri Jan 25 19:50:15 2013 New Revision: 1438666 URL: http://svn.apache.org/viewvc?rev=1438666&view=rev Log: Fix Type --> type and BrokerName --> brokerName in RemoteJMXBrokerFacade + Test, related to https://issues.apache.org/jira/browse/AMQ-4237 Added: activemq/trunk/activemq-web/src/test/ activemq/trunk/activemq-web/src/test/java/ activemq/trunk/activemq-web/src/test/java/org/ activemq/trunk/activemq-web/src/test/java/org/apache/ activemq/trunk/activemq-web/src/test/java/org/apache/activemq/ activemq/trunk/activemq-web/src/test/java/org/apache/activemq/web/ activemq/trunk/activemq-web/src/test/java/org/apache/activemq/web/RemoteJMXBrokerTest.java Modified: activemq/trunk/activemq-web/pom.xml activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java Modified: activemq/trunk/activemq-web/pom.xml URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/pom.xml?rev=1438666&r1=1438665&r2=1438666&view=diff == --- activemq/trunk/activemq-web/pom.xml (original) +++ activemq/trunk/activemq-web/pom.xml Fri Jan 25 19:50:15 2013 @@ -121,5 +121,10 @@ junit test + + org.slf4j + slf4j-log4j12 + test + \ No newline at end of file Modified: activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?rev=1438666&r1=1438665&r2=1438666&view=diff == --- activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java (original) +++ activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java Fri Jan 25 19:50:15 2013 @@ -197,10 +197,10 @@ public class RemoteJMXBrokerFacade exten throws IOException, MalformedObjectNameException { ObjectName name; if (this.brokerName == null) { - name = new ObjectName("org.apache.activemq:Type=Broker,*"); + name = new ObjectName("org.apache.activemq:type=Broker,*"); } else { - name = new ObjectName("org.apache.activemq:BrokerName=" - + this.brokerName + ",Type=Broker"); + name = new ObjectName("org.apache.activemq:brokerName=" + + this.brokerName + ",Type=broker"); } Set brokers = connection.queryNames(name, null); Added: activemq/trunk/activemq-web/src/test/java/org/apache/activemq/web/RemoteJMXBrokerTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/test/java/org/apache/activemq/web/RemoteJMXBrokerTest.java?rev=1438666&view=auto == --- activemq/trunk/activemq-web/src/test/java/org/apache/activemq/web/RemoteJMXBrokerTest.java (added) +++ activemq/trunk/activemq-web/src/test/java/org/apache/activemq/web/RemoteJMXBrokerTest.java Fri Jan 25 19:50:15 2013 @@ -0,0 +1,85 @@ +/** + * 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.web; + +import org.apache.activemq.broker.BrokerFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.jmx.ManagementContext; +import org.apache.activemq.web.config.SystemPropertiesConfiguration; +import org.junit.Before; +import org.junit.Test; + +import javax.management.ObjectName; +import javax.management.remote.JMXConnectorServer; +import java.lang.reflect.Field; +import java.util.Set; + +import static org.junit.Assert.assertEquals; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + * + * You can use this class to connect up to a running web console and run some queries. + * Used to work through h
svn commit: r1438197 - /activemq/trunk/activemq-tooling/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java
Author: ceposta Date: Thu Jan 24 21:16:38 2013 New Revision: 1438197 URL: http://svn.apache.org/viewvc?rev=1438197&view=rev Log: Fix for https://issues.apache.org/jira/browse/AMQ-4275 maven plugin goal "activemq:run" cannot run in latest 5.8 snapshot Modified: activemq/trunk/activemq-tooling/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java Modified: activemq/trunk/activemq-tooling/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-tooling/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java?rev=1438197&r1=1438196&r2=1438197&view=diff == --- activemq/trunk/activemq-tooling/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java (original) +++ activemq/trunk/activemq-tooling/activemq-maven-plugin/src/main/java/org/apache/activemq/maven/BrokerMojo.java Thu Jan 24 21:16:38 2013 @@ -51,7 +51,7 @@ public class BrokerMojo extends Abstract /** * The maven project. * - * @parameter property="${project}" + * @parameter property="project" * @required * @readonly */ @@ -62,7 +62,7 @@ public class BrokerMojo extends Abstract * is described http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html";>here * - * @parameter property="${configUri}" + * @parameter property="configUri" * default-value="broker:(tcp://localhost:61616)?useJmx=false&persistent=false" * @required */ @@ -71,21 +71,21 @@ public class BrokerMojo extends Abstract /** * Indicates whether to fork the broker, useful for integration tests. * - * @parameter property="${fork}" default-value="false" + * @parameter property="fork" default-value="false" */ private boolean fork; /** * System properties to add * - * @parameter property="${systemProperties}" + * @parameter property="systemProperties" */ private Properties systemProperties; /** * Skip execution of the ActiveMQ Broker plugin if set to true * - * @parameter property="${skip}" + * @parameter property="skip" */ private boolean skip;
svn commit: r1424770 - /activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md
Author: ceposta Date: Fri Dec 21 00:06:40 2012 New Revision: 1424770 URL: http://svn.apache.org/viewvc?rev=1424770&view=rev Log: Updated mqtt-docs for wildcard subscription section.. can't do regex match or partial match on dests Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md Modified: activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md?rev=1424770&r1=1424769&r2=1424770&view=diff == --- activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md (original) +++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md Fri Dec 21 00:06:40 2012 @@ -201,8 +201,6 @@ For example using the above, these subsc * `PRICE/STOCK/#` : Any price for a stock on any exchange * `PRICE/STOCK/NASDAQ/+` : Any stock price on NASDAQ * `PRICE/STOCK/+/IBM` : Any IBM stock price on any exchange -* `PRICE/STOCK/+/I+` : Any stock price starting with 'I' on any exchange -* `PRICE/STOCK/+/+{[0-9]}` : Any stock price that ends in a digit on any exchange ### Keep Alive ${project_name} will only set a keep-alive/heart-beat monitor if the client has specified a `keepAlive` value in the
svn commit: r1424753 - in /activemq/activemq-apollo/trunk/apollo-website/src: documentation/mqtt-manual.md index.page
Author: ceposta Date: Thu Dec 20 23:21:10 2012 New Revision: 1424753 URL: http://svn.apache.org/viewvc?rev=1424753&view=rev Log: First crack at MQTT documentation, https://issues.apache.org/jira/browse/APLO-279 Added: activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md Modified: activemq/activemq-apollo/trunk/apollo-website/src/index.page Added: activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md?rev=1424753&view=auto == --- activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md (added) +++ activemq/activemq-apollo/trunk/apollo-website/src/documentation/mqtt-manual.md Thu Dec 20 23:21:10 2012 @@ -0,0 +1,218 @@ +# Apollo ${project_version} MQTT Protocol Manual + +{:toc:2-5} + +## The MQTT Protocol + +${project_name} allows clients to connect using the MQTT which is an open-source protocol specification +intended for limited-resource devices on unreliable networks using a publish-subscribe domain. +These types of devices usually require a small footprint and are not well suited for text-based protocols such as +HTTP or STOMP or even traditional binary protocols such as Openwire or AMQP. MQTT is a compact binary protocol that +is optimized for these types of limited devices and unreliable networks. + +In previous releases, MQTT was supported in ${project_name} as a separate plugin. As of now, that plugin has become part +of the main development trunk and MQTT support is available out of the box without any other configuration or +packaging of third-party plugins. + + +Since MQTT is a wire-level protocol, any client that implements the protocol should be able to connect to ${project_name} +and also interoperate with other MQTT-compatibe message brokers. + +To learn more about the details of MQTT, see [the MQTT Specification](http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html) + +### MQTT Protocol Options + +To start using the MQTT protocol, use a valid MQTT v3.1 client and connect to the port on which ${project_name} is listening. +${project_name} will do protocol detection and will automatically recognize the MQTT payloads and treat the connection +as an MQTT connection. You don't have to open a special port for MQTT (or STOMP, Openwire, AMQP, etc. they can +all be auto-detected). To force specific protocols over a certain connector there are two ways you can do this. +You can choose to not use protocol detection at all and set the connector to be specifically for mqtt: + +{pygmentize:: xml} + +{pygmentize} + +Alternatively, you can limit which protocols can be "detected" using the `` configuration element like this: + +{pygmentize:: xml} + + + +{pygmentize} + +The `protocols` attribute in the `` element takes space delimited protoco values. +The `protocol` attribtue of the `` element takes a single protocol, not space delimited. It defaults to +`any` + +If you wish to tune the MQTT defaults, you can use the `mqtt` configuration element within the `connector` element +in the `apollo.xml` configuration file : + +{pygmentize:: xml} + + + +{pygmentize} + +The `mqtt` element supports the following configuration attributes: + +* `max_message_length` : The size (in bytes) of the largest message that can be sent to the broker. Defaults to 100MB +* `protocol_filters` : A filter which can filter frames being sent/received to and from a client. It can modify the frame or even drop it. +* `die_delay` : How long after a connection is deemed to be "dead" before the connection actually closes; default: 5000ms + +The mqtt configuration element can also be used to control how the destination +headers are parsed and interpreted. The supported attributes are: + +* `queue_prefix` : a tag used to identify destination types; default: null +* `path_separator` : used to separate segments in a destination name; default: `/` +* `any_child_wildcard` : indicate all child-level destinations that match the wildcard; default: `+` +* `any_descendant_wildcard` : indicate destinations that match the wildcard recursively; default: `#` +* `regex_wildcard_start` : pattern used to identify the start of a regex +* `regex_wildcard_end` : pattern used to identify the end of a regex +* `part_pattern` : allows you to specify a regex that constrains the naming of topics. default: `[ a-zA-Z0-9\_\-\%\~\:\(\)]+` + + + +### Client Libraries + +${project_name} supports v3.1 of the MQTT protocol. The following clients will work: + +* Java : [mqtt-client](https://github.com/fusesource/mqtt-client), [MeQanTT](https://github.com/AlbinTheander/MeQanTT) +* C : [libmosquitto](http://mosquitto.org/man/libmosquitto-3.html) +* Erlang : [erlmqtt](https://github.com/squaremo/erlmqtt), [my-mqtt
svn commit: r1424752 - /activemq/activemq-apollo/trunk/pom.xml
Author: ceposta Date: Thu Dec 20 23:20:59 2012 New Revision: 1424752 URL: http://svn.apache.org/viewvc?rev=1424752&view=rev Log: Fix for https://issues.apache.org/jira/browse/APLO-281 Changed jetty to 8.1.5.v20120716 to get rid of that annoying "Finding identity service:null" message when Apollo startup Modified: activemq/activemq-apollo/trunk/pom.xml Modified: activemq/activemq-apollo/trunk/pom.xml URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1424752&r1=1424751&r2=1424752&view=diff == --- activemq/activemq-apollo/trunk/pom.xml (original) +++ activemq/activemq-apollo/trunk/pom.xml Thu Dec 20 23:20:59 2012 @@ -70,7 +70,7 @@ 0.1.8 1.7.2.2 1.0 -8.1.8.v20121106 +8.1.5.v20120716 1.0.1 4.10 2.0
svn commit: r1418378 - /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java
Author: ceposta Date: Fri Dec 7 16:19:08 2012 New Revision: 1418378 URL: http://svn.apache.org/viewvc?rev=1418378&view=rev Log: Fix for https://issues.apache.org/jira/browse/AMQ-4190 - Figure out what was intended with transactions and producer flow control for topics Fix the counter so the logging happens Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java?rev=1418378&r1=1418377&r2=1418378&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/broker/region/Topic.java Fri Dec 7 16:19:08 2012 @@ -404,6 +404,7 @@ public class Topic extends BaseDestinati LOG.warn("Waiting for space to send transacted message - transaction elements = " + size + " need more space to commit. Message = " + message); } +count++; } } else { waitForSpace(
svn commit: r1418373 - in /activemq/trunk: activemq-broker/src/main/java/org/apache/activemq/network/ activemq-core/src/test/java/org/apache/activemq/network/ activemq-core/src/test/resources/org/apac
Author: ceposta Date: Fri Dec 7 16:13:49 2012 New Revision: 1418373 URL: http://svn.apache.org/viewvc?rev=1418373&view=rev Log: Fix for: https://issues.apache.org/jira/browse/AMQ-4209 - NetworkConnector and NetworkBridgeConfiguration have same named private variables for excludedDestination https://issues.apache.org/jira/browse/AMQ-4210 -DynamicallyIncludedDestinations is not enforced for the other end of duplex bridge excludedDestinations dynamicallyIncludedDestinations staticallyIncludedDestinations Updated some tests: request-reply with temp dest is not supported with dynamicallyAddedDestinations ATM Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DynamicallyIncludedDestinationsDuplexNetworkTest.java activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/duplexDynamicIncludedDestLocalBroker.xml Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/DemandForwardingBridgeFilterTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/MulticastNetworkTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkConnectionsCleanedupTest.java activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/network/duplexLocalBroker.xml Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java?rev=1418373&r1=1418372&r2=1418373&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkBridgeConfiguration.java Fri Dec 7 16:13:49 2012 @@ -16,16 +16,21 @@ */ package org.apache.activemq.network; -import java.util.List; - import org.apache.activemq.advisory.AdvisorySupport; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ConsumerInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; /** * Configuration for a NetworkBridge */ public class NetworkBridgeConfiguration { +private static final Logger LOG = LoggerFactory.getLogger(NetworkBridgeConfiguration.class); + private boolean conduitSubscriptions = true; private boolean dynamicOnly; private boolean dispatchAsync = true; @@ -42,9 +47,9 @@ public class NetworkBridgeConfiguration private String destinationFilter = null; private String name = "NC"; -private List excludedDestinations; -private List dynamicallyIncludedDestinations; -private List staticallyIncludedDestinations; +protected List excludedDestinations = new CopyOnWriteArrayList(); +protected List dynamicallyIncludedDestinations = new CopyOnWriteArrayList(); +protected List staticallyIncludedDestinations = new CopyOnWriteArrayList(); private boolean suppressDuplicateQueueSubscriptions = false; private boolean suppressDuplicateTopicSubscriptions = true; Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java?rev=1418373&r1=1418372&r2=1418373&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/network/NetworkConnector.java Fri Dec 7 16:13:49 2012 @@ -67,9 +67,7 @@ public abstract class NetworkConnector e }; private Set durableDestinations; -private List excludedDestinations = new CopyOnWriteArrayList(); -private List dynamicallyIncludedDestinations = new CopyOnWriteArrayList(); -private List staticallyIncludedDestinations = new CopyOnWriteArrayList(); + private BrokerService brokerService; private ObjectName objectName; @@ -102,57 +100,16 @@ public abstract class NetworkConnector e this.durableDestinations = durableDestinations; } -/** - * @return Returns the excludedDestinations. - */ -public List getExcludedDestinations() { -return excludedDestinations; -} - -/** - * @param excludedDestinations The excludedDestinations to set. - */ -public void setExcludedD
svn commit: r1416524 - in /activemq/trunk: activemq-http/src/test/webapp/stomp.js activemq-web-demo/src/main/webapp/websocket/stomp.js assembly/src/sample-conf/activemq-demo.xml
Author: ceposta Date: Mon Dec 3 14:02:39 2012 New Revision: 1416524 URL: http://svn.apache.org/viewvc?rev=1416524&view=rev Log: https://issues.apache.org/jira/browse/AMQ-4200 Update the websocket example to use the latest stomp.js which supports STOMP 1.1 (including heart-beating). Also added a websocket connector to the activemq-demo.xml config file. Thanks Jeff Mensil!! Modified: activemq/trunk/activemq-http/src/test/webapp/stomp.js activemq/trunk/activemq-web-demo/src/main/webapp/websocket/stomp.js activemq/trunk/assembly/src/sample-conf/activemq-demo.xml Modified: activemq/trunk/activemq-http/src/test/webapp/stomp.js URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-http/src/test/webapp/stomp.js?rev=1416524&r1=1416523&r2=1416524&view=diff == --- activemq/trunk/activemq-http/src/test/webapp/stomp.js (original) +++ activemq/trunk/activemq-http/src/test/webapp/stomp.js Mon Dec 3 14:02:39 2012 @@ -1,148 +1,269 @@ -/** - * - * 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 Client, Stomp, WebSocketStompMock; - var __hasProp = Object.prototype.hasOwnProperty, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; - Stomp = { -frame: function(command, headers, body) { - if (headers == null) { -headers = []; + 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 (body == null) { -body = ''; + if (this.body) { +lines.push("content-length:" + ('' + this.body).length); } - return { -command: command, -headers: headers, -body: body, -id: headers.id, -receipt: headers.receipt, -transaction: headers.transaction, -destination: headers.destination, -subscription: headers.subscription, -error: null, -toString: function() { - var lines, name, value; - lines = [command]; - for (name in headers) { -if (!__hasProp.call(headers, name)) continue; -value = headers[name]; -lines.push("" + name + ":" + value); - } - lines.push('\n' + body); - return lines.join('\n'); -} - }; -}, -unmarshal: function(data) { - var body, chr, command, divider, headerLines, headers, i, idx, line, trim, _ref, _ref2, _ref3; - divider = data.search(/\n\n/); - headerLines = data.substring(0, divider).split('\n'); + 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 = {}; - body = ''; trim = function(str) { -return str.replace(/^\s+/g, '').replace(/\s+$/g, ''); +return str.replace(/^\s+|\s+$/g, ''); }; line = idx = null; - for (i = 0, _ref = headerLines.length; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) { + for (i = _i = 0, _ref = headerLines.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i
svn commit: r1416498 - /activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/websocket/js/stomp.js
Author: ceposta Date: Mon Dec 3 13:06:35 2012 New Revision: 1416498 URL: http://svn.apache.org/viewvc?rev=1416498&view=rev Log: https://issues.apache.org/jira/browse/APLO-273 - Update the websocket example to use the latest stomp.js which supports STOMP 1.1 (including heart-beating). Jeff Mensil provided patch. Thank you! Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/websocket/js/stomp.js Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/websocket/js/stomp.js URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/websocket/js/stomp.js?rev=1416498&r1=1416497&r2=1416498&view=diff == --- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/websocket/js/stomp.js (original) +++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/examples/websocket/js/stomp.js Mon Dec 3 13:06:35 2012 @@ -1,55 +1,45 @@ -// Generated by CoffeeScript 1.3.1 +// Generated by CoffeeScript 1.3.3 +(function() { + var Byte, Client, Frame, Stomp, +__hasProp = {}.hasOwnProperty; -/* -Copyright (C) 2010 Jeff Mesnil -- http://jmesnil.net/ -Copyright (C) 2012 FuseSource, Inc. -- http://fusesource.com -*/ + Byte = { +LF: '\x0A', +NULL: '\x00' + }; + Frame = (function() { -(function() { - var Client, Stomp, WebSocketStompMock, -__hasProp = {}.hasOwnProperty; +function Frame(command, headers, body) { + this.command = command; + this.headers = headers != null ? headers : {}; + this.body = body != null ? body : ''; +} - Stomp = { -frame: function(command, headers, body) { - if (headers == null) { -headers = []; +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 (body == null) { -body = ''; + if (this.body) { +lines.push("content-length:" + ('' + this.body).length); } - return { -command: command, -headers: headers, -body: body, -id: headers.id, -receipt: headers.receipt, -transaction: headers.transaction, -destination: headers.destination, -subscription: headers.subscription, -error: null, -toString: function() { - var lines, name, value; - lines = [command]; - for (name in headers) { -if (!__hasProp.call(headers, name)) continue; -value = headers[name]; -lines.push("" + name + ":" + value); - } - lines.push('\n' + body); - return lines.join('\n'); -} - }; -}, -unmarshal: function(data) { - var body, chr, command, divider, headerLines, headers, i, idx, line, trim, _i, _j, _ref, _ref1, _ref2; - divider = data.search(/\n\n/); - headerLines = data.substring(0, divider).split('\n'); + 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 = {}; - body = ''; trim = function(str) { -return str.replace(/^\s+/g, '').replace(/\s+$/g, ''); +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) { @@ -57,134 +47,221 @@ Copyright (C) 2012 FuseSource, Inc. -- h idx = line.indexOf(':'); headers[trim(line.substring(0, idx))] = trim(line.substring(idx + 1)); } - chr = null; - for (i = _j = _ref1 = divider + 2, _ref2 = data.length; _ref1 <= _ref2 ? _j < _ref2 : _j > _ref2; i = _ref1 <= _ref2 ? ++_j : --_j) { -chr = data.charAt(i); -if (chr === '\x00') { - break; + 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 <=
svn commit: r1415631 - /activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java
Author: ceposta Date: Fri Nov 30 13:42:48 2012 New Revision: 1415631 URL: http://svn.apache.org/viewvc?rev=1415631&view=rev Log: https://issues.apache.org/jira/browse/AMQ-4198 Include username in ConnectionInfo for ActiveMQ.Advisory.Connection messages Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java Modified: activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java?rev=1415631&r1=1415630&r2=1415631&view=diff == --- activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java (original) +++ activemq/trunk/activemq-broker/src/main/java/org/apache/activemq/advisory/AdvisoryBroker.java Fri Nov 30 13:42:48 2012 @@ -79,9 +79,8 @@ public class AdvisoryBroker extends Brok super.addConnection(context, info); ActiveMQTopic topic = AdvisorySupport.getConnectionAdvisoryTopic(); -//do not distribute usernames or passwords in advisory +// do not distribute passwords in advisory messages. usernames okay ConnectionInfo copy = info.copy(); -copy.setUserName(""); copy.setPassword(""); fireAdvisory(context, topic, copy); connections.put(copy.getConnectionId(), copy);
svn commit: r1414852 - /activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java
Author: ceposta Date: Wed Nov 28 18:29:44 2012 New Revision: 1414852 URL: http://svn.apache.org/viewvc?rev=1414852&view=rev Log: https://issues.apache.org/jira/browse/AMQ-4195 - activemq-admin bstat command predefined query isn't even run Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java Modified: activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java?rev=1414852&r1=1414851&r2=1414852&view=diff == --- activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java (original) +++ activemq/trunk/activemq-console/src/main/java/org/apache/activemq/console/command/BstatCommand.java Wed Nov 28 18:29:44 2012 @@ -75,12 +75,13 @@ public class BstatCommand extends QueryC queryTokens.add("--objname"); queryTokens.add("Type=*,BrokerName=" + brokerName); queryTokens.add("-xQTopic=ActiveMQ.Advisory.*"); -queryTokens.add("--vuew"); +queryTokens.add("--view"); queryTokens.add("Type,BrokerName,Destination,ConnectorName,EnqueueCount," + "DequeueCount,TotalEnqueueCount,TotalDequeueCount,Messages," + "TotalMessages,ConsumerCount,TotalConsumerCount,DispatchQueueSize"); // Call the query command +super.parseOptions(queryTokens); super.runTask(queryTokens); }
svn commit: r1404165 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/util/ test/java/org/apache/activemq/transport/tcp/ test/java/org/apache/activemq/util/
Author: ceposta Date: Wed Oct 31 14:23:45 2012 New Revision: 1404165 URL: http://svn.apache.org/viewvc?rev=1404165&view=rev Log: https://issues.apache.org/jira/browse/AMQ-4145 IntrospectionSupport does not convert from primitive to Wrapper classes appropriately Added two tests to show the conversion was not happening properly, and added an identity converter to the TypeConversionSupport to do a pass-through conversion on types that are the same after a primitive to wrapper class conversion Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/util/IntrospectionSupportTest.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java?rev=1404165&r1=1404164&r2=1404165&view=diff == --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/TypeConversionSupport.java Wed Oct 31 14:23:45 2012 @@ -29,6 +29,13 @@ import org.apache.activemq.command.Activ */ public final class TypeConversionSupport { +private static final Converter IDENTITY_CONVERTER = new Converter() { +@Override +public Object convert(Object value) { +return value; +} +}; + private static class ConversionKey { final Class from; final Class to; @@ -191,6 +198,10 @@ public final class TypeConversionSupport to = convertPrimitiveTypeToWrapperType(to); } +if (from.equals(to)) { +return IDENTITY_CONVERTER; +} + return CONVERSION_MAP.get(new ConversionKey(from, to)); } Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java?rev=1404165&view=auto == --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java (added) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/tcp/TcpTransportServerTest.java Wed Oct 31 14:23:45 2012 @@ -0,0 +1,80 @@ +/** + * 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.transport.tcp; + +import junit.framework.TestCase; +import org.apache.activemq.transport.*; + +import javax.net.ServerSocketFactory; +import java.net.Socket; +import java.net.URI; +import java.util.HashMap; + +/** + * @author http://www.christianposta.com/blog";>Christian Posta + */ +public class TcpTransportServerTest extends TestCase{ + +public void testDefaultPropertiesSetOnTransport() throws Exception { +TcpTransportServer server = (TcpTransportServer) TransportFactory.bind(new URI("tcp://localhost:61616?trace=true")); +server.setTransportOption(new HashMap()); + +server.setAcceptListener(new TransportAcceptListener() { +@Override +public void onAccept(Transport transport) { +assertTrue("This transport does not have a TransportLogger!!", hasTransportLogger(transport)); +} + +@Override +public void onAcceptError(Exception error) { +fail("Should not have received an error!"); +} +}); + +server.start(); + + +Socket socket = new Socket("localhost", 61616); +server.handleSocket(socket); +server.stop(); + + +} + +private boolean hasTransportLogger(Transport transport) { +boolean end = false; + +Tra
svn commit: r1401102 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
Author: ceposta Date: Mon Oct 22 22:01:08 2012 New Revision: 1401102 URL: http://svn.apache.org/viewvc?rev=1401102&view=rev Log: Tests for https://issues.apache.org/jira/browse/AMQ-4123 Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java?rev=1401102&r1=1401101&r2=1401102&view=diff == --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java Mon Oct 22 22:01:08 2012 @@ -16,34 +16,43 @@ */ package org.apache.activemq.transport.mqtt; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Vector; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; +import javax.net.SocketFactory; + import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.AutoFailTestSupport; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.command.ActiveMQMessage; +import org.apache.activemq.transport.Transport; +import org.apache.activemq.transport.TransportListener; +import org.apache.activemq.transport.tcp.TcpTransport; import org.apache.activemq.util.ByteSequence; +import org.fusesource.hawtbuf.UTF8Buffer; import org.fusesource.mqtt.client.BlockingConnection; import org.fusesource.mqtt.client.MQTT; import org.fusesource.mqtt.client.Message; import org.fusesource.mqtt.client.QoS; import org.fusesource.mqtt.client.Topic; +import org.fusesource.mqtt.codec.CONNECT; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static org.fusesource.hawtbuf.UTF8Buffer.utf8; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.*; public class MQTTTest { @@ -280,6 +289,70 @@ public class MQTTTest { connection.disconnect(); } +@Test +public void testInactivityTimeoutDisconnectsClient() throws Exception{ + +addMQTTConnector(brokerService); +brokerService.start(); + +// manually need to create the client so we don't send keep alive (PINGREQ) frames to keep the conn +// from timing out +final AtomicLong exceptionCount = new AtomicLong(0); +Transport clientTransport = createManualMQTTClient(exceptionCount); +clientTransport.start(); +CONNECT connectFrame = new CONNECT().clientId(new UTF8Buffer("testClient")).keepAlive((short)2); +clientTransport.oneway(connectFrame.encode()); + + + +TimeUnit.SECONDS.sleep(10); +System.out.println("Done waiting"); +assertEquals("We have elapsed the keep alive, we should have disconnected", 1, exceptionCount.get()); + +} + + +private Transport createManualMQTTClient(final AtomicLong exceptionCount) throws IOException, URISyntaxException { +Transport clientTransport = new TcpTransport(new MQTTWireFormat(), SocketFactory.getDefault(), +new URI("tcp://localhost:1883"), null); +clientTransport.setTransportListener(new TransportListener() { +@Override +public void onCommand(Object command) { +} + +@Override +public void onException(IOException error) { +System.out.println("Exception!!!" + error.getMessage()); +exceptionCount.incrementAndGet(); +} + +@Override +public void transportInterupted() { +} + +@Override +public void transportResumed() { +} +}); +return clientTransport; +} + +@Test +public void testPingKeepsInactivityMonitorAlive() throws Exception { +addMQTTConnector(brokerService); +brokerService.start(); +MQTT mqtt = createMQTTConnection(); +mqtt.setKeepAlive((short)2); +final BlockingConnection connection = mqtt.blockingConnection(); +connection.connect(); + +TimeUnit.SECONDS.sleep(10); + +assertTrue("KeepAlive didn't work properly", connection.isConnected()); + +connection.disconnect(); +} +