[jboss-cvs] JBoss Messaging SVN: r7618 - in trunk/examples/javaee: mdb-cmt-tx-required and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 27 10:57:25 EDT 2009
Author: ataylor
Date: 2009-07-27 10:57:25 -0400 (Mon, 27 Jul 2009)
New Revision: 7618
Added:
trunk/examples/javaee/mdb-cmt-tx-required/
trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/MDB_CMT_TxRequiredClientExample.java
trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/server/MDB_CMT_TxRequiredExample.java
Removed:
trunk/examples/javaee/mdb-cmp-tx-required/
trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/MDB_CMP_TxRequiredClientExample.java
trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/server/MDB_CMP_TxRequiredExample.java
Modified:
trunk/examples/javaee/mdb-cmt-tx-required/build.xml
trunk/examples/javaee/mdb-cmt-tx-required/config/ant.properties
trunk/examples/javaee/mdb-cmt-tx-required/readme.html
Log:
renamed examples
Copied: trunk/examples/javaee/mdb-cmt-tx-required (from rev 7610, trunk/examples/javaee/mdb-cmp-tx-required)
Modified: trunk/examples/javaee/mdb-cmt-tx-required/build.xml
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-required/build.xml 2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-required/build.xml 2009-07-27 14:57:25 UTC (rev 7618)
@@ -31,7 +31,7 @@
<target name="run">
<antcall target="runExample">
- <param name="example.classname" value="org.jboss.javaee.example.MDB_CMP_TxRequiredClientExample"/>
+ <param name="example.classname" value="org.jboss.javaee.example.MDB_CMT_TxRequiredClientExample"/>
</antcall>
</target>
</project>
\ No newline at end of file
Modified: trunk/examples/javaee/mdb-cmt-tx-required/config/ant.properties
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-required/config/ant.properties 2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-required/config/ant.properties 2009-07-27 14:57:25 UTC (rev 7618)
@@ -1 +1 @@
-example.name=mdb-cmp-tx-required
\ No newline at end of file
+example.name=mdb-cmt-tx-required
\ No newline at end of file
Modified: trunk/examples/javaee/mdb-cmt-tx-required/readme.html
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-required/readme.html 2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-required/readme.html 2009-07-27 14:57:25 UTC (rev 7618)
@@ -1,12 +1,12 @@
<html>
<head>
- <title>JBoss Messaging Java EE MDB CMP using a transaction Example</title>
+ <title>JBoss Messaging Java EE MDB Container Managed Transactions Example</title>
<link rel="stylesheet" type="text/css" href="../../common/common.css">
</head>
<body>
- <h1>Java EE MDB CMP using a transaction Example</h1>
+ <h1>Java EE MDB Container Managed Transactions Example</h1>
<br>
- <p>This example shows you how to send a message to an MDB that is delivered within a transaction</p>
+ <p>This example shows you how to send a message to an MDB that is delivered within a transaction controlled by the container</p>
<p>
The example will send deploy a simple MDB and demonstrate sending a message and the MDB consuming it
</p>
Deleted: trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/MDB_CMP_TxRequiredClientExample.java
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-required/src/org/jboss/javaee/example/MDB_CMP_TxRequiredClientExample.java 2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/MDB_CMP_TxRequiredClientExample.java 2009-07-27 14:57:25 UTC (rev 7618)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.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 at jboss.org">Andy Taylor</a>
- */
-public class MDB_CMP_TxRequiredClientExample
-{
- 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 9,10 and 11 in MDBExample
- }
- finally
- {
- //Step 12. Be sure to close our JMS resources!
- if (initialContext != null)
- {
- initialContext.close();
- }
- if(connection != null)
- {
- connection.close();
- }
- }
- }
-}
Copied: trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/MDB_CMT_TxRequiredClientExample.java (from rev 7610, trunk/examples/javaee/mdb-cmp-tx-required/src/org/jboss/javaee/example/MDB_CMP_TxRequiredClientExample.java)
===================================================================
--- trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/MDB_CMT_TxRequiredClientExample.java (rev 0)
+++ trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/MDB_CMT_TxRequiredClientExample.java 2009-07-27 14:57:25 UTC (rev 7618)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.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 at jboss.org">Andy Taylor</a>
+ */
+public class MDB_CMT_TxRequiredClientExample
+{
+ 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 9,10 and 11 in MDBExample
+ }
+ finally
+ {
+ //Step 12. Be sure to close our JMS resources!
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
+ if(connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+}
Deleted: trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/server/MDB_CMP_TxRequiredExample.java
===================================================================
--- trunk/examples/javaee/mdb-cmp-tx-required/src/org/jboss/javaee/example/server/MDB_CMP_TxRequiredExample.java 2009-07-27 13:26:00 UTC (rev 7610)
+++ trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/server/MDB_CMP_TxRequiredExample.java 2009-07-27 14:57:25 UTC (rev 7618)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.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.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.TextMessage;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
- */
- at MessageDriven(name = "MDB_CMP_TxRequiredExample",
- activationConfig =
- {
- @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
- @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
- })
- at TransactionManagement(value= TransactionManagementType.CONTAINER)
- at TransactionAttribute(value= TransactionAttributeType.REQUIRED)
-public class MDB_CMP_TxRequiredExample implements MessageListener
-{
- @Resource(mappedName = "java:/TransactionManager")
- private TransactionManager tm;
-
- public void onMessage(Message message)
- {
- 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 + " received");
-
- //Step 11. Lets take a look at the transaction and see whats happening.
- Transaction tx = tm.getTransaction();
-
- if(tx != null)
- {
- System.out.println("we're in the middle of a transaction: " + tx);
- }
- else
- {
- System.out.println("something is wrong, I was expecting a transaction");
- }
- }
- catch (JMSException e)
- {
- e.printStackTrace();
- }
- catch (SystemException e)
- {
- e.printStackTrace();
- }
- }
-}
Copied: trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/server/MDB_CMT_TxRequiredExample.java (from rev 7610, trunk/examples/javaee/mdb-cmp-tx-required/src/org/jboss/javaee/example/server/MDB_CMP_TxRequiredExample.java)
===================================================================
--- trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/server/MDB_CMT_TxRequiredExample.java (rev 0)
+++ trunk/examples/javaee/mdb-cmt-tx-required/src/org/jboss/javaee/example/server/MDB_CMT_TxRequiredExample.java 2009-07-27 14:57:25 UTC (rev 7618)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.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.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
+/**
+ * @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
+ */
+ at MessageDriven(name = "MDB_CMT_TxRequiredExample",
+ activationConfig =
+ {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/testQueue")
+ })
+ at TransactionManagement(value= TransactionManagementType.CONTAINER)
+ at TransactionAttribute(value= TransactionAttributeType.REQUIRED)
+public class MDB_CMT_TxRequiredExample implements MessageListener
+{
+ @Resource(mappedName = "java:/TransactionManager")
+ private TransactionManager tm;
+
+ public void onMessage(Message message)
+ {
+ 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 + " received");
+
+ //Step 11. Lets take a look at the transaction and see whats happening.
+ Transaction tx = tm.getTransaction();
+
+ if(tx != null)
+ {
+ System.out.println("we're in the middle of a transaction: " + tx);
+ }
+ else
+ {
+ System.out.println("something is wrong, I was expecting a transaction");
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ catch (SystemException e)
+ {
+ e.printStackTrace();
+ }
+ }
+}
More information about the jboss-cvs-commits
mailing list