JBoss hornetq SVN: r9366 - tags.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-06-28 10:53:36 -0400 (Mon, 28 Jun 2010)
New Revision: 9366
Added:
tags/HornetQ_2_1_1_Final/
Removed:
tags/Hornetq_2_1_1_Final/
Log:
Fixing typo on the tag name
Copied: tags/HornetQ_2_1_1_Final (from rev 9365, tags/Hornetq_2_1_1_Final)
13 years, 10 months
JBoss hornetq SVN: r9365 - tags.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-06-28 10:52:51 -0400 (Mon, 28 Jun 2010)
New Revision: 9365
Added:
tags/HornetQ_2_1_0_Final/
Removed:
tags/Hornetq_2_1_0_Final/
Log:
Fixing typo on the tag name
Copied: tags/HornetQ_2_1_0_Final (from rev 9364, tags/Hornetq_2_1_0_Final)
13 years, 10 months
JBoss hornetq SVN: r9364 - trunk/docs/user-manual/zh.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2010-06-28 09:36:00 -0400 (Mon, 28 Jun 2010)
New Revision: 9364
Modified:
trunk/docs/user-manual/zh/appserver-integration.xml
Log:
sync doc
Modified: trunk/docs/user-manual/zh/appserver-integration.xml
===================================================================
--- trunk/docs/user-manual/zh/appserver-integration.xml 2010-06-28 07:54:56 UTC (rev 9363)
+++ trunk/docs/user-manual/zh/appserver-integration.xml 2010-06-28 13:36:00 UTC (rev 9364)
@@ -23,10 +23,6 @@
有关JCA适配器集成的说明来操作。</para>
<para>JCA适配器的作用是控制消息流入到消息Bean(MDB),并控制消息从各种JEE模块中发出(如EJB和Servlet)。</para>
<para>本章讲述这些JEE模块配置HornetQ的基本信息。</para>
- <section>
- <title>应用服务器集成所依赖的模块</title>
- <para></para>
- </section>
<section>
<title>配置消息Bean</title>
<para>使用HornetQ向MDB传递消息,需要在文件<literal>ra.xml</literal>中配置JCA适配器。该文件在
13 years, 10 months
JBoss hornetq SVN: r9363 - trunk/docs/user-manual/en.
by do-not-reply@jboss.org
Author: ataylor
Date: 2010-06-28 03:54:56 -0400 (Mon, 28 Jun 2010)
New Revision: 9363
Modified:
trunk/docs/user-manual/en/appserver-integration.xml
Log:
removed un wanted section
Modified: trunk/docs/user-manual/en/appserver-integration.xml
===================================================================
--- trunk/docs/user-manual/en/appserver-integration.xml 2010-06-28 06:56:26 UTC (rev 9362)
+++ trunk/docs/user-manual/en/appserver-integration.xml 2010-06-28 07:54:56 UTC (rev 9363)
@@ -28,10 +28,6 @@
outflow of messages sent from other JEE components, e.g. EJBs and Servlets.</para>
<para>This section explains the basics behind configuring the different JEE components in the
AS.</para>
- <section>
- <title>Dependencies for Application Server Integration</title>
- <para></para>
- </section>
<section>
<title>Configuring Message-Driven Beans</title>
<para>The delivery of messages to an MDB using HornetQ is configured on the JCA Adapter via
13 years, 10 months
JBoss hornetq SVN: r9362 - trunk/docs/user-manual/zh.
by do-not-reply@jboss.org
Author: gaohoward
Date: 2010-06-28 02:56:26 -0400 (Mon, 28 Jun 2010)
New Revision: 9362
Modified:
trunk/docs/user-manual/zh/appserver-integration.xml
trunk/docs/user-manual/zh/interoperability.xml
trunk/docs/user-manual/zh/jms-bridge.xml
Log:
chinese doc sync
Modified: trunk/docs/user-manual/zh/appserver-integration.xml
===================================================================
--- trunk/docs/user-manual/zh/appserver-integration.xml 2010-06-24 12:43:07 UTC (rev 9361)
+++ trunk/docs/user-manual/zh/appserver-integration.xml 2010-06-28 06:56:26 UTC (rev 9362)
@@ -23,6 +23,10 @@
有关JCA适配器集成的说明来操作。</para>
<para>JCA适配器的作用是控制消息流入到消息Bean(MDB),并控制消息从各种JEE模块中发出(如EJB和Servlet)。</para>
<para>本章讲述这些JEE模块配置HornetQ的基本信息。</para>
+ <section>
+ <title>应用服务器集成所依赖的模块</title>
+ <para></para>
+ </section>
<section>
<title>配置消息Bean</title>
<para>使用HornetQ向MDB传递消息,需要在文件<literal>ra.xml</literal>中配置JCA适配器。该文件在
@@ -249,6 +253,26 @@
都可以使用JMS的JCA适配器来发送消息。</para>
</section>
<section>
+ <title>MDB与接收池的大小</title>
+ <para>包括JBoss在内的绝大多数应用服务器允许用户定义一个池中的MDB数量。在JBoss中这个参数名是<literal>MaxPoolSize</literal>,它在文件
+ ejb3-interceptors-aop.xml中配置。这个参数不影响实际创建的会话/接收者的数量。资源适配器不知道MDB的具体实现。所以即使你设置MDB池在大小
+ 为1,仍然会有15个会话/接收者被创建(默认值)。如果你想改变会话/接收者创建的数量,你可以通过设置资源适配器的参数
+ <literal>maxSession</literal>实现。也可以通过设置MDB的激活配置参数来完成:</para>
+ <programlisting>@MessageDriven(name = "MDBMessageSendTxExample",
+ activationConfig =
+ {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"),
+ @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")
+ })
+@TransactionManagement(value= TransactionManagementType.CONTAINER)
+@TransactionAttribute(value= TransactionAttributeType.REQUIRED)
+@ResourceAdapter("hornetq-ra.rar")
+public class MyMDB implements MessageListener
+{ ....}
+ </programlisting>
+ </section>
+ <section>
<title>配置JCA适配器</title>
<para>通过JCA适配器可以将HornetQ集成到JEE兼容的模块中,如MDB和EJB。它的配置决定了这些模块如何接收和发送消息。</para>
<para>HornetQ的JCA适配器是通过<literal>jms-ra.rar</literal>部署的。它的配置文件中其中的
@@ -747,9 +771,34 @@
</section>
<section>
<title>配置适配器访问单独的HornetQ服务器</title>
- <para>在有的情况下,消息服务器与应用服务器运行在不同的机器上。</para>
- <para>这时你需要同时配置内部和外部适配器。</para>
- <para>为了使MDB能接收远程HornetQ服务器的消息,你需要配置ra.xml文件。这个文件的位置是<literal>deploy/hornet-ra.rar/META-INF</literal>。你需要配置一个netty连接器(不是invm连接器)及其传输参数。下面是一个配置的例子:</para>
+ <para>在有的情况下,消息服务器与应用服务器运行在不同的机器上。这时客户端只需要安装HornetQ的客户端的库文件。本节给出了具体的配置和所需要的jar文件。</para>
+ <section>
+ <para>你需要配置两个配置文件。一个是MDB所用的内部适配器,另一个是可以创建外部连接的外部适配器。</para>
+ <section>
+ <title>配置内部适配器</title>
+ <para>首先在<literal>deploy</literal>目录下创建一个以.rar为结尾的文件夹。
+ 在这里我们将其命名为<literal>hornetq-ra.rar</literal>。主注意这一点很重要,因为MDB和外部配置都需要引用
+ 该文件夹的名字。
+ </literal>
+ </para>
+ <note>
+ <para>在JBoss中该文件夹的默认名为<literal>jms-ra.rar</literal>。你可以直接使用这个名字。但是你可能需要避免
+ 与其它的通用适配器相冲突。
+ </para>
+ </note>
+ <para>在文件夹
+ <literal>hornetq-ra.rar</literal>
+ 下创建名为
+ <literal>META-INF</literal>
+ 的文件夹,然后在些文件夹内创建一个
+ <literal>ra.xml</literal>配置文件。在HornetQ发布包中
+ 有一个<literal>ra.xml</literal>模板文件供你使用。
+ </para>
+ <para>要配置MDB接收远程HornetQ服务器的消息,你需要修改<literal>deploy/hornet-ra.rar/META-INF</literal>下面的
+ <literal>ra.xml</literal>文件,将传输层改为netty连接器(不要使用invm连接器)及其相应的参数。下面
+ 是一个配置的例子:
+ </para>
+
<programlisting>
<resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter</resourceadapter-class>
<config-property>
@@ -766,8 +815,15 @@
</config-property>
</programlisting>
<para>上面的配置中,适配器连接到一个运行在本机上端口为5446的服务器。</para>
- <para>同时你还需要配置外部的连接,也连接到这个服务器。这需要配置<literal>deploy/hornetq.sar</literal>
- 下的jms-ds.xml文件,或者创建一个新的配置文件,文件名必须以-ds.xml结尾。</para>
+ </section>
+
+ <section>
+ <title>配置外部适配器</title>
+ <para>你还需要创建一个<literal>hornetq-ds.xml</literal>文件来配置外部连接。该文件需要放置在<literal>deploy</literal>
+ 下的任意一个文件夹中。在一相标准的安装中这个文件夹是<literal>horneq</literal> 或者 <literal>hornetq.sar</literal>。
+ 当然你可以选择其它文件夹。该文件的名字只要是以<literal>-ds.xml</literal>即可。在HornetQ的发布包中包含有一个模板文件,
+ 它的名字是<literal>jms-ds.xml</literal>,位置就在config文件夹下。
+ </para>
<para>下面是一个配置的例子。</para>
<programlisting>
<tx-connection-factory>
@@ -782,7 +838,50 @@
</tx-connection-factory>
</programlisting>
<para>这个配置同样是连接到运行在本机上的端口为5446的HornetQ服务器。JEE模块可以通过JNDI查找
- <literal>java:/RemoteJmsXA</literal>来使用外部的服务了。</para>
+ <literal>java:/RemoteJmsXA</literal>(由<literal>jndi-name</literal>参数定义)。如上节所述,
+ 资源适配器根据文件夹下的配置来创建外部连接。</para>
+ <section>
+ <title>依赖的jar文件</title>
+ <para>下面列出了HornetQ所需要的第三方jar文件</para>
+ <table frame="topbot" border="2">
+ <title>Jar文件</title>
+ <tgroup cols="3">
+ <colspec colname="c1" colnum="1"/>
+ <colspec colname="c2" colnum="2"/>
+ <colspec colname="c3" colnum="3"/>
+ <thead>
+ <row>
+ <entry>Jar文件名</entry>
+ <entry>说明</entry>
+ <entry>位置</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>hornetq-ra.jar</entry>
+ <entry>HornetQ资源适配器文件</entry>
+ <entry>deploy/hornetq-ra.rar或相应的位置</entry>
+ </row>
+ <row>
+ <entry>hornetq-core-client.jar</entry>
+ <entry>HornetQ核心客户类库</entry>
+ <entry>在JBoss的default/lib下或者是$JBOSS_HOME/common/lib下。 </entry>
+ </row>
+ <row>
+ <entry>hornetq-jms-client.jar</entry>
+ <entry>HornetQ的JMS类</entry>
+ <entry>同上</entry>
+ </row>
+ <row>
+ <entry>netty.jar</entry>
+ <entry>Netty类库</entry>
+ <entry>同上</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ </section>
</section>
</section>
<section>
Modified: trunk/docs/user-manual/zh/interoperability.xml
===================================================================
--- trunk/docs/user-manual/zh/interoperability.xml 2010-06-24 12:43:07 UTC (rev 9361)
+++ trunk/docs/user-manual/zh/interoperability.xml 2010-06-28 06:56:26 UTC (rev 9362)
@@ -87,12 +87,12 @@
<para>Stomp基本上是一个基于文本的协议。为了使用更简单,我们的Stomp实现通过检查<literal>content-length</literal>的值
来决定如何将一个Stomp消息映射成一个JMS消息或核心消息。
</para>
- <para>如果在Stomp消息中有<literal>content-length</literal>头,它将被映射为一个JMS的
+ <para>如果在Stomp消息中<emphasis>没有</emphasis><literal>content-length</literal>头,它将被映射为一个JMS的
<emphasis>TextMessage</emphasis>,或者是一个核心消息,其消息体的缓存是一个SimpleString。</para>
- <para>如果Stomp消息中没有<literal>content-length</literal>,则它被映射为一个JMS的
+ <para>如果Stomp消息中<emphasis>有</emphasis><literal>content-length</literal>,则它被映射为一个JMS的
<emphasis>BytesMessage</emphasis>,或者是一个核心消息,其消息体缓存中是一个字节数组byte[]。</para>
<para>从一个JMS消息或核心消息映射为Stomp消息时遵从同样的逻辑。一个Stomp客户端可以通过检查
- <literal>content-length</literal>来决定消息体的类型(UTF-8字符串或字节)。</para>
+ <literal>content-length</literal>来决定消息体的类型(字符串或字节)。</para>
</section>
</section>
<section id="stomp.websockets">
Modified: trunk/docs/user-manual/zh/jms-bridge.xml
===================================================================
--- trunk/docs/user-manual/zh/jms-bridge.xml 2010-06-24 12:43:07 UTC (rev 9361)
+++ trunk/docs/user-manual/zh/jms-bridge.xml 2010-06-28 06:56:26 UTC (rev 9362)
@@ -162,6 +162,14 @@
<key>java.naming.factory.url.pkgs</key>
<value>org.jboss.naming:org.jnp.interfaces"</value>
</entry>
+ <entry>
+ <key>jnp.timeout</key>
+ <value>5000</value>
+ </entry>
+ <entry>
+ <key>jnp.sotimeout</key>
+ <value>5000</value>
+ </entry>
</map>
</constructor>
</bean>
@@ -348,6 +356,22 @@
不错的选择。</para>
</note>
</section>
+ <section>
+ <title>JMS bridge中的超时问题</title>
+ <para>有时候目标服务器或源服务器会连接不上,这里桥就会尝试重新连接。重新连接的次数由<literal>Max Retries</literal>
+ 参数决定,两次重新连接的时间间隔由<literal>Failure Retry Interval</literal>定义。</para>
+ <para>在重新尝试时会进行JNDI的查找。HornetQ的JNDI使用的是JBoss的实现,如果在JNDI查找过程中网络出现故障,
+ 查找的操作可能挂起。为了避免这种情况的发生,我们可以为JNDI设置适当的超时。这是通过定义初始上下文的
+ <literal>jnp.timeout</literal>参数和<literal>jnp.sotimeout</literal>参数来
+ 实现的。第一个参数定义了初始连接的超时,第二个参数定义的是套接字的读取超时。</para>
+ <note>
+ <para>一旦JNDI连接成功,所有调用都是通过RMI完成。如果你想要控制RMI连接的超时,你需要定义相应的系统变量。
+ JBoss使用Sun的RMI实现,它的控制参数可以在<ulink
+ url="http://java.sun.com/j2se/1.5.0/docs/guide/rmi/sunrmiproperties.html">这里</ulink>找到。
+ 默认的连接超时是10秒,默认的读超时是18秒。</para>
+ </note>
+ <para>如果你使用自己的实现来查找JMS资源,你需要注意超时问题。</para>
+ </section>
<section>
<title>例子</title>
<para>参见<xref linkend="examples.javaee.jms-bridge"/>。这个例子展示了如何在JBoss应用服务器中配置并使用
13 years, 10 months
JBoss hornetq SVN: r9361 - trunk/tests/src/org/hornetq/tests/integration/cluster/bridge.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-06-24 08:43:07 -0400 (Thu, 24 Jun 2010)
New Revision: 9361
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java
Log:
oops! enabled the test by mistake, disable it again
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java 2010-06-24 12:41:35 UTC (rev 9360)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java 2010-06-24 12:43:07 UTC (rev 9361)
@@ -76,7 +76,7 @@
}
// https://jira.jboss.org/browse/HORNETQ-382
- public void testReconnectWithPaging() throws Exception
+ public void _testReconnectWithPaging() throws Exception
{
final byte[] content = new byte[2048]; // 2 kiB
for (int i=0; i < content.length; ++i) {
13 years, 10 months
JBoss hornetq SVN: r9360 - trunk/src/main/org/hornetq/api/core/management.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-06-24 08:41:35 -0400 (Thu, 24 Jun 2010)
New Revision: 9360
Modified:
trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java
Log:
https://jira.jboss.org/browse/HORNETQ-343: Management operation results can not be read from Stomp clients
* store management operation results in the message body buffer as a nullable SimpleString (instead of a nullable String) so that it can be read by Stomp messages
* added ManagementWithStompTest
* fixed doc which contains erroneous explanation about Stomp/JMS/Core mapping
Modified: trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java
===================================================================
--- trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java 2010-06-24 12:40:30 UTC (rev 9359)
+++ trunk/src/main/org/hornetq/api/core/management/ManagementHelper.java 2010-06-24 12:41:35 UTC (rev 9360)
@@ -145,7 +145,7 @@
paramString = null;
}
- message.getBodyBuffer().writeNullableString(paramString);
+ message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(paramString));
}
private static JSONArray toJSONArray(final Object[] array) throws Exception
@@ -303,7 +303,8 @@
*/
public static Object[] retrieveOperationParameters(final Message message) throws Exception
{
- String jsonString = message.getBodyBuffer().readNullableString();
+ SimpleString sstring = message.getBodyBuffer().readNullableSimpleString();
+ String jsonString = (sstring == null) ? null : sstring.toString();
if (jsonString != null)
{
@@ -353,7 +354,7 @@
resultString = null;
}
- message.getBodyBuffer().writeNullableString(resultString);
+ message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString(resultString));
}
/**
@@ -364,8 +365,9 @@
*/
public static Object[] getResults(final Message message) throws Exception
{
- String jsonString = message.getBodyBuffer().readNullableString();
-
+ SimpleString sstring = message.getBodyBuffer().readNullableSimpleString();
+ String jsonString = (sstring == null) ? null : sstring.toString();
+ ;
if (jsonString != null)
{
JSONArray jsonArray = new JSONArray(jsonString);
13 years, 10 months
JBoss hornetq SVN: r9359 - in trunk: tests/src/org/hornetq/tests/integration/cluster/bridge and 1 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2010-06-24 08:40:30 -0400 (Thu, 24 Jun 2010)
New Revision: 9359
Added:
trunk/tests/src/org/hornetq/tests/integration/management/ManagementWithStompTest.java
Modified:
trunk/docs/user-manual/en/interoperability.xml
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java
Log:
https://jira.jboss.org/browse/HORNETQ-343: Management operation results can not be read from Stomp clients
* store management operation results in the message body buffer as a nullable SimpleString (instead of a nullable String) so that it can be read by Stomp messages
* added ManagementWithStompTest
* fixed doc which contains erroneous explanation about Stomp/JMS/Core mapping
Modified: trunk/docs/user-manual/en/interoperability.xml
===================================================================
--- trunk/docs/user-manual/en/interoperability.xml 2010-06-24 03:39:11 UTC (rev 9358)
+++ trunk/docs/user-manual/en/interoperability.xml 2010-06-24 12:40:30 UTC (rev 9359)
@@ -94,13 +94,13 @@
our Stomp implementation checks for presence of the <literal>content-length</literal> header to decide how to map a Stomp message
to a JMS Message or a Core message.
</para>
- <para>If the Stomp message has a <literal>content-length</literal> header, it will be mapped to a JMS <emphasis>TextMessage</emphasis>
+ <para>If the Stomp message does <emphasis>not</emphasis> have a <literal>content-length</literal> header, it will be mapped to a JMS <emphasis>TextMessage</emphasis>
or a Core message with a <emphasis>single nullable SimpleString in the body buffer</emphasis>.</para>
- <para>Alternatively, if the Stomp message does <emphasis>not</emphasis> have a <literal>content-length</literal> header,
+ <para>Alternatively, if the Stomp message <emphasis>has</emphasis> a <literal>content-length</literal> header,
it will be mapped to a JMS <emphasis>BytesMessage</emphasis>
or a Core message with a <emphasis>byte[] in the body buffer</emphasis>.</para>
<para>The same logic applies when mapping a JMS message or a Core message to Stomp. A Stomp client can check the presence
- of the <literal>content-length</literal> header to determine the type of the message body (UTF-8 String or bytes).</para>
+ of the <literal>content-length</literal> header to determine the type of the message body (String or bytes).</para>
</section>
</section>
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java 2010-06-24 03:39:11 UTC (rev 9358)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithPagingTest.java 2010-06-24 12:40:30 UTC (rev 9359)
@@ -76,9 +76,9 @@
}
// https://jira.jboss.org/browse/HORNETQ-382
- public void _testReconnectWithPaging() throws Exception
+ public void testReconnectWithPaging() throws Exception
{
- final byte[] content = new byte[2048];
+ final byte[] content = new byte[2048]; // 2 kiB
for (int i=0; i < content.length; ++i) {
content[i] = (byte) i;
}
@@ -108,7 +108,7 @@
final long retryInterval = 50;
final double retryIntervalMultiplier = 1d;
final int reconnectAttempts = -1;
- final int confirmationWindowSize = 1024;
+ final int confirmationWindowSize = 1024; // 1 kiB
Pair<String, String> connectorPair = new Pair<String, String>(server1tc.getName(), null);
@@ -139,8 +139,8 @@
AddressSettings addressSettings = new AddressSettings();
addressSettings.setRedeliveryDelay(0);
- addressSettings.setMaxSizeBytes(1048576);
- addressSettings.setPageSizeBytes(104857);
+ addressSettings.setMaxSizeBytes(10485760); // 1 MiB
+ addressSettings.setPageSizeBytes(1048576); // 100 kiB
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
server0.getConfiguration().getAddressesSettings().put("#", addressSettings);
@@ -159,6 +159,7 @@
ClientSession session0 = csf0.createSession(false, true, true);
ClientSessionFactory csf1 = HornetQClient.createClientSessionFactory(server1tc);
+ //csf1.setAckBatchSize(20480); // 20 kiB
ClientSession session1 = csf1.createSession(false, true, true);
ClientProducer prod0 = session0.createProducer(testAddress);
@@ -185,7 +186,7 @@
};
t.start();
- final int numMessages = 500;
+ final int numMessages = 5000;
SimpleString propKey = new SimpleString("propkey");
@@ -194,6 +195,7 @@
ClientMessage message = session0.createMessage(false);
message.putIntProperty(propKey, i);
message.getBodyBuffer().writeBytes(content);
+ //message.setPriority((byte)3);
prod0.send(message);
System.out.println(">>>> " + i);
}
Added: trunk/tests/src/org/hornetq/tests/integration/management/ManagementWithStompTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ManagementWithStompTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ManagementWithStompTest.java 2010-06-24 12:40:30 UTC (rev 9359)
@@ -0,0 +1,264 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.hornetq.tests.integration.management;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.hornetq.api.core.SimpleString;
+import org.hornetq.api.core.TransportConfiguration;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.management.QueueControl;
+import org.hornetq.api.core.management.ResourceNames;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.protocol.stomp.Stomp;
+import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory;
+import org.hornetq.core.remoting.impl.netty.TransportConstants;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.HornetQServers;
+import org.hornetq.spi.core.protocol.ProtocolType;
+import org.hornetq.tests.util.RandomUtil;
+
+/**
+ * A ManagementWithStompTest
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ManagementWithStompTest extends ManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ protected HornetQServer server;
+
+ protected ClientSession session;
+
+ private Socket stompSocket;
+
+ private ByteArrayOutputStream inputBuffer;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+
+ public void testGetManagementAttributeFromStomp() throws Exception
+ {
+ SimpleString address = RandomUtil.randomSimpleString();
+ SimpleString queue = RandomUtil.randomSimpleString();
+
+ session.createQueue(address, queue, null, false);
+
+ String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;
+ sendFrame(frame);
+
+ frame = receiveFrame(10000);
+ Assert.assertTrue(frame.startsWith("CONNECTED"));
+
+ frame = "SUBSCRIBE\n" + "destination:" + queue + "\n\n" + Stomp.NULL;
+ sendFrame(frame);
+
+ // retrieve the address of the queue
+ frame = "\nSEND\n" + "destination:" + ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS + "\n" +
+ "reply-to:" + address + "\n" +
+ "_HQ_ResourceName:" + ResourceNames.CORE_QUEUE + queue + "\n" +
+ "_HQ_Attribute: Address\n\n" +
+ Stomp.NULL;
+ sendFrame(frame);
+
+ frame = receiveFrame(10000);
+ System.out.println(frame);
+ assertTrue(frame.contains("_HQ_OperationSucceeded:true"));
+ // the address will be returned in the message body in a JSON array
+ Assert.assertTrue(frame.contains("[\"" + address + "\"]"));
+
+ frame = "UNSUBSCRIBE\n" + "destination:" + queue + "\n" +
+ "receipt: 123\n\n" +
+ Stomp.NULL;
+ sendFrame(frame);
+ waitForReceipt();
+
+ String disconnectFrame = "DISCONNECT\n\n" + Stomp.NULL;
+ sendFrame(disconnectFrame);
+
+ session.deleteQueue(queue);
+ }
+
+ public void testInvokeOperationFromStomp() throws Exception
+ {
+ SimpleString address = RandomUtil.randomSimpleString();
+ SimpleString queue = RandomUtil.randomSimpleString();
+
+ session.createQueue(address, queue, null, false);
+
+ String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;
+ sendFrame(frame);
+
+ frame = receiveFrame(10000);
+ Assert.assertTrue(frame.startsWith("CONNECTED"));
+
+ frame = "SUBSCRIBE\n" + "destination:" + queue + "\n\n" + Stomp.NULL;
+ sendFrame(frame);
+
+ // count number of message with filter "color = 'blue'"
+ frame = "\nSEND\n" + "destination:" + ConfigurationImpl.DEFAULT_MANAGEMENT_ADDRESS + "\n" +
+ "reply-to:" + address + "\n" +
+ "_HQ_ResourceName:" + ResourceNames.CORE_QUEUE + queue + "\n" +
+ "_HQ_OperationName: countMessages\n\n" +
+ "[\"color = 'blue'\"]" +
+ Stomp.NULL;
+ sendFrame(frame);
+
+ frame = receiveFrame(10000);
+ System.out.println(frame);
+ assertTrue(frame.contains("_HQ_OperationSucceeded:true"));
+ // there is no such messages => 0 returned in a JSON array
+ assertTrue(frame.contains("[0]"));
+
+ frame = "UNSUBSCRIBE\n" + "destination:" + queue + "\n" +
+ "receipt: 123\n\n" +
+ Stomp.NULL;
+ sendFrame(frame);
+ waitForReceipt();
+
+ String disconnectFrame = "DISCONNECT\n\n" + Stomp.NULL;
+ sendFrame(disconnectFrame);
+
+ session.deleteQueue(queue);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put(TransportConstants.PROTOCOL_PROP_NAME, ProtocolType.STOMP.toString());
+ params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT);
+ TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params);
+ conf.getAcceptorConfigurations().add(stompTransport);
+ conf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ server = HornetQServers.newHornetQServer(conf, mbeanServer, false);
+ server.start();
+
+ ClientSessionFactory sf = HornetQClient.createClientSessionFactory(new TransportConfiguration(InVMConnectorFactory.class.getName()));
+ sf.setBlockOnNonDurableSend(true);
+ sf.setBlockOnNonDurableSend(true);
+ session = sf.createSession(false, true, false);
+ session.start();
+
+ stompSocket = new Socket("127.0.0.1", TransportConstants.DEFAULT_STOMP_PORT);
+ inputBuffer = new ByteArrayOutputStream();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ session.close();
+
+ server.stop();
+
+ session = null;
+
+ server = null;
+
+ super.tearDown();
+ }
+
+ protected QueueControl createManagementControl(final SimpleString address, final SimpleString queue) throws Exception
+ {
+ QueueControl queueControl = ManagementControlHelper.createQueueControl(address, queue, mbeanServer);
+
+ return queueControl;
+ }
+
+ // Private -------------------------------------------------------
+
+ public void sendFrame(String data) throws Exception
+ {
+ byte[] bytes = data.getBytes("UTF-8");
+ OutputStream outputStream = stompSocket.getOutputStream();
+ for (int i = 0; i < bytes.length; i++)
+ {
+ outputStream.write(bytes[i]);
+ }
+ outputStream.flush();
+ }
+
+ public String receiveFrame(long timeOut) throws Exception
+ {
+ stompSocket.setSoTimeout((int)timeOut);
+ InputStream is = stompSocket.getInputStream();
+ int c = 0;
+ for (;;)
+ {
+ c = is.read();
+ if (c < 0)
+ {
+ throw new IOException("socket closed.");
+ }
+ else if (c == 0)
+ {
+ c = is.read();
+ if (c != '\n')
+ {
+ byte[] ba = inputBuffer.toByteArray();
+ System.out.println(new String(ba, "UTF-8"));
+ }
+ Assert.assertEquals("Expecting stomp frame to terminate with \0\n", c, '\n');
+ byte[] ba = inputBuffer.toByteArray();
+ inputBuffer.reset();
+ return new String(ba, "UTF-8");
+ }
+ else
+ {
+ inputBuffer.write(c);
+ }
+ }
+ }
+
+ protected void waitForReceipt() throws Exception
+ {
+ String frame = receiveFrame(50000);
+ assertNotNull(frame);
+ assertTrue(frame.indexOf("RECEIPT") > -1);
+ }
+
+ // Inner classes -------------------------------------------------
+
+}
13 years, 10 months
JBoss hornetq SVN: r9358 - trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-06-23 23:39:11 -0400 (Wed, 23 Jun 2010)
New Revision: 9358
Modified:
trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java
Log:
disabling test
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java 2010-06-23 17:07:46 UTC (rev 9357)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/selector/SelectorTest.java 2010-06-24 03:39:11 UTC (rev 9358)
@@ -939,7 +939,8 @@
// Test case proposed by a customer on this user forum:
// http://community.jboss.org/thread/153426?tstart=0
- public void testMultipleConsumers() throws Exception
+ // This test needs to be moved away
+ public void disabled_testMultipleConsumers() throws Exception
{
Connection conn = null;
13 years, 10 months
JBoss hornetq SVN: r9357 - trunk/native/src.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2010-06-23 13:07:46 -0400 (Wed, 23 Jun 2010)
New Revision: 9357
Modified:
trunk/native/src/disktest.cpp
Log:
tweak
Modified: trunk/native/src/disktest.cpp
===================================================================
--- trunk/native/src/disktest.cpp 2010-06-23 16:22:04 UTC (rev 9356)
+++ trunk/native/src/disktest.cpp 2010-06-23 17:07:46 UTC (rev 9357)
@@ -220,11 +220,11 @@
}
long endAIO = getTime();
+
+ fprintf (stderr, "Total time to write file = %ld milliseconds, Bytes/millisecond = %ld, Writes/Syncs per millisecond = %f \n", (endAIO - startAIO), (fileSize / (endAIO - startAIO)), ((double)writes / ((double)endAIO - (double)startAIO)));
- fprintf (stderr, "Total time to write file = %ld milliseconds, Bytes/millisecond = %ld, Writes/Syncs per millisecond = %ld \n", (endAIO - startAIO), (fileSize / (endAIO - startAIO)), (writes / (endAIO - startAIO)));
-
free (events);
io_queue_release(aioContext);
13 years, 10 months