JBoss hornetq SVN: r7873 - trunk.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-08-21 11:55:28 -0400 (Fri, 21 Aug 2009)
New Revision: 7873
Modified:
trunk/.classpath
Log:
reverting variable on .classpath.. it doesn't work
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2009-08-21 15:36:54 UTC (rev 7872)
+++ trunk/.classpath 2009-08-21 15:55:28 UTC (rev 7873)
@@ -7,7 +7,7 @@
<classpathentry kind="src" path="tests/config"/>
<classpathentry excluding="**/.svn/**/*" kind="src" path="tests/src">
<attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="${project_name}/native/bin"/>
+ <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="hornet/native/bin"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="tests/jms-tests/src"/>
15 years, 6 months
JBoss hornetq SVN: r7872 - trunk.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-08-21 11:36:54 -0400 (Fri, 21 Aug 2009)
New Revision: 7872
Modified:
trunk/.classpath
Log:
using a variable for the project name
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2009-08-21 15:15:32 UTC (rev 7871)
+++ trunk/.classpath 2009-08-21 15:36:54 UTC (rev 7872)
@@ -7,7 +7,7 @@
<classpathentry kind="src" path="tests/config"/>
<classpathentry excluding="**/.svn/**/*" kind="src" path="tests/src">
<attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="hornet/native/bin"/>
+ <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="${project_name}/native/bin"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="tests/jms-tests/src"/>
15 years, 6 months
JBoss hornetq SVN: r7871 - trunk/src/main/org/hornetq/core/transaction/impl.
by do-not-reply@jboss.org
Author: ataylor
Date: 2009-08-21 11:15:32 -0400 (Fri, 21 Aug 2009)
New Revision: 7871
Modified:
trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
Log:
removed tx timeout - see https://jira.jboss.org/jira/browse/HORNETQ-106
Modified: trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java 2009-08-21 15:15:06 UTC (rev 7870)
+++ trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java 2009-08-21 15:15:32 UTC (rev 7871)
@@ -50,11 +50,11 @@
private boolean started = false;
- private TxTimeoutHandler task;
+ //private TxTimeoutHandler task;
private final long txTimeoutScanPeriod;
- private final ScheduledExecutorService scheduledThreadPool;
+ //private final ScheduledExecutorService scheduledThreadPool;
public ResourceManagerImpl(final int defaultTimeoutSeconds,
final long txTimeoutScanPeriod,
@@ -63,7 +63,7 @@
this.defaultTimeoutSeconds = defaultTimeoutSeconds;
this.timeoutSeconds = defaultTimeoutSeconds;
this.txTimeoutScanPeriod = txTimeoutScanPeriod;
- this.scheduledThreadPool = scheduledThreadPool;
+ // this.scheduledThreadPool = scheduledThreadPool;
}
// HornetQComponent implementation
@@ -74,10 +74,10 @@
{
return;
}
-
- task = new TxTimeoutHandler();
+ //todo - https://jira.jboss.org/jira/browse/HORNETQ-106
+ /*task = new TxTimeoutHandler();
Future<?> future = scheduledThreadPool.scheduleAtFixedRate(task, txTimeoutScanPeriod, txTimeoutScanPeriod, TimeUnit.MILLISECONDS);
- task.setFuture(future);
+ task.setFuture(future);*/
started = true;
}
@@ -88,10 +88,10 @@
{
return;
}
- if (task != null)
+ /*if (task != null)
{
task.close();
- }
+ }*/
started = false;
}
15 years, 6 months
JBoss hornetq SVN: r7870 - trunk/examples/javaee/ejb-jms-transaction.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-08-21 11:15:06 -0400 (Fri, 21 Aug 2009)
New Revision: 7870
Modified:
trunk/examples/javaee/ejb-jms-transaction/readme.html
Log:
added footnote with instructions to setup MySQL for this example
Modified: trunk/examples/javaee/ejb-jms-transaction/readme.html
===================================================================
--- trunk/examples/javaee/ejb-jms-transaction/readme.html 2009-08-21 14:46:07 UTC (rev 7869)
+++ trunk/examples/javaee/ejb-jms-transaction/readme.html 2009-08-21 15:15:06 UTC (rev 7870)
@@ -39,7 +39,7 @@
<li>copy <a href="config/mysql-ds.xml"><code>mysql-ds.xml</a></code> to to the profile</li>
</ul>
- <p>MySQL is configured to connect to a <code>jbossdb</code> database using the <code>jboss</code>/<code>jboss</code> credentials
+ <p>MySQL is configured to connect to a <code>jbossdb</code> database using the <code>jboss</code>/<code>jboss</code> credentials<a href="#fn1" id="fnr1"><sup>1</sup></a>.
<p>MySQL configuration file defines two DataSources:</p>
<ul>
<li><code>DefaultDS</code>, the default DataSource (used to create a table from the example)</li>
@@ -224,5 +224,18 @@
<li><a href="http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Ad...">Use Alternative Databases with JBoss AS</a></li>
</ul>
+ <hr>
+
+ <ol>
+ <li><a name="fn1">Steps to create the MySQL DB</a><a href="#fnr1">↩</a>
+ <ul>
+ <li>connect as root to MySQL: <code>mysql</code>
+ <li>create database jbossdb: <code>create database jbossdb;</code>
+ <li>create user jboss/jboss: <code>GRANT ALL PRIVILEGES ON *.* TO 'jboss'@'%' IDENTIFIED BY 'jboss' WITH GRANT OPTION;</code>
+ <li>disconnect from MySQL
+ <li>check it works: <code>mysql -u jboss -p jbossdb</code> (and type <code>jboss</code> when prompted for the password)
+ </ul>
+ </li>
+ </ol>
</body>
</html>
\ No newline at end of file
15 years, 6 months
JBoss hornetq SVN: r7869 - in trunk: examples/javaee and 1 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-08-21 10:46:07 -0400 (Fri, 21 Aug 2009)
New Revision: 7869
Added:
trunk/examples/javaee/servlet-ssl/
trunk/examples/javaee/servlet-ssl/build.xml
trunk/examples/javaee/servlet-ssl/src/
Removed:
trunk/examples/javaee/servlet-ssl-example/
trunk/examples/javaee/servlet-ssl/build.xml
trunk/examples/javaee/servlet-ssl/src/
Modified:
trunk/.classpath
Log:
renamed servlet-ssl-example to servlet-ssl
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2009-08-21 14:39:37 UTC (rev 7868)
+++ trunk/.classpath 2009-08-21 14:46:07 UTC (rev 7869)
@@ -83,7 +83,7 @@
<classpathentry kind="src" path="examples/javaee/mdb-cmt-tx-local/src"/>
<classpathentry kind="src" path="examples/javaee/mdb-cmt-tx-not-supported/src"/>
<classpathentry kind="src" path="examples/javaee/mdb-cmt-tx-required/src"/>
- <classpathentry kind="src" path="examples/javaee/servlet-ssl-example/src"/>
+ <classpathentry kind="src" path="examples/javaee/servlet-ssl/src"/>
<classpathentry kind="src" path="examples/javaee/servlet-transport/src"/>
<classpathentry kind="src" path="examples/javaee/xarecovery/src"/>
<classpathentry kind="src" path="examples/soak/normal/src"/>
Copied: trunk/examples/javaee/servlet-ssl (from rev 7868, trunk/examples/javaee/servlet-ssl-example)
Deleted: trunk/examples/javaee/servlet-ssl/build.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/build.xml 2009-08-21 14:39:37 UTC (rev 7868)
+++ trunk/examples/javaee/servlet-ssl/build.xml 2009-08-21 14:46:07 UTC (rev 7869)
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project default="run" name="HornetQ Servlet Transport Example">
-
- <import file="../common/build.xml"/>
-
- <target name="copy-resources">
- <path id="keystore.location" location="${example.server.dir}/hornetq.example.keystore"/>
- <property name="keystore.loc" refid="keystore.location"/>
- <copy toFile="${jboss.home}/server/${example.name}-example-profile/deploy/jbossweb.sar/server.xml"
- file="${example.server.dir}/server.xml" overwrite="true">
- <filterset>
- <filter token="KEYSTORE" value="${keystore.loc}"/>
- </filterset>
- </copy>
- </target>
- <target name="run">
- <antcall target="runExample">
- <param name="example.classname" value="org.hornetq.javaee.example.ServletSSLTransportExample"/>
- </antcall>
- </target>
-
-</project>
Copied: trunk/examples/javaee/servlet-ssl/build.xml (from rev 7867, trunk/examples/javaee/servlet-ssl-example/build.xml)
===================================================================
--- trunk/examples/javaee/servlet-ssl/build.xml (rev 0)
+++ trunk/examples/javaee/servlet-ssl/build.xml 2009-08-21 14:46:07 UTC (rev 7869)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project default="run" name="HornetQ Servlet Transport Example">
+
+ <import file="../common/build.xml"/>
+
+ <target name="copy-resources">
+ <path id="keystore.location" location="${example.server.dir}/hornetq.example.keystore"/>
+ <property name="keystore.loc" refid="keystore.location"/>
+ <copy toFile="${jboss.home}/server/${example.name}-example-profile/deploy/jbossweb.sar/server.xml"
+ file="${example.server.dir}/server.xml" overwrite="true">
+ <filterset>
+ <filter token="KEYSTORE" value="${keystore.loc}"/>
+ </filterset>
+ </copy>
+ </target>
+ <target name="run">
+ <antcall target="runExample">
+ <param name="example.classname" value="org.hornetq.javaee.example.ServletSSLTransportExample"/>
+ </antcall>
+ </target>
+
+</project>
Copied: trunk/examples/javaee/servlet-ssl/src (from rev 7867, trunk/examples/javaee/servlet-ssl-example/src)
15 years, 6 months
JBoss hornetq SVN: r7868 - in trunk/examples/javaee/servlet-ssl-example: config/META-INF and 1 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-08-21 10:39:37 -0400 (Fri, 21 Aug 2009)
New Revision: 7868
Modified:
trunk/examples/javaee/servlet-ssl-example/
trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml
trunk/examples/javaee/servlet-ssl-example/readme.html
trunk/examples/javaee/servlet-ssl-example/server/hornetq-configuration.xml
trunk/examples/javaee/servlet-ssl-example/server/hornetq.example.keystore
trunk/examples/javaee/servlet-ssl-example/server/hornetq.example.truststore
Log:
fixed java ee's servlet-ssl example
Property changes on: trunk/examples/javaee/servlet-ssl-example
___________________________________________________________________
Name: svn:ignore
+ build
Modified: trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml 2009-08-21 13:30:28 UTC (rev 7867)
+++ trunk/examples/javaee/servlet-ssl-example/config/META-INF/application.xml 2009-08-21 14:39:37 UTC (rev 7868)
@@ -4,7 +4,7 @@
<module>
<web>
<web-uri>servlet-ssl-transport-example.war</web-uri>
- <context-root>/messaging</context-root>
+ <context-root>/hornetq</context-root>
</web>
</module>
Modified: trunk/examples/javaee/servlet-ssl-example/readme.html
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/readme.html 2009-08-21 13:30:28 UTC (rev 7867)
+++ trunk/examples/javaee/servlet-ssl-example/readme.html 2009-08-21 14:39:37 UTC (rev 7868)
@@ -1,10 +1,10 @@
<html>
<head>
- <title>HornetQ Java EE Servlet SSL Example</title>
+ <title>HornetQ Java EE SSL Servlet Example</title>
<link rel="stylesheet" type="text/css" href="../../common/common.css">
</head>
<body>
- <h1>Java EE Servlet SSL Example</h1>
+ <h1>Java EE SSL Servlet Example</h1>
<br>
<p>This example shows you how to configure and use servlet transport over SSL with HornetQ.</p>
@@ -12,10 +12,15 @@
<p>Please refer to HornetQ Quickstart guide to <a href="../../../docs/quickstart-guide/en/html_single/index.html#installation.jboss">install it in JBoss AS 5<a></p>
- <h2>Example configuration</h2>
-
+ <!-- Commands to generate the stores:
+ * create the keystore:
+ keytool -genkey -keystore hornetq.example.keystore -storepass hornetqexample
+ * export the certificate:
+ keytool -export -keystore hornetq.example.keystore -file hornetq.cer
+ * create the truststore:
+ keytool -import -file hornetq.cer -keystore hornetq.example.truststore -storepass hornetqexample
+ -->
-
<h2>Example step-by-step</h2>
<p><em>To deploy and start the server, type <code>ant deploy</code>from the example directory</br >
Once the server has started type <code>ant run</code> to run the example.<br />
Modified: trunk/examples/javaee/servlet-ssl-example/server/hornetq-configuration.xml
===================================================================
--- trunk/examples/javaee/servlet-ssl-example/server/hornetq-configuration.xml 2009-08-21 13:30:28 UTC (rev 7867)
+++ trunk/examples/javaee/servlet-ssl-example/server/hornetq-configuration.xml 2009-08-21 14:39:37 UTC (rev 7868)
@@ -17,7 +17,7 @@
<param key="hornetq.remoting.netty.host" value="localhost" type="String"/>
<param key="hornetq.remoting.netty.port" value="8443" type="Integer"/>
<param key="hornetq.remoting.netty.useservlet" value="true" type="Boolean"/>
- <param key="hornetq.remoting.netty.servletpath" value="/messaging/HornetQServlet" type="String"/>
+ <param key="hornetq.remoting.netty.servletpath" value="/hornetq/HornetQServlet" type="String"/>
<param key="hornetq.remoting.netty.sslenabled" value="true" type="Boolean"/>
<param key="hornetq.remoting.netty.keystorepath" value="server/hornetq.example.keystore" type="String"/>
<param key="hornetq.remoting.netty.keystorepassword" value="hornetqexample" type="String"/>
Modified: trunk/examples/javaee/servlet-ssl-example/server/hornetq.example.keystore
===================================================================
(Binary files differ)
Modified: trunk/examples/javaee/servlet-ssl-example/server/hornetq.example.truststore
===================================================================
(Binary files differ)
15 years, 6 months
JBoss hornetq SVN: r7867 - in trunk/examples: core/embedded-remote and 5 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-08-21 09:30:28 -0400 (Fri, 21 Aug 2009)
New Revision: 7867
Modified:
trunk/examples/core/embedded-remote/build.xml
trunk/examples/core/embedded/build.xml
trunk/examples/core/microcontainer/build.xml
trunk/examples/jms/expiry/src/org/hornetq/jms/example/ExpiryExample.java
trunk/examples/jms/ssl-enabled/readme.html
trunk/examples/jms/ssl-enabled/server0/hornetq.example.keystore
trunk/examples/jms/ssl-enabled/server0/hornetq.example.truststore
trunk/examples/jms/temp-queue/src/org/hornetq/jms/example/TemporaryQueueExample.java
Log:
fixed examples
Modified: trunk/examples/core/embedded/build.xml
===================================================================
--- trunk/examples/core/embedded/build.xml 2009-08-21 13:25:26 UTC (rev 7866)
+++ trunk/examples/core/embedded/build.xml 2009-08-21 13:30:28 UTC (rev 7867)
@@ -29,7 +29,7 @@
<target name="run" depends="compile">
- <java classname="org.hornetq.jms.example.EmbeddedExample" fork="true" resultproperty="example-result">
+ <java classname="org.hornetq.core.example.EmbeddedExample" fork="true" resultproperty="example-result">
<jvmarg value="-Xms50M"/>
<jvmarg value="-Xmx50M"/>
<classpath refid="local.classpath"/>
Modified: trunk/examples/core/embedded-remote/build.xml
===================================================================
--- trunk/examples/core/embedded-remote/build.xml 2009-08-21 13:25:26 UTC (rev 7866)
+++ trunk/examples/core/embedded-remote/build.xml 2009-08-21 13:30:28 UTC (rev 7867)
@@ -38,7 +38,7 @@
<echo message="client path = ${client-classpath}"/>
<echo message="remote path = ${remote-classpath}"/>
- <java classname="org.hornetq.jms.example.EmbeddedRemoteExample" fork="true" resultproperty="example-result">
+ <java classname="org.hornetq.core.example.EmbeddedRemoteExample" fork="true" resultproperty="example-result">
<jvmarg value="-Xms50M"/>
<jvmarg value="-Xmx50M"/>
<sysproperty key="remote-classpath" value="${remote-classpath}"/>
Modified: trunk/examples/core/microcontainer/build.xml
===================================================================
--- trunk/examples/core/microcontainer/build.xml 2009-08-21 13:25:26 UTC (rev 7866)
+++ trunk/examples/core/microcontainer/build.xml 2009-08-21 13:30:28 UTC (rev 7867)
@@ -45,7 +45,7 @@
</path>
<target name="run" depends="compile">
- <java classname="org.hornetq.jms.example.EmbeddedMicroContainerExample" fork="true"
+ <java classname="org.hornetq.core.example.EmbeddedMicroContainerExample" fork="true"
resultproperty="example-result">
<jvmarg value="-Xms50M"/>
<jvmarg value="-Xmx50M"/>
Modified: trunk/examples/jms/expiry/src/org/hornetq/jms/example/ExpiryExample.java
===================================================================
--- trunk/examples/jms/expiry/src/org/hornetq/jms/example/ExpiryExample.java 2009-08-21 13:25:26 UTC (rev 7866)
+++ trunk/examples/jms/expiry/src/org/hornetq/jms/example/ExpiryExample.java 2009-08-21 13:30:28 UTC (rev 7867)
@@ -109,10 +109,10 @@
System.out.println("Expiration time of the expired message (relative to the expiry queue): " + messageReceived.getJMSExpiration());
System.out.println();
- // Step 20. the *origin* destination is stored in the _HORNETQ_ORIG_DESTINATION property
- System.out.println("*Origin destination* of the expired message: " + messageReceived.getStringProperty("_HORNETQ_ORIG_DESTINATION"));
- // Step 21. the actual expiration time is stored in the _HORNETQ_ORIG_DESTINATION property
- System.out.println("*Actual expiration time* of the expired message: " + messageReceived.getLongProperty("_HORNETQ_ACTUAL_EXPIRY"));
+ // Step 20. the *origin* destination is stored in the _HQ_ORIG_DESTINATION property
+ System.out.println("*Origin destination* of the expired message: " + messageReceived.getStringProperty("_HQ_ORIG_DESTINATION"));
+ // Step 21. the actual expiration time is stored in the _HQ_ORIG_DESTINATION property
+ System.out.println("*Actual expiration time* of the expired message: " + messageReceived.getLongProperty("_HQ_ACTUAL_EXPIRY"));
return true;
}
Modified: trunk/examples/jms/ssl-enabled/readme.html
===================================================================
--- trunk/examples/jms/ssl-enabled/readme.html 2009-08-21 13:25:26 UTC (rev 7866)
+++ trunk/examples/jms/ssl-enabled/readme.html 2009-08-21 13:30:28 UTC (rev 7867)
@@ -44,6 +44,16 @@
<p>In the configuration, the hornetq.example.keystore is the key store file holding client certificate. The hornetq.example.truststore
is the file for server to hold trusted client certificates. They are pre-generated for illustration purpose.</p>
+
+ <!-- Commands to generate the stores:
+ * create the keystore:
+ keytool -genkey -keystore hornetq.example.keystore -storepass hornetqexample
+ * export the certificate:
+ keytool -export -keystore hornetq.example.keystore -file hornetq.cer
+ * create the truststore:
+ keytool -import -file hornetq.cer -keystore hornetq.example.truststore -storepass hornetqexample
+ -->
+
<br>
<h2>Example step-by-step</h2>
<p><i>To run the example, simply type <code>ant</code> from this directory</i></p>
Modified: trunk/examples/jms/ssl-enabled/server0/hornetq.example.keystore
===================================================================
(Binary files differ)
Modified: trunk/examples/jms/ssl-enabled/server0/hornetq.example.truststore
===================================================================
(Binary files differ)
Modified: trunk/examples/jms/temp-queue/src/org/hornetq/jms/example/TemporaryQueueExample.java
===================================================================
--- trunk/examples/jms/temp-queue/src/org/hornetq/jms/example/TemporaryQueueExample.java 2009-08-21 13:25:26 UTC (rev 7866)
+++ trunk/examples/jms/temp-queue/src/org/hornetq/jms/example/TemporaryQueueExample.java 2009-08-21 13:30:28 UTC (rev 7867)
@@ -14,7 +14,7 @@
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
-import javax.jms.InvalidDestinationException;
+import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
@@ -108,7 +108,7 @@
messageConsumer = session.createConsumer(tempQueue2);
throw new Exception("Temporary queue cannot be accessed outside its lifecycle!");
}
- catch (InvalidDestinationException e)
+ catch (JMSException e)
{
System.out.println("Exception got when trying to access a temp queue outside its scope: " + e);
}
15 years, 6 months
JBoss hornetq SVN: r7866 - in trunk/examples/javaee/mdb-tx-send/src/org: hornetq and 3 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2009-08-21 09:25:26 -0400 (Fri, 21 Aug 2009)
New Revision: 7866
Added:
trunk/examples/javaee/mdb-tx-send/src/org/hornetq/
trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/
trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/
trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/MDBMessageSendTxClientExample.java
trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/server/
trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/server/MDBMessageSendTxExample.java
Log:
readded mdb tx send example
Added: trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/MDBMessageSendTxClientExample.java
===================================================================
--- trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/MDBMessageSendTxClientExample.java (rev 0)
+++ trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/MDBMessageSendTxClientExample.java 2009-08-21 13:25:26 UTC (rev 7866)
@@ -0,0 +1,89 @@
+/*
+ * 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.javaee.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class MDBMessageSendTxClientExample
+{
+ public static void main(String[] args) throws Exception
+ {
+ Connection connection = null;
+ InitialContext initialContext = null;
+ try
+ {
+ //Step 1. Create an initial context to perform the JNDI lookup.
+ initialContext = new InitialContext();
+
+ //Step 2. Perfom a lookup on the queue
+ Queue queue = (Queue) initialContext.lookup("/queue/testQueue");
+
+ //Step 3. Perform a lookup on the Connection Factory
+ ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
+
+ //Step 4.Create a JMS Connection
+ connection = cf.createConnection();
+
+ //Step 5. Create a JMS Session
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //Step 6. Create a JMS Message Producer
+ MessageProducer producer = session.createProducer(queue);
+
+ //Step 7. Create a Text Message
+ TextMessage message = session.createTextMessage("This is a text message");
+
+ System.out.println("Sent message: " + message.getText());
+
+ //Step 8. Send the Message
+ producer.send(message);
+
+ //Step 15. We lookup the reply queue
+ queue = (Queue) initialContext.lookup("/queue/replyQueue");
+
+ //Step 16. We create a JMS message consumer
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+
+ //Step 17. We start the connedction so we can receive messages
+ connection.start();
+
+ //Step 18. We receive the message and print it out
+ message = (TextMessage) messageConsumer.receive(5000);
+
+ System.out.println("message.getText() = " + message.getText());
+
+ }
+ finally
+ {
+ //Step 19. Be sure to close our JMS resources!
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
+ if(connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/server/MDBMessageSendTxExample.java
===================================================================
--- trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/server/MDBMessageSendTxExample.java (rev 0)
+++ trunk/examples/javaee/mdb-tx-send/src/org/hornetq/javaee/example/server/MDBMessageSendTxExample.java 2009-08-21 13:25:26 UTC (rev 7866)
@@ -0,0 +1,95 @@
+/*
+ * 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.javaee.example.server;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+@MessageDriven(name = "MDBMessageSendTxExample",
+ activationConfig =
+ {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
+ })
+@TransactionManagement(value= TransactionManagementType.CONTAINER)
+@TransactionAttribute(value= TransactionAttributeType.REQUIRED)
+public class MDBMessageSendTxExample implements MessageListener
+{
+ @Resource(mappedName = "java:JmsXA")
+ ConnectionFactory connectionFactory;
+
+ @Resource(mappedName = "queue/replyQueue")
+ Queue replyQueue;
+
+ public void onMessage(Message message)
+ {
+ Connection conn = null;
+ try
+ {
+ //Step 9. We know the client is sending a text message so we cast
+ TextMessage textMessage = (TextMessage)message;
+
+ //Step 10. get the text from the message.
+ String text = textMessage.getText();
+
+ System.out.println("message " + text);
+
+ //Step 11. we create a JMS connection
+ conn = connectionFactory.createConnection();
+
+ //Step 12. We create a JMS session
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //Step 13. we create a producer for the reply queue
+ MessageProducer producer = sess.createProducer(replyQueue);
+
+ //Step 14. we create a message and send it
+ producer.send(sess.createTextMessage("this is a reply"));
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if(conn != null)
+ {
+ try
+ {
+ conn.close();
+ }
+ catch (JMSException e)
+ {
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
15 years, 6 months
JBoss hornetq SVN: r7865 - in trunk: examples/javaee/mdb-message-selector/src/org and 4 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2009-08-21 09:17:08 -0400 (Fri, 21 Aug 2009)
New Revision: 7865
Added:
trunk/examples/javaee/mdb-message-selector/src/org/hornetq/
trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/
trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/
trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/MDBMessageSelectorClientExample.java
trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/server/
trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/server/MDBMessageSelectorExample.java
Modified:
trunk/hornetq.ipr
Log:
readded mdb selector example
Added: trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/MDBMessageSelectorClientExample.java
===================================================================
--- trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/MDBMessageSelectorClientExample.java (rev 0)
+++ trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/MDBMessageSelectorClientExample.java 2009-08-21 13:17:08 UTC (rev 7865)
@@ -0,0 +1,86 @@
+/*
+ * 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.javaee.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+public class MDBMessageSelectorClientExample
+{
+ public static void main(String[] args) throws Exception
+ {
+ Connection connection = null;
+ InitialContext initialContext = null;
+ try
+ {
+ //Step 1. Create an initial context to perform the JNDI lookup.
+ initialContext = new InitialContext();
+
+ //Step 2. Perfom a lookup on the queue
+ Queue queue = (Queue) initialContext.lookup("/queue/testQueue");
+
+ //Step 3. Perform a lookup on the Connection Factory
+ ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/ConnectionFactory");
+
+ //Step 4.Create a JMS Connection
+ connection = cf.createConnection();
+
+ //Step 5. Create a JMS Session
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //Step 6. Create a JMS Message Producer
+ MessageProducer producer = session.createProducer(queue);
+
+ //Step 7. Create a Text Message and set the color property to blue
+ TextMessage blueMessage = session.createTextMessage("This is a text message");
+
+ blueMessage.setStringProperty("color", "BLUE");
+
+ System.out.println("Sent message: " + blueMessage.getText() + " color=BLUE");
+
+ //Step 8. Send the Message
+ producer.send(blueMessage);
+
+ //Step 9. create another message and set the color property to red
+ TextMessage redMessage = session.createTextMessage("This is a text message");
+
+ redMessage.setStringProperty("color", "RED");
+
+ System.out.println("Sent message: " + redMessage.getText() + " color=RED");
+
+ //Step 10. Send the Message
+ producer.send(redMessage);
+ //Step 10,11 and 12 in MDBMessageSelectorExample
+ }
+ finally
+ {
+ //Step 13. Be sure to close our JMS resources!
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
+ if(connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/server/MDBMessageSelectorExample.java
===================================================================
--- trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/server/MDBMessageSelectorExample.java (rev 0)
+++ trunk/examples/javaee/mdb-message-selector/src/org/hornetq/javaee/example/server/MDBMessageSelectorExample.java 2009-08-21 13:17:08 UTC (rev 7865)
@@ -0,0 +1,60 @@
+/*
+ * 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.javaee.example.server;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.org">Andy Taylor</a>
+ */
+@MessageDriven(name = "MDBMessageSelectorExample",
+ activationConfig =
+ {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue"),
+ @ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "color = 'RED'")
+ })
+@TransactionManagement(value= TransactionManagementType.CONTAINER)
+@TransactionAttribute(value= TransactionAttributeType.REQUIRED)
+public class MDBMessageSelectorExample implements MessageListener
+{
+ public void onMessage(Message message)
+ {
+ try
+ {
+ //Step 11. We know the client is sending a text message so we cast
+ TextMessage textMessage = (TextMessage)message;
+
+ //Step 12. get the text from the message.
+ String text = textMessage.getText();
+
+ //Step 13. We check we received the right color of message
+ String color = textMessage.getStringProperty("color");
+
+ System.out.println("message " + text + " received color=" + color);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/hornetq.ipr
===================================================================
--- trunk/hornetq.ipr 2009-08-21 12:52:42 UTC (rev 7864)
+++ trunk/hornetq.ipr 2009-08-21 13:17:08 UTC (rev 7865)
@@ -287,7 +287,7 @@
</component>
<component name="CopyrightManager" default="">
<copyright>
- <option name="notice" value="Copyright (c) &#36;today.year. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. Vestibulum commodo. Ut rhoncus gravida arcu." />
+ <option name="notice" value="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." />
<option name="keyword" value="Copyright" />
<option name="myName" value="new" />
<option name="myLocal" value="true" />
15 years, 6 months
JBoss hornetq SVN: r7864 - in trunk/examples/javaee: jca-config and 8 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2009-08-21 08:52:42 -0400 (Fri, 21 Aug 2009)
New Revision: 7864
Added:
trunk/examples/javaee/jca-config/server2/hornetq-configuration.xml
trunk/examples/javaee/jca-config/src/org/hornetq/
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/MDBRemoteClientExample.java
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server/
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server/MDBQueueA.java
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/MDBQueueB.java
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSender.java
trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSenderService.java
Modified:
trunk/examples/javaee/common/build.xml
trunk/examples/javaee/jca-config/build.xml
trunk/examples/javaee/jca-config/server/hornetq-configuration.xml
Log:
readded jca-config example and build fix
Modified: trunk/examples/javaee/common/build.xml
===================================================================
--- trunk/examples/javaee/common/build.xml 2009-08-21 11:51:41 UTC (rev 7863)
+++ trunk/examples/javaee/common/build.xml 2009-08-21 12:52:42 UTC (rev 7864)
@@ -91,7 +91,7 @@
<target name="jar" depends="compile">
<jar destfile="${build.dir}/${example.name}-example.jar"
basedir="${classes.dir}"
- includes="org/jboss/javaee/example/server/**/*">
+ includes="org/hornetq/javaee/example/server/**/*">
</jar>
</target>
Modified: trunk/examples/javaee/jca-config/build.xml
===================================================================
--- trunk/examples/javaee/jca-config/build.xml 2009-08-21 11:51:41 UTC (rev 7863)
+++ trunk/examples/javaee/jca-config/build.xml 2009-08-21 12:52:42 UTC (rev 7864)
@@ -19,7 +19,7 @@
<target name="jar2" depends="compile">
<jar destfile="${build.dir}/jca-config-example2.jar"
basedir="${classes.dir}"
- includes="org/jboss/javaee/example/server2/**/*">
+ includes="org/hornetq/javaee/example/server2/**/*">
</jar>
</target>
<target name="ear2" depends="jar2">
@@ -42,9 +42,10 @@
<exclude name="**/tmp/**"/>
</fileset>
</copy>
- <copy todir="${deploy.dir2}/deploy/hornetq.sar">
+ <copy todir="${deploy.dir2}/deploy/hornetq.sar" overwrite="true">
<fileset dir="server2">
<include name="jms-remote-ds.xml"/>
+ <include name="hornetq-configuration.xml"/>
</fileset>
</copy>
<copy todir="${deploy.dir2}/deploy/jms-ra.rar/META-INF">
Modified: trunk/examples/javaee/jca-config/server/hornetq-configuration.xml
===================================================================
--- trunk/examples/javaee/jca-config/server/hornetq-configuration.xml 2009-08-21 11:51:41 UTC (rev 7863)
+++ trunk/examples/javaee/jca-config/server/hornetq-configuration.xml 2009-08-21 12:52:42 UTC (rev 7864)
@@ -33,7 +33,7 @@
<!-- Netty TCP Acceptor -->
<acceptor name="netty">
<factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
- <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port}" type="Integer"/>
+ <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5445}" type="Integer"/>
</acceptor>
</acceptors>
Copied: trunk/examples/javaee/jca-config/server2/hornetq-configuration.xml (from rev 7854, trunk/examples/javaee/jca-config/server/hornetq-configuration.xml)
===================================================================
--- trunk/examples/javaee/jca-config/server2/hornetq-configuration.xml (rev 0)
+++ trunk/examples/javaee/jca-config/server2/hornetq-configuration.xml 2009-08-21 12:52:42 UTC (rev 7864)
@@ -0,0 +1,56 @@
+<!--
+ ~ Copyright (c) 2009. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+ ~ Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
+ ~ Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
+ ~ Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
+ ~ Vestibulum commodo. Ut rhoncus gravida arcu.
+ -->
+
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+ <bindings-directory>${jboss.server.data.dir}/messaging/bindings</bindings-directory>
+
+ <journal-directory>${jboss.server.data.dir}/messaging/journal</journal-directory>
+
+ <large-messages-directory>${jboss.server.data.dir}/messaging/largemessages</large-messages-directory>
+
+ <paging-directory>${jboss.server.data.dir}/messaging/paging</paging-directory>
+
+ <!-- Connectors -->
+ <connectors>
+ <connector name="netty">
+ <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>
+ </connector>
+
+ <connector name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
+ </connector>
+
+ </connectors>
+
+ <!-- Acceptors -->
+ <acceptors>
+ <!-- In VM acceptor -->
+ <acceptor name="in-vm">
+ <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
+ <param key="hornetq.remoting.invm.serverid" value="0" type="Integer"/>
+ </acceptor>
+
+ <!-- Netty TCP Acceptor -->
+ <acceptor name="netty">
+ <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
+ <param key="hornetq.remoting.netty.port" value="${hornetq.remoting.netty.port:5446}" type="Integer"/>
+ </acceptor>
+ </acceptors>
+
+ <security-settings>
+ <security-setting match="jms.queue.#">
+ <permission type="consume" roles="guest,publisher"/>
+ <permission type="send" roles="guest,publisher"/>
+ </security-setting>
+ </security-settings>
+
+
+</configuration>
Added: trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/MDBRemoteClientExample.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/MDBRemoteClientExample.java (rev 0)
+++ trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/MDBRemoteClientExample.java 2009-08-21 12:52:42 UTC (rev 7864)
@@ -0,0 +1,60 @@
+/*
+ * 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.javaee.example;
+
+import org.hornetq.javaee.example.server2.StatelessSenderService;
+
+import javax.jms.Connection;
+import javax.naming.InitialContext;
+
+/**
+ *
+ * MDB Remote & JCA Configuration Example.
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ */
+public class MDBRemoteClientExample
+{
+ public static void main(String[] args) throws Exception
+ {
+ Connection connection = null;
+ InitialContext initialContext = null;
+ try
+ {
+ //Step 1. Create an initial context to perform the JNDI lookup.
+ initialContext = new InitialContext();
+
+ //Step 2. Getting a reference to the Stateless Bean
+ StatelessSenderService sender = (StatelessSenderService)initialContext.lookup("jca-config-example2/StatelessSender/remote");
+
+ //Step 3. Calling a Stateless Session Bean. You will have more steps on the SessionBean
+ sender.sendHello("Hello there MDB!");
+
+ System.out.println("Step 3: Invoking the Stateless Bean");
+
+ initialContext.close();
+ }
+ finally
+ {
+ //Step 11. Be sure to close our JMS resources!
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
+ if(connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+}
Added: trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server/MDBQueueA.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server/MDBQueueA.java (rev 0)
+++ trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server/MDBQueueA.java 2009-08-21 12:52:42 UTC (rev 7864)
@@ -0,0 +1,52 @@
+/*
+ * 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.javaee.example.server;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+/**
+ * MDB that is connected to the remote queue.
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ */
+
+//Step 9. The message is received on the MDB, using a local queue.
+@MessageDriven(name = "MDB_QueueA",
+ activationConfig =
+ {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/A"),
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
+ })
+public class MDBQueueA implements MessageListener
+{
+ public void onMessage(Message message)
+ {
+ try
+ {
+ TextMessage tm = (TextMessage)message;
+
+ String text = tm.getText();
+
+ System.out.println("Step 10: (MDBQueueA.java) Message received using the default adapter. Message = \"" + text + "\"" );
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/MDBQueueB.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/MDBQueueB.java (rev 0)
+++ trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/MDBQueueB.java 2009-08-21 12:52:42 UTC (rev 7864)
@@ -0,0 +1,52 @@
+/*
+ * 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.javaee.example.server2;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+
+/**
+ * MDB that is connected to the remote queue.
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ */
+
+//Step 10. The message is received on the MDB, using a remote queue.
+@MessageDriven(name = "MDB_QueueB",
+ activationConfig =
+ {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/B"),
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")
+ })
+public class MDBQueueB implements MessageListener
+{
+ public void onMessage(Message message)
+ {
+ try
+ {
+ TextMessage tm = (TextMessage)message;
+
+ String text = tm.getText();
+
+ System.out.println("Step 11: (MDBQueueB.java) Message received using the remote adapter. Message = \"" + text + "\"" );
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
Added: trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSender.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSender.java (rev 0)
+++ trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSender.java 2009-08-21 12:52:42 UTC (rev 7864)
@@ -0,0 +1,97 @@
+/*
+ * 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.javaee.example.server2;
+
+
+
+import org.hornetq.jms.HornetQQueue;
+
+import javax.annotation.Resource;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+/**
+ * A Stateless Bean that will connect to a remote JBM.
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+(a)Remote(StatelessSenderService.class)
+@Stateless
+public class StatelessSender implements StatelessSenderService
+{
+
+ /**
+ * Resource to be deployed by jms-remote-ds.xml
+ * */
+ @Resource(mappedName="java:RemoteJmsXA")
+ private ConnectionFactory connectionFactory;
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.javaee.example.server.StatelessSenderService#sendHello(java.lang.String)
+ */
+ public void sendHello(String message) throws Exception
+ {
+ // Step 4. Define the destinations that will receive the message (instead of using JNDI to the remote server)
+ HornetQQueue destQueueA = new HornetQQueue("A");
+ HornetQQueue destQueueB = new HornetQQueue("B");
+
+ // Step 5. Create a connection to a remote server using a connection-factory (look at the deployed file jms-remote-ds.xml)
+ Connection conn = connectionFactory.createConnection("guest", "guest");
+
+ // Step 6. Send a message to a QueueA on the remote server, which will be received by MDBQueueA
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer prodA = sess.createProducer(destQueueA);
+ prodA.send(sess.createTextMessage(message));
+
+ System.out.println("Step 7 (StatelessSender.java): Sent message \"" + message + "\" to QueueA");
+
+ // Step 6. Send a message to a QueueB on the remote server, which will be received by MDBQueueA
+ MessageProducer prodB = sess.createProducer(destQueueB);
+ prodB.send(sess.createTextMessage(message));
+
+ System.out.println("Step 8 (StatelessSender.java): Sent message \"" + message + "\" to QueueB");
+
+ // Step 7. Close the connection. (Since this is a JCA connection, this will just place the connection back to a connection pool)
+ conn.close();
+ System.out.println("Step 9 (StatelessSender.java): Closed Connection (sending it back to pool)");
+
+ }
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSenderService.java
===================================================================
--- trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSenderService.java (rev 0)
+++ trunk/examples/javaee/jca-config/src/org/hornetq/javaee/example/server2/StatelessSenderService.java 2009-08-21 12:52:42 UTC (rev 7864)
@@ -0,0 +1,29 @@
+/*
+ * 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.javaee.example.server2;
+
+/**
+ * A StatelessSenderService
+ *
+ * @author <a href="mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public interface StatelessSenderService
+{
+
+ public void sendHello(String message) throws Exception;
+
+}
15 years, 6 months