[jboss-cvs] JBossAS SVN: r95004 - in projects/docs/enterprise/5.0/Examples: jboss-messaging-examples and 158 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 16 02:29:26 EDT 2009
Author: laubai
Date: 2009-10-16 02:29:24 -0400 (Fri, 16 Oct 2009)
New Revision: 95004
Added:
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/bridge-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/test-bridge-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/example/jms/bridge/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/ejb-jar.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/jboss.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/ExampleSupport.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/Util.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/Management.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/destinations/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/destinations/jbm-examples-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/topic-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/META-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/mdb-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/examples.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/messaging-http-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/example/jms/http/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/example/jms/http/HttpExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/ejb-jar.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/jboss.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/mdb-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/application.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/jboss-app.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/ejb-jar.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/jboss.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/mdb-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/Sender.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/ConsumerThread.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/OrderingGroupExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/example/jms/failover/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/example/jms/queue/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/example/jms/queue/QueueExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging-secure-socket-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging.keystore
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging.truststore
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/example/jms/securesocket/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/messaging-servlet-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/example/jms/servlet/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/example/jms/servlet/ServletExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/ejb-jar.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/jboss.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/destinations-farm-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleBean.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleHome.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/client/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/client/Client.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/ejb-jar.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/jboss.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/client/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/log4j.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/topic-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/TopicExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/README.html
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml.AS5
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/WEB-INF/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/WEB-INF/web.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/client-config/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/client-config/client-config.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/jndi.properties
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/queue-destinations-service.xml
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/jms/webservices/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/jms/webservices/client/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java
projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java
Log:
Added jboss-messaging-examples.
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,115 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - JMS Bridge</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Bridge Example</h1>
+$Revision: 2310 $
+<h2>Overview</h2>
+<br>
+This example deploys a message bridge in JBoss AS, which is configured to
+move messages from one destination to another.
+<br>
+The example then sends some message to the source destination, then consumes the
+same messages from the target destionation, demonstrating that the bridge has
+successfully moved the messages from the source to the target.
+<br>
+The example is somewhat artificial in that normally a bridge would be used to move messages
+from source and target destinations on different servers, but it serves to illustrate how to
+use a bridge
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed according to the userguide.<br>
+<span style="font-style: italic;"></span>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA</span><br>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\bridge</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ <div style="margin-left: 40px;"><br>
+ </div>
+
+[tim at Vigor14 bridge]$ ant<br>
+Buildfile: build.xml<br>
+<br>
+identify:<br>
+ [echo] ###########################################################################<br>
+ [echo] # Running the BRIDGE example #<br>
+ [echo] ###########################################################################
+ [echo] The queue: ${example.queue.name}<br>
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar<br>
+<br>
+sanity-check:<br>
+<br>
+init:<br>
+ [mkdir] Created dir: /home/tim/dev/jboss-messaging/trunk/docs/examples/bridge/output/classes<br>
+ [mkdir] Created dir: /home/tim/dev/jboss-messaging/trunk/docs/examples/common/output/classes<br>
+<br>
+compile:<br>
+ [javac] Compiling 5 source files to /home/tim/dev/jboss-messaging/trunk/docs/examples/common/output/classes<br>
+ [javac] Compiling 1 source file to /home/tim/dev/jboss-messaging/trunk/docs/examples/bridge/output/classes>br>
+<br>
+deploy:<br>
+ [copy] Copying 1 file to /home/tim/dev/jboss-4.2.0.GA/server/messaging/deploy<br>
+<br>sleep:<br> [echo] Sleeping for 5 seconds ...<br><br>run:<br> [java] Queue JBossQueue[A] exists<br> [java] Queue JBossQueue[B] exists<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was successfully sent to the A queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from t!
he B queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from the B queue<br> [java] The message was received successfully from the B queue<br> [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)<br><br> [java] #####################<br> [java] ### SUCCESS! ###<br> [java] #####################<br><br>undeploy:<br> [delete] Deleting: /home/tim/dev/jboss-4.2.0.GA/server/messaging/deploy/test-bridge-service.xml<br><br>BUILD SUCCESSFUL<br>Total time: 9 seconds<br><br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 2705 2007-05-17 21:34:07Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="BridgeExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.source.queue" value="A" />
+ <property name="example.target.queue" value="B" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/classes"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
+ <fileset file="${jboss.home}/client/jbossall-client.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the BRIDGE example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy" depends="compile">
+ <copy file="./etc/test-bridge-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/test-bridge-service.xml" quiet="true" />
+ </target>
+
+ <target name="run" depends="deploy">
+ <java classname="org.jboss.example.jms.bridge.BridgeExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.source.queue" value="${example.source.queue}" />
+ <sysproperty key="example.target.queue" value="${example.target.queue}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 2705 2007-05-17 21:34:07Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="BridgeExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.source.queue" value="A" />
+ <property name="example.target.queue" value="B" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the BRIDGE example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy" depends="compile">
+ <copy file="./etc/bridge-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="./etc/test-bridge-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/test-bridge-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="run" depends="deploy">
+ <java classname="org.jboss.example.jms.bridge.BridgeExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.source.queue" value="${example.source.queue}" />
+ <sysproperty key="example.target.queue" value="${example.target.queue}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/bridge-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/bridge-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/bridge-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/bridge-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=A"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=B"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/test-bridge-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/test-bridge-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/etc/test-bridge-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Example deployment descriptor for a message bridge
+
+ $Id: messaging-secure-socket-service.xml 2737 2007-05-29 17:56:49Z timfox $
+ -->
+
+<server>
+
+
+ <mbean code="org.jboss.jms.server.bridge.BridgeService"
+ name="jboss.messaging:service=Bridge,name=TestBridge"
+ xmbean-dd="xmdesc/Bridge-xmbean.xml">
+
+ <!-- The JMS provider loader that is used to lookup the source destination -->
+ <depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
+
+ <!-- The JMS provider loader that is used to lookup the target destination -->
+ <depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
+
+ <!-- The JNDI lookup for the source destination -->
+ <attribute name="SourceDestinationLookup">/queue/A</attribute>
+
+ <!-- The JNDI lookup for the target destination -->
+ <attribute name="TargetDestinationLookup">/queue/B</attribute>
+
+ <!-- The username to use for the source connection
+ <attribute name="SourceUsername">bob</attribute>
+ -->
+
+ <!-- The password to use for the source connection
+ <attribute name="SourcePassword">cheesecake</attribute>
+ -->
+
+ <!-- The username to use for the target connection
+ <attribute name="TargetUsername">mary</attribute>
+ -->
+
+ <!-- The password to use for the target connection
+ <attribute name="TargetPassword">hotdog</attribute>
+ -->
+
+ <!-- Optional: The Quality Of Service mode to use, one of:
+ QOS_AT_MOST_ONCE = 0;
+ QOS_DUPLICATES_OK = 1;
+ QOS_ONCE_AND_ONLY_ONCE = 2; -->
+ <attribute name="QualityOfServiceMode">0</attribute>
+
+ <!-- JMS selector to use for consuming messages from the source
+ <attribute name="Selector">specify jms selector here</attribute>
+ -->
+
+ <!-- The maximum number of messages to consume from the source before sending to the target -->
+ <attribute name="MaxBatchSize">5</attribute>
+
+ <!-- The maximum time to wait (in ms) before sending a batch to the target even if MaxBatchSize is not exceeded.
+ -1 means wait forever -->
+ <attribute name="MaxBatchTime">-1</attribute>
+
+ <!-- If consuming from a durable subscription this is the subscription name
+ <attribute name="SubName">mysub</attribute>
+ -->
+
+ <!-- If consuming from a durable subscription this is the client ID to use
+ <attribute name="ClientID">myClientID</attribute>
+ -->
+
+ <!-- The number of ms to wait between connection retrues in the event connections to source or target fail -->
+ <attribute name="FailureRetryInterval">5000</attribute>
+
+ <!-- The maximum number of connection retries to make in case of failure, before giving up
+ -1 means try forever-->
+ <attribute name="MaxRetries">-1</attribute>
+
+ <!-- If true then the message id of the message before bridging will be added as a header to the message so it is available
+ to the receiver. Can then be sent as correlation id to correlate in a distributed request-response -->
+ <attribute name="AddMessageIDInHeader">false</attribute>
+
+ </mbean>
+
+ </server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/bridge/src/org/jboss/example/jms/bridge/BridgeExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,150 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.bridge;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example creates a JMS Connection to a JBoss Messaging instance and then sends a message to a source queue.
+ * It then waits to receive the same messages from the target queue.
+ *
+ * The example ant script will deploy a message bridge that moves messages from the source to the target queue.
+ *
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2674 $</tt>
+ *
+ * $Id: QueueExample.java 2674 2007-05-14 19:57:23Z timfox $
+ */
+public class BridgeExample extends ExampleSupport
+{
+
+ public void example() throws Exception
+ {
+ String source = System.getProperty("example.source.queue");
+
+ String target = System.getProperty("example.target.queue");
+
+ InitialContext ic = null;
+ ConnectionFactory cf = null;
+ Connection connection = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Queue sourceQueue = (Queue)ic.lookup("/queue/" + source);
+ log("Queue " + sourceQueue + " exists");
+
+ Queue targetQueue = (Queue)ic.lookup("/queue/" + target);
+ log("Queue " + targetQueue + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(sourceQueue);
+
+ final int NUM_MESSAGES = 10;
+
+ for (int i = 0; i < NUM_MESSAGES; i++)
+ {
+ TextMessage message = session.createTextMessage("Hello!" + i);
+
+ sender.send(message);
+
+ log("The message was successfully sent to the " + sourceQueue.getQueueName() + " queue");
+ }
+
+ MessageConsumer consumer = session.createConsumer(targetQueue);
+
+ connection.start();
+
+ for (int i = 0; i < NUM_MESSAGES; i++)
+ {
+ TextMessage message = (TextMessage)consumer.receive(10000);
+
+ assertEquals("Hello!" + i, message.getText());
+
+ log("The message was received successfully from the " + targetQueue.getQueueName() + " queue");
+ }
+
+ displayProviderInfo(connection.getMetaData());
+ }
+ finally
+ {
+ if(ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ // ALWAYS close your connection in a finally block to avoid leaks.
+ // Closing connection also takes care of closing its related objects e.g. sessions.
+ closeConnection(connection);
+ }
+ }
+
+ private void closeConnection(Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " + jmse);
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new BridgeExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/ejb-jar.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/ejb-jar.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/ejb-jar.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+ "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+ <enterprise-beans>
+ <session>
+ <ejb-name>Management</ejb-name>
+ <home>org.jboss.example.jms.common.bean.ManagementHome</home>
+ <remote>org.jboss.example.jms.common.bean.Management</remote>
+ <ejb-class>org.jboss.example.jms.common.bean.ManagementBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Bean</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/jboss.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/jboss.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/etc/META-INF/jboss.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+ "-//JBoss//DTD JBOSS 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>Management</ejb-name>
+ <jndi-name>ejb/Management</jndi-name>
+ </session>
+ </enterprise-beans>
+</jboss>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/ExampleSupport.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/ExampleSupport.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/ExampleSupport.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,292 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionMetaData;
+import javax.jms.ConnectionFactory;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.bean.Management;
+import org.jboss.example.jms.common.bean.ManagementHome;
+import org.jboss.jms.client.JBossConnection;
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.jms.client.delegate.DelegateSupport;
+import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
+import org.jboss.jms.client.state.ConnectionState;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 7466 $</tt>
+ *
+ * $Id: ExampleSupport.java 7466 2009-06-25 12:19:21Z gaohoward $
+ */
+public abstract class ExampleSupport
+{
+ // Constants -----------------------------------------------------
+
+ public static final String DEFAULT_QUEUE_NAME = "testQueue";
+ public static final String DEFAULT_TOPIC_NAME = "testTopic";
+
+ // Static --------------------------------------------------------
+
+ public static int getServerID(Connection conn) throws Exception
+ {
+ if (!(conn instanceof JBossConnection))
+ {
+ throw new Exception("Connection not an instance of JBossConnection");
+ }
+
+ JBossConnection jbconn = (JBossConnection)conn;
+
+ DelegateSupport del = (DelegateSupport)jbconn.getDelegate();
+
+ ConnectionState state = (ConnectionState)del.getState();
+
+ return state.getServerID();
+ }
+
+ public static void assertEquals(Object o, Object o2)
+ {
+ if (o == null && o2 == null)
+ {
+ return;
+ }
+
+ if (o.equals(o2))
+ {
+ return;
+ }
+
+ throw new RuntimeException("Assertion failed, " + o + " != " + o2);
+ }
+
+ public static void assertEquals(int i, int i2)
+ {
+ if (i == i2)
+ {
+ return;
+ }
+
+ throw new RuntimeException("Assertion failed, " + i + " != " + i2);
+ }
+
+ public static void assertNotEquals(int i, int i2)
+ {
+ if (i != i2)
+ {
+ return;
+ }
+
+ throw new RuntimeException("Assertion failed, " + i + " == " + i2);
+ }
+
+
+ public static void killActiveNode() throws Exception
+ {
+ // Currently it will always kill the primary node, ignoring nodeID
+
+ try
+ {
+ InitialContext ic = new InitialContext();
+
+ ManagementHome home = (ManagementHome)ic.lookup("ejb/Management");
+ Management bean = home.create();
+ try
+ {
+ bean.killAS();
+ }
+ catch(Exception e)
+ {
+ // OK, I expect exceptions following a VM kill
+ }
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException("Could not kill the active node", e);
+ }
+ }
+
+
+ // Attributes ----------------------------------------------------
+
+ private boolean failure;
+ private boolean deployed;
+ private String jndiDestinationName;
+ private String jndiDestinationName2;
+
+ // Constructors --------------------------------------------------
+
+ protected ExampleSupport()
+ {
+ failure = false;
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ protected abstract void example() throws Exception;
+ protected abstract boolean isQueueExample();
+
+ protected final boolean isTopicExample()
+ {
+ return !isQueueExample();
+ }
+
+ protected void run()
+ {
+ try
+ {
+ setup();
+ example();
+ tearDown();
+ }
+ catch(Throwable t)
+ {
+ t.printStackTrace();
+ System.out.println("");
+ System.out.println("Please verify if you have access to the server. If you are using JBossEAP maybe you don't have security access");
+ setFailure(true);
+ }
+
+ reportResultAndExit();
+ }
+
+ protected void setFailure(boolean b)
+ {
+ failure = b;
+ }
+
+ protected boolean isFailure()
+ {
+ return failure;
+ }
+
+ protected String getDestinationJNDIName()
+ {
+ return jndiDestinationName;
+ }
+
+ protected void log(String s)
+ {
+ System.out.println(s);
+ }
+
+ protected void displayProviderInfo(ConnectionMetaData metaData) throws Exception
+ {
+ String info =
+ "The example connected to " + metaData.getJMSProviderName() +
+ " version " + metaData.getProviderVersion() + " (" +
+ metaData.getProviderMajorVersion() + "." + metaData.getProviderMinorVersion() +
+ ")";
+
+ System.out.println(info);
+ }
+
+ // Private -------------------------------------------------------
+
+ protected void setup() throws Exception
+ {
+ setup(null);
+ }
+
+ protected void setup(InitialContext ic) throws Exception
+ {
+ String destinationName = null;
+ String destinationName2 = null;
+
+ if (isQueueExample())
+ {
+ destinationName = System.getProperty("example.queue.name");
+
+ if (destinationName == null)
+ {
+ destinationName = System.getProperty("example.source.queue");
+ if (destinationName != null)
+ {
+ destinationName2 = System.getProperty("example.target.queue");
+ if (destinationName2 != null)
+ {
+ jndiDestinationName2 = "/queue/" + destinationName2;
+ }
+ }
+ else
+ {
+ destinationName = DEFAULT_QUEUE_NAME;
+ }
+ }
+
+ jndiDestinationName =
+ "/queue/" + destinationName;
+ }
+ else
+ {
+ destinationName = System.getProperty("example.topic.name");
+ jndiDestinationName =
+ "/topic/" + (destinationName == null ? DEFAULT_TOPIC_NAME : destinationName);
+ }
+
+ if (!Util.doesDestinationExist(jndiDestinationName,ic))
+ {
+ System.out.println("Destination " + jndiDestinationName + " does not exist, deploying it");
+ if (isQueueExample())
+ {
+ Util.deployQueue(jndiDestinationName,ic);
+ if (jndiDestinationName2 != null)
+ {
+ Util.deployQueue(jndiDestinationName2, ic);
+ }
+ }
+ else
+ {
+ Util.deployTopic(jndiDestinationName, ic);
+ }
+ deployed = true;
+ }
+ }
+
+ protected void tearDown() throws Exception
+ {
+ tearDown(null);
+ }
+
+ protected void tearDown(InitialContext ic) throws Exception
+ {
+ if (deployed)
+ {
+ Util.undeployQueue(jndiDestinationName,ic);
+ if (jndiDestinationName2 != null)
+ {
+ Util.undeployQueue(jndiDestinationName2);
+ }
+ }
+ }
+
+ protected void reportResultAndExit()
+ {
+ if (isFailure())
+ {
+ System.err.println();
+ System.err.println("#####################");
+ System.err.println("### FAILURE! ###");
+ System.err.println("#####################");
+ System.exit(1);
+ }
+
+ System.out.println();
+ System.out.println("#####################");
+ System.out.println("### SUCCESS! ###");
+ System.out.println("#####################");
+ System.exit(0);
+ }
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/Util.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/Util.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/Util.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,161 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.common;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 7462 $</tt>
+ *
+ * $Id: Util.java 7462 2009-06-25 08:48:45Z gaohoward $
+ */
+public class Util
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+
+ public static boolean doesDestinationExist(String jndiName) throws Exception
+ {
+ return doesDestinationExist(jndiName, null);
+ }
+
+ public static boolean doesDestinationExist(String jndiName, InitialContext ic) throws Exception
+ {
+ if (ic == null)
+ {
+ ic = new InitialContext();
+ }
+ try
+ {
+ ic.lookup(jndiName);
+ }
+ catch(NameNotFoundException e)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public static void deployQueue(String jndiName) throws Exception
+ {
+ deployQueue(jndiName,null);
+ }
+
+ public static void deployQueue(String jndiName, InitialContext ic) throws Exception
+ {
+ MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+ ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+ String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+ mBeanServer.invoke(serverObjectName, "deployQueue",
+ new Object[] {queueName, jndiName},
+ new String[] {"java.lang.String", "java.lang.String"});
+
+ System.out.println("Queue " + jndiName + " deployed");
+ }
+
+ public static void undeployQueue(String jndiName) throws Exception
+ {
+ undeployQueue(jndiName,null);
+ }
+
+ public static void deployTopic(String jndiName, InitialContext ic) throws Exception
+ {
+ MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+ ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+ String topicName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+ mBeanServer.invoke(serverObjectName, "deployTopic",
+ new Object[] {topicName, jndiName},
+ new String[] {"java.lang.String", "java.lang.String"});
+
+ System.out.println("Topic " + jndiName + " deployed");
+ }
+
+ public static void undeployTopic(String jndiName) throws Exception
+ {
+ undeployTopic(jndiName,null);
+ }
+
+ public static void undeployQueue(String jndiName, InitialContext ic) throws Exception
+ {
+ MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+ ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+ String queueName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+ mBeanServer.invoke(serverObjectName, "destroyQueue",
+ new Object[] {queueName},
+ new String[] {"java.lang.String"});
+
+ System.out.println("Queue " + jndiName + " undeployed");
+ }
+
+ public static void undeployTopic(String jndiName, InitialContext ic) throws Exception
+ {
+ MBeanServerConnection mBeanServer = lookupMBeanServerProxy(ic);
+
+ ObjectName serverObjectName = new ObjectName("jboss.messaging:service=ServerPeer");
+
+ String topicName = jndiName.substring(jndiName.lastIndexOf('/') + 1);
+
+ mBeanServer.invoke(serverObjectName, "destroyTopic",
+ new Object[] {topicName},
+ new String[] {"java.lang.String"});
+
+ System.out.println("Topic " + jndiName + " undeployed");
+ }
+
+ public static MBeanServerConnection lookupMBeanServerProxy(InitialContext ic) throws Exception
+ {
+ if (ic == null)
+ {
+ ic = new InitialContext();
+ }
+ return (MBeanServerConnection)ic.lookup("jmx/invoker/RMIAdaptor");
+ }
+
+ // Attributes ----------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/Management.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/Management.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/Management.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,26 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1766 $</tt>
+
+ * $Id: StatelessSessionExample.java 1766 2006-12-11 22:29:27Z ovidiu.feodorov at jboss.com $
+ */
+
+public interface Management extends EJBObject
+{
+ /**
+ * It kills the VM running the node instance. Needed by the failover tests.
+ */
+ public void killAS() throws Exception, RemoteException;
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementBean.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,58 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1766 $</tt>
+
+ * $Id: StatelessSessionExampleBean.java 1766 2006-12-11 22:29:27Z ovidiu.feodorov at jboss.com $
+ */
+public class ManagementBean implements SessionBean
+{
+ public void killAS() throws Exception
+ {
+ System.out.println("######");
+ System.out.println("######");
+ System.out.println("######");
+ System.out.println("######");
+ System.out.println("###### SIMULATING A FAILURE, KILLING THE VM!");
+ System.out.println("######");
+ System.out.println("######");
+ System.out.println("######");
+ System.out.println("######");
+
+ Runtime.getRuntime().halt(1);
+ }
+
+ public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbCreate()
+ {
+ }
+
+ public void ejbRemove() throws EJBException
+ {
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException
+ {
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/common/src/org/jboss/example/jms/common/bean/ManagementHome.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,24 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.common.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 563 $</tt>
+
+ * $Id: StatelessSessionExampleHome.java 563 2005-12-30 22:04:19Z ovidiu $
+ */
+
+public interface ManagementHome extends EJBHome
+{
+ public Management create() throws RemoteException, CreateException;
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/destinations/jbm-examples-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/destinations/jbm-examples-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/destinations/jbm-examples-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=testTopic"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="durpublisher" read="true" write="true" create="true"/>
+ </security>
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=securedTopic"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="publisher" read="true" write="true" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=testDurableTopic"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="durpublisher" read="true" write="true" create="true"/>
+ </security>
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=A"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=B"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=C"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=D"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=ex"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <!-- It's possible for indiviual queues and topics to use a specific queue for
+ an expiry or DLQ -->
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=PrivateDLQ"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=QueueWithOwnDLQAndExpiryQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
+ <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=TopicWithOwnDLQAndExpiryQueue"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="DLQ">jboss.messaging.destination:service=Queue,name=PrivateDLQ</attribute>
+ <attribute name="ExpiryQueue">jboss.messaging.destination:service=Queue,name=PrivateExpiryQueue</attribute>
+ </mbean>
+
+ <!-- Queues and Topics can also specify their own redelivery delay -->
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=QueueWithOwnRedeliveryDelay"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="RedeliveryDelay">5000</attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=TopicWithOwnRedeliveryDelay"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="RedeliveryDelay">5000</attribute>
+ </mbean>
+
+ <!--
+ Example clustered destinations.
+ -->
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="Clustered">true</attribute>
+ </mbean>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=testDistributedTopic"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="Clustered">true</attribute>
+ </mbean>
+</server>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,135 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Distributed Queue</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Distributed Queue Example</h1>
+$Revision: 1017 $
+<h2>Overview</h2>
+<br>
+This example demonstrates how to write JMS code that connects to a
+JBoss Messaging cluster and sends messages to a distributed queue.
+The example creates two connections to two distinct cluster nodes
+on which we have previously deployed a distributed queue.
+The example sends and receives messages using both connections.
+<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+cluster with at least two nodes. The JBoss Messaging cluster must be
+installed and started according to the user guide.
+<<br><br>
+For JBoss5, you should copy all as messaging-node0, configure mysql as a database, make it clustered, and copy it as messaging-node1. Start each instance as:
+<br><br>
+./run.sh -c messaging-node0 -Djboss.service.binding.set=ports-01
+<br><br>
+<br>
+and in another window
+<br><br>
+./run.sh -c messaging-node1 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=1
+<br><br>
+<span style="font-style: italic;"></span><br>
+<h2>Running the example</h2>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+1. Make sure that a JBoss Messaging cluster with at least two nodes is
+up and running.<br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\distributed-queue</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ <div style="margin-left: 40px;"><br>
+ </div>
+$ ant<br>
+Buildfile: build.xml<br>
+ <br>
+identify:<br>
+ [echo]
+###########################################################################<br>
+ [echo]
+#
+Running the DISTRIBUTED QUEUE
+example
+#<br>
+ [echo]
+###########################################################################<br>
+ [echo] The
+topic: testDistributedQueue<br>
+ [echo] The client jar:
+../../../output/lib/jboss-messaging-client.jar<br>
+ <br>
+sanity-check:<br>
+ <br>
+init:<br>
+ [mkdir] Created dir:
+C:\work\src\svn\messaging\docs\examples\distributed-queue\output<br>
+ [mkdir] Created dir:
+C:\work\src\svn\messaging\docs\examples\common\output<br>
+ <br>
+compile:<br>
+ [javac] Compiling 2 source files to
+C:\work\src\svn\messaging\docs\examples\common\output<br>
+ [javac] Compiling 2 source files to
+C:\work\src\svn\messaging\docs\examples\distributed-queue\output<br>
+ <br>
+run:<br>
+ [java] Distributed queue
+/queue/testDistributedQueue exists<br>
+ [java] The message was successfully sent
+to the distributed queue<br>
+ [java] MessageListener0 received message:
+Hello!<br>
+ [java] MessageListener1 received message:
+Another Hello!<br>
+ [java] The example connected to JBoss
+Messaging version 1.3.0.GA (1.3)<br>
+ <br>
+ [java] #####################<br>
+ [java] ###
+SUCCESS! ###<br>
+ [java] #####################<br>
+ <br>
+BUILD SUCCESSFUL<br>
+Total time: 4 seconds<br>
+ <br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ The example requires a two nodes messaging-node0 and messaging-node1 to be running
+
+ $Id: build.xml 974 2006-05-22 21:35:38 -0600 (Mon, 22 May 2006) ovidiu $
+
+ -->
+
+<project name="DistributedQueueExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="example.queue.name" value="testDistributedQueue" />
+
+ <property name="ej3-extension" value="ejb3"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the DISTRIBUTED QUEUE example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <!--
+ DistributedQueueExample expects to find the name of the queue to connect to as value of
+ the 'example.queue.name' property, which *may* be defined by calling ant when this
+ example is used in a smoke test.
+ -->
+ <java classname="org.jboss.example.jms.distributedqueue.DistributedQueueExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ The example requires a two nodes messaging-node0 and messaging-node1 to be running
+
+ $Id: build.xml 974 2006-05-22 21:35:38 -0600 (Mon, 22 May 2006) ovidiu $
+
+ -->
+
+<project name="DistributedQueueExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="jboss.configuration1" value="messaging-node1" />
+ <property name="example.queue.name" value="testDistributedQueue" />
+
+ <property name="ej3-extension" value="jar"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the DISTRIBUTED QUEUE example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="3" />
+ </antcall>
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration1}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="15" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!--
+ DistributedQueueExample expects to find the name of the queue to connect to as value of
+ the 'example.queue.name' property, which *may* be defined by calling ant when this
+ example is used in a smoke test.
+ -->
+ <java classname="org.jboss.example.jms.distributedqueue.DistributedQueueExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration1}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,5 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+# Assuming ports-01 so naming running on 1199
+java.naming.provider.url=jnp://localhost:1199
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 00:28:39 -0600 (Thu, 22 Dec 2005) ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="Clustered">true</attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/DistributedQueueExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,170 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.distributedqueue;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates two connections to two distinct cluster nodes on which we have previously
+ * deployed a distributed queue. The example sends messages on one node and consumes them from another
+ *
+ * Since this example is also used as a smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1001 $</tt>
+ *
+ * $Id: TopicExample.java 1001 2006-06-24 09:05:40Z timfox $
+ */
+public class DistributedQueueExample extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+
+ Connection connection0 = null;
+ Connection connection1 = null;
+
+ ConnectionFactory cf = null;
+
+ try
+ {
+ // connecting to the first node
+
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
+ Queue distributedQueue = (Queue)ic.lookup(destinationName);
+ log("Distributed queue " + destinationName + " exists");
+
+
+ // When connecting to a messaging cluster, the ConnectionFactory has the capability of
+ // transparently creating physical connections to different cluster nodes, in a round
+ // robin fashion ...
+
+ // ... so this is a connection to a cluster node
+ connection0 = cf.createConnection();
+
+ // ... and this is a connection to a different cluster node
+ connection1 = cf.createConnection();
+
+ // Let's make sure that (this example is also a smoke test)
+ assertNotEquals(getServerID(connection0), getServerID(connection1));
+
+ // Create a session, and a producer on the first connection
+
+ Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer publisher0 = session0.createProducer(distributedQueue);
+
+ // Create another session, and consumer on the second connection
+
+ Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer1 = session1.createConsumer(distributedQueue);
+ ExampleListener messageListener1 = new ExampleListener("MessageListener1");
+ consumer1.setMessageListener(messageListener1);
+
+ // Start connections, so we can receive the message
+
+ connection0.start();
+ connection1.start();
+
+ // Send the message
+
+ TextMessage message = session0.createTextMessage("Hello!");
+ publisher0.send(message);
+
+ log("The message was successfully sent to the distributed queue");
+
+ messageListener1.waitForMessage(3000);
+
+ message = (TextMessage)messageListener1.getMessage();
+ log(messageListener1.getName() + " received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ displayProviderInfo(connection0.getMetaData());
+ }
+ finally
+ {
+ if (ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ try
+ {
+ if (connection0 != null)
+ {
+ connection0.close();
+ }
+ }
+ catch(JMSException e)
+ {
+ log("Could not close connection " + connection0 + ", exception was " + e);
+ throw e;
+ }
+
+ try
+ {
+ if (connection1 != null)
+ {
+ connection1.close();
+ }
+ }
+ catch(JMSException e)
+ {
+ log("Could not close connection " + connection1 + ", exception was " + e);
+ throw e;
+ }
+
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new DistributedQueueExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-queue/src/org/jboss/example/jms/distributedqueue/ExampleListener.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,82 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.distributedqueue;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 536 $</tt>
+
+ * $Id: ExampleListener.java 536 2005-12-22 00:28:39 -0600 (Thu, 22 Dec 2005) ovidiu $
+ */
+public class ExampleListener implements MessageListener
+{
+ // Constants ------------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ private String name;
+ private Message message;
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ public ExampleListener(String name)
+ {
+ this.name = name;
+ }
+
+ // MessageListener implementation ---------------------------------------------------------------
+
+ public synchronized void onMessage(Message message)
+ {
+ this.message = message;
+ notifyAll();
+ }
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public synchronized Message getMessage()
+ {
+ return message;
+ }
+
+ public synchronized void waitForMessage(long timeout)
+ {
+ if (message != null)
+ {
+ return;
+ }
+
+ try
+ {
+ wait(timeout);
+ }
+ catch(InterruptedException e)
+ {
+ // OK
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - JMS Distributed Topic</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Distributed Topic Example</h1>
+$ Revision: 5409 $
+<h2>Overview</h2>
+<p>This example demonstrates how to write Java Message Service code that connects to a JBoss Messaging cluster and sends messages to a distributed topic. Each connection is then used to create a subscriber for the distributed topic. The example is considered successful if both subscribers receive a message sent to the topic.</p>
+<p>This example requires access to a running JBoss Messaging cluster with a minimum of two nodes. The JBoss Messaging cluster must be installed and started according to the JBoss Messaging User Guide.</p>
+
+<!--For JBoss5, you should copy all as messaging-node0, configure mysql as a database, make it clustered, and copy it as messaging-node1. Start each instance as:
+<br><br>
+./run -c messaging-node0 -Djboss.service.binding.set=ports-01
+<br><br>
+<br>
+and in another window
+<br><br>
+./run.sh -c messaging-node1 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=1
+<br><br>
+<span style="font-style: italic;"></span><br>-->
+
+<h2>Running the example</h2>
+<ol>
+ <li>
+ <p>Ensure that a JBoss Messaging cluster with a minimum of two nodes is running and available.</p>
+ </li>
+ <li>
+ <p>Go to the example's home directory:</p>
+ <div style="margin-left: 40px;"><span style="font-family: monospace;">cd ...\examples\distributed-topic</span></div>
+ </li>
+ <li>
+ <p>Run the example:</p>
+ <div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span></div>
+ </li>
+</ol>
+
+<p>A successful run should have output similar to the following:</p>
+
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ $ ant<br>
+Buildfile: build.xml<br>
+<br>
+identify:<br>
+ [echo] ###########################################################################<br>
+ [echo] # Running the DISTRIBUTED TOPIC example #<br>
+ [echo] ###########################################################################<br>
+ [echo] The topic: testDistributedTopic<br>
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar<br>
+<br>
+sanity-check:<br>
+<br>
+init:<br>
+ [mkdir] Created dir: C:\work\src\svn\messaging\docs\examples\distributed-topic\output<br>
+ [mkdir] Created dir: C:\work\src\svn\messaging\docs\examples\common\output<br>
+<br>
+compile:<br>
+ [javac] Compiling 2 source files to C:\work\src\svn\messaging\docs\examples\common\output<br>
+ [javac] Compiling 2 source files to C:\work\src\svn\messaging\docs\examples\distributed-topic\output<br>
+<br>
+run:<br>
+ [java] Distributed topic /topic/testDistributedTopic exists<br>
+ [java] The message was successfully published on the distributed topic<br>
+ [java] MessageListener 1 received message: Hello!<br>
+ [java] MessageListener 2 received message: Hello!<br>
+ [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)<br>
+<br>
+ [java] #####################<br>
+ [java] ### SUCCESS! ###<br>
+ [java] #####################<br>
+<br>
+BUILD SUCCESSFUL<br>
+Total time: 4 seconds
+ </td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5561 2008-12-22 10:26:32Z gaohoward $
+
+ -->
+
+<project name="DistributedTopicExample" default="run">
+
+ <property environment="ENV" />
+
+ <property file="../examples.properties" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="example.topic.name" value="testDistributedTopic" />
+
+ <property name="ej3-extension" value="ejb3"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the DISTRIBUTED TOPIC example #" />
+ <echo message="###########################################################################" />
+ <echo message="The topic: ${example.topic.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <!--
+ DistributedTopicExample expects to find the name of the topic to connect to as value of
+ the 'example.topic.name' property, which *may* be defined by calling ant when this
+ example is used in a smoke test.
+ -->
+ <java classname="org.jboss.example.jms.distributedtopic.DistributedTopicExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.topic.name" value="${example.topic.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="DistributedTopicExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="jboss.configuration1" value="messaging-node1" />
+ <property name="example.topic.name" value="testDistributedTopic" />
+
+ <property name="ej3-extension" value="jar"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the DISTRIBUTED TOPIC example #" />
+ <echo message="###########################################################################" />
+ <echo message="The topic: ${example.topic.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/topic-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="3" />
+ </antcall>
+ <copy file="./etc/topic-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration1}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="15" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!--
+ DistributedTopicExample expects to find the name of the topic to connect to as value of
+ the 'example.topic.name' property, which *may* be defined by calling ant when this
+ example is used in a smoke test.
+ -->
+ <java classname="org.jboss.example.jms.distributedtopic.DistributedTopicExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.topic.name" value="${example.topic.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/topic-destinations-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration1}/deploy/topic-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,5 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+# Asuming ports-01 where naming listens on 1199
+java.naming.provider.url=jnp://localhost:1199
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2744 2007-05-30 17:16:29Z sergeypk $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/topic-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/topic-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/etc/topic-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=testDistributedTopic"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="Clustered">true</attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/DistributedTopicExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,183 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.distributedtopic;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example sends a message to a distributed topic deployed on the JMS cluster. The message is
+ * subsequently received by two different subscribers, connected to two distinct cluster nodes.
+ *
+ * Since this example is also used as a smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 3092 $</tt>
+ *
+ * $Id: DistributedTopicExample.java 3092 2007-09-10 21:42:30Z clebert.suconic at jboss.com $
+ */
+public class DistributedTopicExample extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+
+ Connection connection0 = null;
+ Connection connection1 = null;
+
+ ConnectionFactory cf = null;
+ try
+ {
+ // connecting to the first node
+
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
+ Topic distributedTopic = (Topic)ic.lookup(destinationName);
+ log("Distributed topic " + destinationName + " exists");
+
+
+ // When connecting to a messaging cluster, the ConnectionFactory has the capability of
+ // transparently creating physical connections to different cluster nodes, in a round
+ // robin fashion ...
+
+ // ... so this is a connection to a cluster node
+ connection0 = cf.createConnection();
+
+ // ... and this is a connection to a different cluster node
+ connection1 = cf.createConnection();
+
+ // Let's make sure that (this example is also a smoke test)
+ assertNotEquals(getServerID(connection0), getServerID(connection1));
+
+ // Create a session, a producer and consumer for the distributed topic, using connection0
+
+ Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer subscriber0 = session0.createConsumer(distributedTopic);
+ ExampleListener messageListener0 = new ExampleListener("MessageListener 0");
+ subscriber0.setMessageListener(messageListener0);
+
+ MessageProducer publisher = session0.createProducer(distributedTopic);
+
+
+ // Create a session and a consumer for the distributed topic, using connection1
+
+ Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer subscriber1 = session1.createConsumer(distributedTopic);
+
+ ExampleListener messageListener1 = new ExampleListener("MessageListener 1");
+ subscriber1.setMessageListener(messageListener1);
+
+ // Starting the connections
+
+ connection0.start();
+ connection1.start();
+
+ // Sending the message
+
+ TextMessage message = session0.createTextMessage("Hello!");
+ publisher.send(message);
+
+ log("The message was successfully published on the distributed topic");
+
+ messageListener0.waitForMessage();
+ messageListener1.waitForMessage();
+
+ message = (TextMessage)messageListener0.getMessage();
+ log(messageListener0.getName() + " received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ message = (TextMessage)messageListener1.getMessage();
+ log(messageListener1.getName() + " received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ displayProviderInfo(connection0.getMetaData());
+
+ }
+ finally
+ {
+ if (ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ try
+ {
+ if (connection0 != null)
+ {
+ connection0.close();
+ }
+ }
+ catch(JMSException e)
+ {
+ log("Could not close connection " + connection0 + ", exception was " + e);
+ throw e;
+ }
+
+ try
+ {
+ if (connection1 != null)
+ {
+ connection1.close();
+ }
+ }
+ catch(JMSException e)
+ {
+ log("Could not close connection " + connection1 + ", exception was " + e);
+ throw e;
+ }
+
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return false;
+ }
+
+ public static void main(String[] args)
+ {
+ new DistributedTopicExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/distributed-topic/src/org/jboss/example/jms/distributedtopic/ExampleListener.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,82 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.distributedtopic;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: ExampleListener.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class ExampleListener implements MessageListener
+{
+ // Constants -----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private String name;
+ private Message message;
+
+ // Constructors --------------------------------------------------
+
+ public ExampleListener(String name)
+ {
+ this.name = name;
+ }
+
+ // MessageListener implementation --------------------------------
+
+ public synchronized void onMessage(Message message)
+ {
+ this.message = message;
+ notifyAll();
+ }
+
+ // Public --------------------------------------------------------
+
+ public synchronized Message getMessage()
+ {
+ return message;
+ }
+
+ public synchronized void waitForMessage()
+ {
+ if (message != null)
+ {
+ return;
+ }
+
+ try
+ {
+ wait(5000);
+ }
+ catch(InterruptedException e)
+ {
+ // OK
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,147 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - EJB3 Message Driven Bean</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging EJB3 Message Driven Bean Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example deploys a simple EJB3 Message Driven Bean that processes
+messages sent to a test queue. Once it receives a message and
+"processes" it, the EJB3 MDB sends an acknowledgment message to a
+temporary destination created by the sender for this purpose. The
+example is considered successful if the sender receives the
+acknowledgment message.<br>
+<br>
+<span style="font-style: italic;"></span><br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\default\deploy</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA</span><br>
+<span style="font-family: monospace;"><br>
+</span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\ejb3mdb</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ <div style="margin-left: 40px;"><br>
+ </div>
+$ ant<br>
+Buildfile: build.xml<br>
+ <br>
+identify:<br>
+ [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+ [echo]
+X
+Running the EJB3 MDB
+example
+X<br>
+ [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+ [echo] The queue: testQueue<br>
+ <br>
+sanity-check:<br>
+ <br>
+init:<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\classes\META-INF<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\lib\META-INF<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+ <br>
+compile:<br>
+ [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+ [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\classes<br>
+ <br>
+jar:<br>
+ [jar] Building jar:
+C:\work\src\cvs\jboss-head\jms\docs\examples\ejb3mdb\output\lib\mdb-example.ejb3<br>
+ <br>
+deploy:<br>
+ [copy] Copying 1 file to
+C:\work\src\jboss-4.0.3SP1-src\build\output\jboss-4.0.3SP1\server\messaging\deploy<br>
+ <br>
+sleep:<br>
+ [echo] Sleeping for 5 seconds ...<br>
+ <br>
+run:<br>
+ <br>
+send:<br>
+ [java] Queue /queue/testQueue exists<br>
+ [java] The Hello! message was successfully
+sent to the testQueue queue<br>
+ [java] Received message: !olleH<br>
+ [java] The example connected to JBoss
+Messaging version 1.3.0.GA (1.3)<br>
+ <br>
+ [java] #####################<br>
+ [java] ###
+SUCCESS! ###<br>
+ [java] #####################<br>
+ <br>
+undeploy:<br>
+ [delete] Deleting:
+C:\work\src\jboss-4.2.0.GA\build\output\jboss-4.0.3SP1\server\messaging\deploy\mdb-example.ejb3<br>
+ <br>
+BUILD SUCCESSFUL<br>
+Total time: 10 seconds<br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<br>
+<h2>Troubleshooting</h2>
+<br>
+<h3>2. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br style="font-family: courier new,courier,monospace;">
+<hr
+ style="width: 100%; height: 2px; font-family: courier new,courier,monospace;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5559 2008-12-22 08:58:16Z gaohoward $
+
+ -->
+
+<project name="EJB3MDBExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="ej3-extension" value="ejb3"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fileset file="${jboss.home}/client/jboss-ejb3x.jar"/>
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the EJB3 MDB example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="init" >
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib/META-INF" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF" filtering="true">
+ <fileset dir="./etc/META-INF" includes="*" />
+ <filterset>
+ <filter token="QUEUE_NAME" value="${example.queue.name}" />
+ </filterset>
+ </copy>
+ <jar destfile="./output/lib/mdb-example.${ej3-extension}" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/EJB3MDBExample.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./output/lib/mdb-example.${ej3-extension}" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send">
+ <!-- MDBExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.ejb3mdb.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-example.${ej3-extension}" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="EJB3MDBExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="ej3-extension" value="jar"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the EJB3 MDB example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="init" >
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib/META-INF" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF" filtering="true">
+ <fileset dir="./etc/META-INF" includes="*" />
+ <filterset>
+ <filter token="QUEUE_NAME" value="${example.queue.name}" />
+ </filterset>
+ </copy>
+ <jar destfile="./output/lib/mdb-example.${ej3-extension}" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/EJB3MDBExample.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./etc/mdb-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="./output/lib/mdb-example.${ej3-extension}" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send">
+ <!-- MDBExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.ejb3mdb.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-example.${ej3-extension}" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 892 2006-04-18 23:48:09Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/mdb-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/mdb-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/etc/mdb-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/EJB3MDBExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,104 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.ejb3mdb;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+
+import javax.naming.InitialContext;
+import javax.jms.TextMessage;
+import javax.jms.Session;
+import javax.jms.MessageListener;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.Connection;
+import javax.jms.MessageProducer;
+
+/**
+ * A MDB3 EJB example.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: EJB3MDBExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+ at MessageDriven(activationConfig =
+{
+ @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName="destination", propertyValue="queue/testQueue"),
+ @ActivationConfigProperty(propertyName="DLQMaxResent", propertyValue="10")
+})
+public class EJB3MDBExample implements MessageListener
+{
+ public void onMessage(Message m)
+ {
+ businessLogic(m);
+ }
+
+ private void businessLogic(Message m)
+ {
+ Connection conn = null;
+ Session session = null;
+
+ try
+ {
+ TextMessage tm = (TextMessage)m;
+
+ String text = tm.getText();
+ System.out.println("message " + text + " received");
+
+ // flip the string
+ String result = "";
+ for(int i = 0; i < text.length(); i++)
+ {
+ result = text.charAt(i) + result;
+ }
+
+ System.out.println("message processed, result: " + result);
+
+
+ InitialContext ic = new InitialContext();
+ ConnectionFactory cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+ ic.close();
+
+ conn = cf.createConnection();
+ conn.start();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Destination replyTo = m.getJMSReplyTo();
+ MessageProducer producer = session.createProducer(replyTo);
+ TextMessage reply = session.createTextMessage(result);
+
+ producer.send(reply);
+ producer.close();
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ System.out.println("The Message Driven Bean failed!");
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ try
+ {
+ conn.close();
+ }
+ catch(Exception e)
+ {
+ System.out.println("Could not close the connection!" +e);
+ }
+ }
+ }
+ }
+}
+
+
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ejb3mdb/src/org/jboss/example/jms/ejb3mdb/Sender.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,133 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.ejb3mdb;
+
+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;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example deploys a simple EJB3 Message Driven Bean that processes messages sent to a test
+ * queue. Once it receives a message and "processes" it, the MDB sends an acknowledgment message to
+ * a temporary destination created by the sender for this purpose. The example is considered
+ * successful if the sender receives the acknowledgment message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: Sender.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class Sender extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+
+ InitialContext ic = new InitialContext();
+
+
+ ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+
+
+
+ log("Queue " + destinationName + " exists");
+
+
+
+ Connection connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(queue);
+
+
+
+ Queue temporaryQueue = session.createTemporaryQueue();
+ MessageConsumer consumer = session.createConsumer(temporaryQueue);
+
+
+
+ TextMessage message = session.createTextMessage("Hello!");
+ message.setJMSReplyTo(temporaryQueue);
+
+
+
+ sender.send(message);
+
+
+
+ log("The " + message.getText() + " message was successfully sent to the " + queue.getQueueName() + " queue");
+
+
+
+ connection.start();
+
+
+
+ message = (TextMessage)consumer.receive(5000);
+
+
+ if (message == null)
+ {
+ throw new Exception("Have not received any reply. The example failed!");
+ }
+
+
+ log("Received message: " + message.getText());
+
+
+
+ assertEquals("!olleH", message.getText());
+
+
+
+ displayProviderInfo(connection.getMetaData());
+
+
+
+ connection.close();
+ }
+
+
+
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new Sender().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/examples.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/examples.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/examples.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,2 @@
+messaging.client.jar.path=../../../output/lib
+remoting.path=../../../src/etc/remoting
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,166 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - HTTP Transport</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging HTTP Transport Example</h1>
+$Revision: 5394 $
+<h2>Overview</h2>
+<p>
+This example shows how to configure a ConnectionFactory to send
+messages using the HTTP protocol. The example will use
+such a ConnectionFactory to create two JMS connections: the first one
+to send a message to the queue and the second one to read the message
+from the queue. In both cases, the message will be sent over
+an HTTP connection. The example is considered successful
+if the client receives without any error the message that was
+previously sent to the queue.</p>
+<p>
+This example needs to have access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed.
+</p>
+<br>
+This example also needs to have access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from an unzipped installation bundle, the example run script is
+correctly configured to find the client jar. Otherwise, you must modify
+example's <span style="font-family: monospace;">build.xml</span>
+accordingly.<br>
+<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\jboss-4.2.0.GA</span><br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <span style="font-family: monospace;">cd
+...\examples\http</span><br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<span style="font-family: monospace;"></span><br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <span style="font-family: monospace;">ant</span><br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+<pre>
+$ ant
+Buildfile: build.xml
+
+identify:
+ [echo] ############################################################################
+ [echo] # Running the HTTP example #
+ [echo] ############################################################################
+ [echo] The queue: testQueue
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: C:\java\messaging\docs\examples\http\output\classes
+ [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+ [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+ [javac] Compiling 1 source file to C:\java\messaging\docs\examples\http\output\classes
+
+deploy:
+ [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy
+
+sleep:
+ [echo] Sleeping for 10 seconds ...
+
+run:
+ [java] Queue /queue/testQueue exists
+ [java] The message was successfully sent to the testQueue queue
+ [java] Received message: Hello!
+ [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+undeploy:
+ [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\messaging-http-service.xml
+
+BUILD SUCCESSFUL
+Total time: 14 seconds</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<h2>Troubleshooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5559 2008-12-22 08:58:16Z gaohoward $
+
+ -->
+
+<project name="HttpExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="remoting.path" value="../config" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="############################################################################" />
+ <echo message="# Running the HTTP example #" />
+ <echo message="############################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="init" >
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="${remoting.path}/remoting-http-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <copy file="./etc/messaging-http-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="10" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.http.HttpExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-http-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-http-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="HttpExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="remoting.path" value="../config" />
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+
+ <target name="identify">
+ <echo message="############################################################################" />
+ <echo message="# Running the HTTP example #" />
+ <echo message="############################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="init" >
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="${remoting.path}/remoting-http-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <copy file="./etc/messaging-http-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="10" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.http.HttpExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-http-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-http-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
+java.naming.provider.url=http://localhost:8080/invoker/JNDIFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 952 2006-05-17 19:26:54Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/messaging-http-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/messaging-http-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/messaging-http-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ HTTP Transport Example.
+
+ $Id: messaging-http-service.xml 2773 2007-06-12 13:31:30Z sergeypk $
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+ name="jboss.messaging.destination:service=HttpConnectionFactory"
+ xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=http</depends>
+ <attribute name="JNDIBindings">
+ <bindings>
+ <binding>/HttpConnectionFactory</binding>
+ </bindings>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/example/jms/http/HttpExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/example/jms/http/HttpExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/http/src/org/jboss/example/jms/http/HttpExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.http;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+
+/**
+ * The example creates a connection to the default provider and uses the connection to send a
+ * message to the queue "queue/testQueue". Then, the example creates a second connection to the
+ * provider and uses it to receive the message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: HttpExample.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class HttpExample extends ExampleSupport
+{
+
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+ ConnectionFactory cf = null;
+ Connection connection = null;
+ Connection connection2 = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/HttpConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+ log("Queue " + destinationName + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(queue);
+
+ TextMessage message = session.createTextMessage("Hello!");
+ sender.send(message);
+ log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+
+ connection2 = cf.createConnection();
+ Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session2.createConsumer(queue);
+
+ connection2.start();
+
+ message = (TextMessage)consumer.receive(2000);
+ log("Received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ displayProviderInfo(connection2.getMetaData());
+
+ }
+ finally
+ {
+ if(ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ //ALWAYS close your connection in a finally block to avoid leaks
+ //Closing connection also takes care of closing its related objects e.g. sessions
+ closeConnection(connection);
+ closeConnection(connection2);
+ }
+ }
+
+ private void closeConnection(Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " +jmse);
+ }
+ }
+
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new HttpExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,145 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Message Driven Bean</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Message Driven Bean Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example deploys a simple Message Driven Bean that processes
+messages sent to a test queue. Once it receives a message and
+"processes" it, the MDB sends an acknowledgment message to a
+temporary destination created by the sender for this purpose. The
+example is considered successful if the sender receives the
+acknowledgment message.<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed.<br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from
+an unzipped installation bundle, the example run script is correctly
+configured to find the client jar. Otherwise, you must modify example's
+<span style="font-family: monospace;">build.xml</span>
+accordingly. <br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA.</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\mdb</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+<pre>$ ant
+Buildfile: build.xml
+
+identify:
+ [echo] ###########################################################################
+ [echo] # Running the MDB example #
+ [echo] ###########################################################################
+ [echo] The queue: testQueue
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: C:\java\messaging\docs\examples\mdb\output\classes\META-INF
+ [mkdir] Created dir: C:\java\messaging\docs\examples\mdb\output\lib\META-INF
+ [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+ [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+ [javac] Compiling 2 source files to C:\java\messaging\docs\examples\mdb\output\classes
+
+jar:
+ [copy] Copying 2 files to C:\java\messaging\docs\examples\mdb\output\classes\META-INF
+ [jar] Building jar: C:\java\messaging\docs\examples\mdb\output\lib\mdb-example.jar
+
+deploy:
+ [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy
+
+sleep:
+ [echo] Sleeping for 5 seconds ...
+
+run:
+
+send:
+ [java] Queue /queue/testQueue exists
+ [java] The Hello! message was successfully sent to the testQueue queue
+ [java] Received message: !olleH
+ [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+undeploy:
+ [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\mdb-example.jar
+
+BUILD SUCCESSFUL
+Total time: 10 seconds
+</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+
+<br style="font-family: courier new,courier,monospace;">
+<hr
+ style="width: 100%; height: 2px; font-family: courier new,courier,monospace;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5559 2008-12-22 08:58:16Z gaohoward $
+
+ -->
+
+<project name="MDBExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="ej3-extension" value="ejb3"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the MDB example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib/META-INF" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF" filtering="true">
+ <fileset dir="./etc/META-INF" includes="*" />
+ <filterset>
+ <filter token="QUEUE_NAME" value="${example.queue.name}" />
+ </filterset>
+ </copy>
+ <jar destfile="./output/lib/mdb-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/MDBExample.class">
+ </jar>
+ </target>
+
+ <target name="ear" depends="jar">
+ <jar destfile="./output/lib/mdb-example.ear">
+ <zipfileset dir="./output/lib" includes="mdb-example.jar" />
+ <zipfileset dir="./etc/EAR-META-INF" prefix="META-INF" />
+ </jar>
+ </target>
+
+ <target name="deploy" depends="ear">
+ <copy file="./output/lib/mdb-example.ear" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send">
+ <!-- MDBExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.mdb.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-example.ear" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="MDBExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="ej3-extension" value="jar"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the MDB example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib/META-INF" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF" filtering="true">
+ <fileset dir="./etc/META-INF" includes="*" />
+ <filterset>
+ <filter token="QUEUE_NAME" value="${example.queue.name}" />
+ </filterset>
+ </copy>
+ <jar destfile="./output/lib/mdb-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/MDBExample.class">
+ </jar>
+ </target>
+
+ <target name="ear" depends="jar">
+ <jar destfile="./output/lib/mdb-example.ear">
+ <zipfileset dir="./output/lib" includes="mdb-example.jar" />
+ <zipfileset dir="./etc/EAR-META-INF" prefix="META-INF" />
+ </jar>
+ </target>
+
+ <target name="deploy" depends="ear">
+ <copy file="./etc/mdb-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="./output/lib/mdb-example.ear" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send">
+ <!-- MDBExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.mdb.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-example.ear" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/application.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/application.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/application.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE application PUBLIC
+ "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+ "http://java.sun.com/dtd/application_1_3.dtd">
+
+<application>
+
+ <display-name>MDB Example</display-name>
+ <module>
+ <ejb>mdb-example.jar</ejb>
+ </module>
+
+</application>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/jboss-app.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/jboss-app.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/EAR-META-INF/jboss-app.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!DOCTYPE jboss-app
+ PUBLIC "-//JBoss//DTD J2EE Application 4.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
+
+<jboss-app>
+ <loader-repository>org.jboss.messaging.examples:loader=mdb-example.ear</loader-repository>
+</jboss-app>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/ejb-jar.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/ejb-jar.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/ejb-jar.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+ "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>MDBExample</ejb-name>
+ <ejb-class>org.jboss.example.jms.mdb.MDBExample</ejb-class>
+ <transaction-type>Container</transaction-type>
+ <message-driven-destination>
+ <destination-type>javax.jms.Queue</destination-type>
+ </message-driven-destination>
+ </message-driven>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/jboss.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/jboss.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/META-INF/jboss.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+ "-//JBoss//DTD JBOSS 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>MDBExample</ejb-name>
+ <destination-jndi-name>queue/@QUEUE_NAME@</destination-jndi-name>
+ </message-driven>
+ </enterprise-beans>
+
+</jboss>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 06:28:39Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/mdb-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/mdb-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/etc/mdb-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/MDBExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,167 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.mdb;
+
+import javax.ejb.EJBException;
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: MDBExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class MDBExample implements MessageDrivenBean, MessageListener
+{
+ private MessageDrivenContext ctx;
+
+ private ConnectionFactory cf = null;
+
+ public void onMessage(Message m)
+ {
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ TextMessage tm = (TextMessage)m;
+
+ String text = tm.getText();
+ System.out.println("message " + text + " received");
+ String result = process(text);
+ System.out.println("message processed, result: " + result);
+
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Destination replyTo = m.getJMSReplyTo();
+ MessageProducer producer = session.createProducer(replyTo);
+ TextMessage reply = session.createTextMessage(result);
+
+ producer.send(reply);
+ producer.close();
+
+ }
+ catch(Exception e)
+ {
+ ctx.setRollbackOnly();
+ e.printStackTrace();
+ System.out.println("The Message Driven Bean failed!");
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ try
+ {
+ closeConnection(conn);
+ }
+ catch(Exception e)
+ {
+ System.out.println("Could not close the connection!" +e);
+ }
+ }
+ }
+ }
+
+ private String process(String text)
+ {
+ // flip the string
+
+ String result = "";
+
+ for(int i = 0; i < text.length(); i++)
+ {
+ result = text.charAt(i) + result;
+ }
+ return result;
+ }
+
+ public Connection getConnection() throws Exception
+ {
+ Connection connection = null;
+
+ try
+ {
+ connection = cf.createConnection();
+ connection.start();
+ }
+ catch(Exception e )
+ {
+ if(connection != null)
+ {
+ closeConnection(connection);
+ }
+ System.out.println("Failed to get connection...exception is " + e);
+ throw e;
+ }
+
+ return connection;
+ }
+
+ public void closeConnection(Connection con) throws Exception
+ {
+ try
+ {
+ con.close();
+ }
+ catch(JMSException e)
+ {
+ System.out.println("Could not close connection " + con + " exception was " + e);
+ }
+ }
+
+ public void ejbCreate()
+ {
+ try
+ {
+ InitialContext ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ throw new EJBException("Failure to get connection factory: " + e.getMessage());
+ }
+ }
+
+ public void ejbRemove() throws EJBException
+ {
+ try
+ {
+ if(cf != null)
+ {
+ cf = null;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new EJBException("ejbRemove", e);
+ }
+ }
+
+ public void setMessageDrivenContext(MessageDrivenContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/Sender.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/Sender.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb/src/org/jboss/example/jms/mdb/Sender.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.mdb;
+
+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;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example deploys a simple Message Driven Bean that processes messages sent to a test queue.
+ * Once it receives a message and "processes" it, the MDB sends an acknowledgment message to a
+ * temporary destination created by the sender for this purpose. The example is considered
+ * successful if the sender receives the acknowledgment message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: Sender.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class Sender extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = new InitialContext();
+
+ ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+
+ log("Queue " + destinationName + " exists");
+
+ Connection connection = null;
+
+ try
+ {
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(queue);
+
+ Queue temporaryQueue = session.createTemporaryQueue();
+ MessageConsumer consumer = session.createConsumer(temporaryQueue);
+
+ TextMessage message = session.createTextMessage("Hello!");
+ message.setJMSReplyTo(temporaryQueue);
+
+ sender.send(message);
+
+ log("The " + message.getText() + " message was successfully sent to the " + queue.getQueueName() + " queue");
+
+ connection.start();
+
+ message = (TextMessage)consumer.receive(5000);
+
+ if (message == null)
+ {
+ throw new Exception("Have not received any reply. The example failed!");
+ }
+
+ log("Received message: " + message.getText());
+
+ assertEquals("!olleH", message.getText());
+
+ displayProviderInfo(connection.getMetaData());
+ }
+ finally
+ {
+ if (connection != null)
+ {
+ connection.close();
+ }
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new Sender().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,148 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Message Driven Bean Failure</title>
+</head>
+<body>
+<br>
+<h1>Message Driven Bean Behavior on Failure Example</h1>
+$Revision: 1459 $
+<h2>Overview</h2>
+<br>
+This example deploys a simple Message Driven Bean that processes
+messages sent to a test queue. The Message Driven Bean is coded in such
+a way that upon the first arrival of a message, it throws a
+RuntimeException, simulating a runtime processing failure. <br>
+<br>
+The expected behavior of the MDB Container is to try to redeliver the
+message, which is what it hopefully does. Since the example framework
+took the precaution to insure that there is only one single type of MDB
+container listening on the example queue, the messages will be
+redelivered to an MDB of the same type. Upon the second arrival, the
+MDB
+instance will "let the message pass", will correctly "process" it and
+forward the result to temporary queue created by the sender for exactly
+this purpose. The
+example is considered successful if the sender receives the
+acknowledgment message. The successful example proves that message
+redelivery on failure works.<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed.<br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from
+an unzipped installation bundle, the example run script is correctly
+configured to find the client jar. Otherwise, you must modify example's
+<span style="font-family: monospace;">build.xml</span>
+accordingly. <br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\jboss-4.2.0.GA</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\mdb-failure</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+<pre>
+$ ant
+Buildfile: build.xml
+
+identify:
+ [echo] ###########################################################################
+ [echo] # Running the MDB Failure example #
+ [echo] ###########################################################################
+ [echo] The queue: testQueue
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: C:\java\messaging\docs\examples\mdb-failure\output\classes\META-INF
+ [mkdir] Created dir: C:\java\messaging\docs\examples\mdb-failure\output\lib\META-INF
+ [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+ [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+ [javac] Compiling 2 source files to C:\java\messaging\docs\examples\mdb-failure\output\classes
+ [javac] Note: C:\java\messaging\docs\examples\mdb-failure\src\org\jboss\example\jms\mdbfailure\MDBFailureExample.java uses unchecked or unsafe operations.
+ [javac] Note: Recompile with -Xlint:unchecked for details.
+
+jar:
+ [copy] Copying 2 files to C:\java\messaging\docs\examples\mdb-failure\output\classes\META-INF
+ [jar] Building jar: C:\java\messaging\docs\examples\mdb-failure\output\lib\mdb-failure-example.jar
+
+deploy:
+ [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy
+
+sleep:
+ [echo] Sleeping for 5 seconds ...
+
+run:
+
+send:
+ [java] Queue /queue/testQueue exists
+ [java] The "Hello!" message was successfully sent to the testQueue queue
+ [java] Received message: !olleH
+ [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+sleep:
+ [echo] Sleeping for 10 seconds ...
+
+undeploy:
+ [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\mdb-failure-example.jar
+
+BUILD SUCCESSFUL
+Total time: 19 seconds
+</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<br>
+<br style="font-family: courier new,courier,monospace;">
+<hr
+ style="width: 100%; height: 2px; font-family: courier new,courier,monospace;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 974 2006-05-23 03:35:38Z ovidiu $
+
+ -->
+
+<project name="MDBFailureExample" default="run">
+
+ <property environment="ENV" />
+
+ <property name="undeploy.quiet" value="false" />
+ <property name="undeploy.failonerror" value="true" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="ej3-extension" value="ejb3"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the MDB Failure example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib/META-INF" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF" filtering="true">
+ <fileset dir="./etc/META-INF" includes="*" />
+ <filterset>
+ <filter token="QUEUE_NAME" value="${example.queue.name}" />
+ </filterset>
+ </copy>
+ <jar destfile="./output/lib/mdb-failure-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/MDBFailureExample.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./output/lib/mdb-failure-example.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="10" />
+ </antcall>
+ <antcall target="undeploy">
+ <param name="undeploy.quiet" value="false" />
+ <param name="undeploy.failonerror" value="true" />
+ </antcall>
+ </target>
+
+ <target name="send">
+ <!-- MDBFailureExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.mdbfailure.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-failure-example.jar" quiet="${undeploy.quiet}" failonerror="${undeploy.failonerror}" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 974 2006-05-23 03:35:38Z ovidiu $
+
+ -->
+
+<project name="MDBFailureExample" default="run">
+
+ <property environment="ENV" />
+
+ <property name="undeploy.quiet" value="false" />
+ <property name="undeploy.failonerror" value="true" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="ej3-extension" value="jar"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the MDB Failure example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib/META-INF" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF" filtering="true">
+ <fileset dir="./etc/META-INF" includes="*" />
+ <filterset>
+ <filter token="QUEUE_NAME" value="${example.queue.name}" />
+ </filterset>
+ </copy>
+ <jar destfile="./output/lib/mdb-failure-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/**/MDBFailureExample.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./etc/mdb-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="./output/lib/mdb-failure-example.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="10" />
+ </antcall>
+ <antcall target="undeploy">
+ <param name="undeploy.quiet" value="false" />
+ <param name="undeploy.failonerror" value="true" />
+ </antcall>
+ </target>
+
+ <target name="send">
+ <!-- MDBFailureExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.mdbfailure.Sender" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-failure-example.jar" quiet="${undeploy.quiet}" failonerror="${undeploy.failonerror}" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/mdb-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/ejb-jar.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/ejb-jar.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/ejb-jar.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,26 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+ "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>MDBFailureExample</ejb-name>
+ <ejb-class>org.jboss.example.jms.mdbfailure.MDBFailureExample</ejb-class>
+ <transaction-type>Container</transaction-type>
+ <message-driven-destination>
+ <destination-type>javax.jms.Queue</destination-type>
+ </message-driven-destination>
+ </message-driven>
+ </enterprise-beans>
+
+ <assembly-descriptor>
+ <container-transaction>
+ <method>
+ <ejb-name>MDBFailureExample</ejb-name>
+ <method-name>*</method-name>
+ </method>
+ <trans-attribute>Required</trans-attribute>
+ </container-transaction>
+ </assembly-descriptor>
+</ejb-jar>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/jboss.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/jboss.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/META-INF/jboss.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+ "-//JBoss//DTD JBOSS 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+
+ <enterprise-beans>
+ <message-driven>
+ <ejb-name>MDBFailureExample</ejb-name>
+ <destination-jndi-name>queue/@QUEUE_NAME@</destination-jndi-name>
+ </message-driven>
+ </enterprise-beans>
+
+</jboss>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 06:28:39Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/mdb-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/mdb-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/etc/mdb-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/MDBFailureExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,207 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.mdbfailure;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ejb.EJBException;
+import javax.ejb.MessageDrivenBean;
+import javax.ejb.MessageDrivenContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 849 $</tt>
+
+ * $Id: MDBFailureExample.java 849 2006-03-31 17:17:09Z ltexier $
+ */
+public class MDBFailureExample implements MessageDrivenBean, MessageListener
+{
+
+ private MessageDrivenContext ctx;
+
+ private ConnectionFactory cf = null;
+
+ private static Set messageIDs = new HashSet();
+
+ public void onMessage(Message m)
+ {
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+
+ TextMessage tm = (TextMessage)m;
+
+ String text = tm.getText();
+
+ System.out.println("message " + text + " received");
+
+ System.out.println("message " + (tm.getJMSRedelivered() ? "" : "NOT ")+ "marked as \"redelivered\"");
+
+
+ // if it is the first time any of the MDB instances from the pool sees the message, the
+ // message will cause the MDB instance to "crash"
+
+ synchronized(messageIDs)
+ {
+ if (!messageIDs.contains(tm.getJMSMessageID()))
+ {
+ messageIDs.add(m.getJMSMessageID());
+
+ System.out.println("The message has \"broken\" our MDB ...");
+
+ // "crashing" the MDB. The exception won't be caught by our catch clause and it will
+ // bubble up
+
+ throw new RuntimeException("Unfortunate events happen ...");
+
+ }
+ else
+ {
+ System.out.println("The message is already \"known\", so let it be processed");
+ }
+ }
+
+ String result = process(text);
+ System.out.println("message processed, result: " + result);
+
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Destination replyTo = m.getJMSReplyTo();
+ MessageProducer producer = session.createProducer(replyTo);
+ TextMessage reply = session.createTextMessage(result);
+
+ producer.send(reply);
+ producer.close();
+
+ }
+ catch(JMSException e)
+ {
+ ctx.setRollbackOnly();
+ e.printStackTrace();
+ System.out.println("The Message Driven Bean failed!");
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ try
+ {
+ closeConnection(conn);
+ }
+ catch(Exception e)
+ {
+ System.out.println("Could not close the connection!" +e);
+ }
+ }
+ }
+ }
+
+ private String process(String text)
+ {
+ // flip the string
+
+ String result = "";
+
+ for(int i = 0; i < text.length(); i++)
+ {
+ result = text.charAt(i) + result;
+ }
+ return result;
+ }
+
+ public Connection getConnection() throws JMSException
+ {
+
+ Connection connection = null;
+
+ try
+ {
+ connection = cf.createConnection();
+ connection.start();
+
+ }
+ catch(JMSException e)
+ {
+ if(connection != null)
+ {
+ closeConnection(connection);
+ }
+ System.out.println("Failed to get connection... exception is " + e);
+ throw e;
+ }
+
+ return connection;
+ }
+
+ public void closeConnection(Connection con) throws JMSException
+ {
+
+ try
+ {
+ con.close();
+
+ }
+ catch(JMSException jmse)
+ {
+ System.out.println("Could not close connection " + con +" exception was " +jmse);
+ throw jmse;
+ }
+ }
+
+ public void ejbCreate()
+ {
+ try
+ {
+ InitialContext ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ throw new EJBException("Failure to get connection factory: " + e.getMessage());
+ }
+ }
+
+ public void ejbRemove() throws EJBException
+ {
+ try
+ {
+ if(cf != null)
+ {
+ cf = null;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new EJBException("ejbRemove", e);
+ }
+ }
+
+ public void setMessageDrivenContext(MessageDrivenContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/mdb-failure/src/org/jboss/example/jms/mdbfailure/Sender.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,142 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.mdbfailure;
+
+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;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example deploys a simple Message Driven Bean that processes messages sent to a test queue.
+ * The MDB container is configured to use CMT.
+ *
+ * We send a special tagged message (we do this by adding a custom property to the message) to the
+ * MDB. The MDB is programmed to "fail" when handling such a message, by throwing a
+ * RuntimeException, but not before "clearing" the failure-inducing tag.
+ *
+ * The expected behavior for the JMS provider is to redeliver the message, this time without the
+ * "failure tag". The MDB is supposed to process it and put it on response queue, from were it will
+ * be read by the client.
+ *
+ * The example is considered successful if the client receives the "processed" message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 884 $</tt>
+ *
+ * $Id: Sender.java 884 2006-04-12 01:04:10Z ovidiu $
+ */
+public class Sender extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = new InitialContext();
+
+ ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+
+
+
+ log("Queue " + destinationName + " exists");
+
+
+
+ Connection connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(queue);
+
+
+
+ Queue temporaryQueue = session.createTemporaryQueue();
+ MessageConsumer consumer = session.createConsumer(temporaryQueue);
+
+
+
+ TextMessage message = session.createTextMessage("Hello!");
+ message.setJMSReplyTo(temporaryQueue);
+
+
+
+ sender.send(message);
+
+
+
+ log("The \"" + message.getText() + "\" message was successfully sent to the " + queue.getQueueName() + " queue");
+
+
+
+ connection.start();
+
+
+
+ message = (TextMessage)consumer.receive(5000);
+
+
+ if (message == null)
+ {
+ throw new Exception("Have not received any reply. The example failed!");
+ }
+
+
+ log("Received message: " + message.getText());
+
+
+
+ assertEquals("!olleH", message.getText());
+
+
+
+ displayProviderInfo(connection.getMetaData());
+
+
+ connection.close();
+ }
+
+
+
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+
+
+
+ public static void main(String[] args)
+ {
+ new Sender().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,142 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Ordering Group</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Ordering Group Example</h1>
+
+$Revision: 2750 $
+
+<h2>Overview</h2>
+
+<br>
+
+This example creates a JMS Connection to a JBoss Messaging instance and uses it to create a
+session and two message producers, one normal producer called 'producer1', the other producer
+called 'producer' is used to produce ordering group messages. Then both producers send 5 messages
+(producer1 sending 2 and producer 3) to "queue/testQueue". The example then starts two consumer
+threads to receive these messages. Once the messages are all received, it check the results.<br>
+<br>
+This example illustrates that ordering group messages will be delivered exactly in the same
+order as they are sent, even if the messages has different priorities and are consumed by
+multiple consumers at the same time.
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed. <br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from an unzipped installation bundle, the example run script is
+correctly configured to find the client jar. Otherwise, you must modify
+example's <span style="font-family: monospace;">build.xml</span>
+accordingly.<br>
+<br>
+<span style="font-style: italic;"></span>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA</span><br>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\ordering-group</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+<pre>
+Buildfile: build.xml
+
+identify:
+ [echo] ###########################################################################
+ [echo] # Running the OrderingGroup example #
+ [echo] ###########################################################################
+ [echo] The queue: testQueue
+ [echo] The client jar: ../..//jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: /home/howard/apps/jboss-messaging-1.4.0.SP3-CP08/examples/ordering-group/output/classes
+
+compile:
+ [javac] Compiling 2 source files to /home/howard/apps/jboss-messaging-1.4.0.SP3-CP08/examples/ordering-group/output/classes
+
+run:
+ [java] Queue /queue/testQueue exists
+ [java] Sending mormal message with lower priority 1
+ [java] Sending message with priority 0
+ [java] Sending message2 with priority 8
+ [java] Sending normal message with priority 7
+ [java] Sending message3 with priority 5
+ [java] The message was successfully sent to the testQueue queue
+ [java] len: 5
+ [java] The example connected to JBoss Messaging version 1.4.0.SP3-CP08 (1.4)
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+BUILD SUCCESSFUL
+Total time: 4 seconds
+
+</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 3140 2007-09-26 08:44:19Z ataylor $
+
+ -->
+
+<project name="OrderingGroupExample" default="run">
+
+ <property environment="ENV"/>
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties"/>
+ <property name="messaging.client.jar.path" value="../../"/>
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar"/>
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
+ <property name="jboss.configuration" value="messaging"/>
+ <property name="example.queue.name" value="testQueue"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath"/>
+ <pathelement path="../common/output/classes"/>
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/classes"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
+ <fileset file="${jboss.home}/client/jbossall-client.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################"/>
+ <echo message="# Running the OrderingGroup example #"/>
+ <echo message="###########################################################################"/>
+ <echo message="The queue: ${example.queue.name}"/>
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}"
+ unless="client.jar.present"/>
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes"/>
+ <mkdir dir="../common/output/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src"/>
+ <classpath refid="common.compilation.classpath"/>
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src"/>
+ <classpath refid="example.compilation.classpath"/>
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.ordering.OrderingGroupExample"
+ classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+ <sysproperty key="com.sun.management.jmxremote" value=""/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" quiet="true"/>
+ <delete dir="../common/output" quiet="true"/>
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 3140 2007-09-26 08:44:19Z ataylor $
+
+ -->
+
+<project name="OrderingGroupExample" default="run">
+
+ <property environment="ENV"/>
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################"/>
+ <echo message="# Running the OrderingGroup example #"/>
+ <echo message="###########################################################################"/>
+ <echo message="The queue: ${example.queue.name}"/>
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes"/>
+ <mkdir dir="../common/output/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src"/>
+ <classpath refid="common.compilation.classpath"/>
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src"/>
+ <classpath refid="example.compilation.classpath"/>
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.ordering.OrderingGroupExample"
+ classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+ <sysproperty key="com.sun.management.jmxremote" value=""/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" quiet="true"/>
+ <delete dir="../common/output" quiet="true"/>
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/ConsumerThread.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/ConsumerThread.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/ConsumerThread.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.ordering;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Destination;
+
+/**
+ *
+ * @author <a href="mailto:hgao at redhat.com">Howard Gao</a>
+ *
+ */
+public class ConsumerThread extends Thread
+{
+ private OrderingGroupExample example;
+ private Session session;
+ private MessageConsumer consumer;
+ private Connection connection;
+
+ public ConsumerThread(String name, OrderingGroupExample theExample, ConnectionFactory fact, Destination queue) throws JMSException
+ {
+ super(name);
+ example = theExample;
+
+ connection = fact.createConnection();
+ session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ consumer = session.createConsumer(queue);
+ connection.start();
+ }
+
+ public void delay(long nt)
+ {
+ try
+ {
+ Thread.sleep(nt);
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ //receiving the messages
+ public void run()
+ {
+ int n = example.getNumMessages();
+ try
+ {
+ while (true)
+ {
+ if (example.allReceived())
+ {
+ break;
+ }
+ TextMessage msg = (TextMessage)consumer.receive(2000);
+ if (msg != null)
+ {
+ if (msg.getText().equals(OrderingGroupExample.ORDERING_MSG1))
+ {
+ //whoever receives first message, delay for 2 sec.
+ delay(2000);
+ }
+ example.reportReceive(msg);
+ msg.acknowledge();
+ }
+ }
+ }
+ catch (JMSException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (session != null)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (JMSException e)
+ {
+ }
+ }
+ }
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/OrderingGroupExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/OrderingGroupExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/ordering-group/src/org/jboss/example/jms/ordering/OrderingGroupExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.ordering;
+
+import java.util.ArrayList;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Message;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.jms.client.JBossMessageProducer;
+
+/**
+ * This example creates a JMS Connection to a JBoss Messaging instance and uses it to create a
+ * session and two message producers, one normal producer called 'producer1', the other producer
+ * called 'producer' is used to produce ordering group messages. Then both producers send 5 messages
+ * (producer1 sending 2 and producer 3) to "queue/testQueue". The example then starts two consumer
+ * threads to receive these messages. Once the messages are all received, it check the results.
+ *
+ * This example illustrates that ordering group messages will be delivered exactly in the same
+ * order as they are sent, even if the messages has different priorities and are consumed by
+ * multiple consumers at the same time.
+ *
+ * @author <a href="mailto:hgao at redhat.com">Howard Gao</a>
+ *
+ */
+public class OrderingGroupExample extends ExampleSupport
+{
+ public static final String NORMAL_MSG = "Hello-normal";
+ public static final String NORMAL_MSG1 = "Hello-normal-1";
+ public static final String ORDERING_MSG1 = "Hello!";
+ public static final String ORDERING_MSG2 = "Hello-1!";
+ public static final String ORDERING_MSG3 = "Hello-2!";
+
+ private ArrayList<String> deliveryRecords = new ArrayList<String>();
+
+ private void checkResults() throws Exception
+ {
+ int len = deliveryRecords.size();
+ System.out.println("len: " + len);
+ assertEquals(5, len);
+
+ int n1 = deliveryRecords.indexOf(ORDERING_MSG1);
+ int n2 = deliveryRecords.indexOf(ORDERING_MSG2);
+ int n3 = deliveryRecords.indexOf(ORDERING_MSG3);
+
+ int flag = 1;
+ if ( (n1 < n2) && (n2 < n3) )
+ {
+ flag = 0;
+ }
+ assertEquals(0, flag);
+ }
+
+ public boolean allReceived()
+ {
+ synchronized(deliveryRecords)
+ {
+ return deliveryRecords.size() == 5;
+ }
+ }
+
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+ ConnectionFactory cf = null;
+ Connection connection = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+ log("Queue " + destinationName + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
+
+ JBossMessageProducer producer1 = (JBossMessageProducer)session.createProducer(queue);
+ TextMessage normalMsg = session.createTextMessage(NORMAL_MSG);
+ TextMessage normalMsg1 = session.createTextMessage(NORMAL_MSG1);
+
+ log("Sending mormal message with lower priority 1");
+ producer1.send(normalMsg1, Message.DEFAULT_DELIVERY_MODE, 1, Message.DEFAULT_TIME_TO_LIVE);
+
+ JBossMessageProducer producer = (JBossMessageProducer)session.createProducer(queue);
+ producer.enableOrderingGroup("MyOrderingGroup");
+
+ TextMessage message = session.createTextMessage(ORDERING_MSG1);
+ message.setJMSPriority(0);
+ log("Sending message with priority 0");
+ producer.send(message, Message.DEFAULT_DELIVERY_MODE, 5, Message.DEFAULT_TIME_TO_LIVE);
+
+ TextMessage message2 = session.createTextMessage(ORDERING_MSG2);
+ log("Sending message2 with priority 8");
+ producer.send(message2, Message.DEFAULT_DELIVERY_MODE, 6, Message.DEFAULT_TIME_TO_LIVE);
+
+ log("Sending normal message with priority 7");
+ producer1.send(normalMsg, Message.DEFAULT_DELIVERY_MODE, 7, Message.DEFAULT_TIME_TO_LIVE);
+
+ TextMessage message3 = session.createTextMessage(ORDERING_MSG3);
+ log("Sending message3 with priority 5");
+ producer.send(message3, Message.DEFAULT_DELIVERY_MODE, 8, Message.DEFAULT_TIME_TO_LIVE);
+
+ log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+
+ connection.start();
+ session.commit();
+
+ ConsumerThread client1 = new ConsumerThread("Client-1", this, cf, queue);
+ ConsumerThread client2 = new ConsumerThread("Client-2", this, cf, queue);
+
+ client1.start();
+ client2.start();
+
+ client1.join();
+ client2.join();
+
+ checkResults();
+
+ displayProviderInfo(connection.getMetaData());
+
+ }
+ finally
+ {
+ if(ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ // ALWAYS close your connection in a finally block to avoid leaks.
+ // Closing connection also takes care of closing its related objects e.g. sessions.
+ closeConnection(connection);
+ }
+ }
+
+ private void closeConnection(Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " + jmse);
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new OrderingGroupExample().run();
+ }
+
+ public void reportReceive(TextMessage msg) throws JMSException
+ {
+ synchronized(deliveryRecords)
+ {
+ deliveryRecords.add(msg.getText());
+ }
+ }
+
+ public int getNumMessages()
+ {
+ return 5;
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,132 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - JMS Queue</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Queue Example</h1>
+$Revision: 2750 $
+<h2>Overview</h2>
+<br>
+This example creates a JMS Connection to a JBoss Messaging instance
+and uses it to create a session and a message producer, which sends a
+message to the queue "queue/testQueue". Then, the example uses
+the same connection to create a consumer that that reads
+a single message from the queue. The example is considered successful
+if the message consumer receives without any error the message that was
+sent by the producer. <br>
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed. <br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from an unzipped installation bundle, the example run script is
+correctly configured to find the client jar. Otherwise, you must modify
+example's <span style="font-family: monospace;">build.xml</span>
+accordingly.<br>
+<br>
+<span style="font-style: italic;"></span>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA</span><br>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\queue</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+<pre>
+Buildfile: build.xml
+
+identify:
+ [echo] ###########################################################################
+ [echo] # Running the QUEUE example #
+ [echo] ###########################################################################
+ [echo] The queue: testQueue
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: C:\java\messaging\docs\examples\queue\output\classes
+ [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+ [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+ [javac] Compiling 1 source file to C:\java\messaging\docs\examples\queue\output\classes
+
+run:
+ [java] Queue /queue/testQueue exists
+ [java] The message was successfully sent to the testQueue queue
+ [java] Received message: Hello!
+ [java] The example connected to JBoss Messaging version 1.3.0.GA (1.3)
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+BUILD SUCCESSFUL
+Total time: 4 seconds
+</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5559 2008-12-22 08:58:16Z gaohoward $
+
+ -->
+
+<project name="QueueExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the QUEUE example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.queue.QueueExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5392 2008-11-20 00:41:52Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="QueueExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the QUEUE example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.queue.QueueExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2318 2007-02-15 02:11:43Z ovidiu.feodorov at jboss.com $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/example/jms/queue/QueueExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/example/jms/queue/QueueExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue/src/org/jboss/example/jms/queue/QueueExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.queue;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * This example creates a JMS Connection to a JBoss Messaging instance and uses it to create a
+ * session and a message producer, which sends a message to the queue "queue/testQueue". Then, the
+ * example uses the same connection to create a consumer that that reads a single message from the
+ * queue. The example is considered successful if the message consumer receives without any error
+ * the message that was sent by the producer.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:luc.texier at jboss.org">Luc Texier</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: QueueExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class QueueExample extends ExampleSupport
+{
+
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+ ConnectionFactory cf = null;
+ Connection connection = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+ log("Queue " + destinationName + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(queue);
+
+ TextMessage message = session.createTextMessage("Hello!");
+ sender.send(message);
+ log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ connection.start();
+
+ message = (TextMessage)consumer.receive(2000);
+
+ log("Received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ displayProviderInfo(connection.getMetaData());
+
+ }
+ finally
+ {
+ if(ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ // ALWAYS close your connection in a finally block to avoid leaks.
+ // Closing connection also takes care of closing its related objects e.g. sessions.
+ closeConnection(connection);
+ }
+ }
+
+ private void closeConnection(Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " + jmse);
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new QueueExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,230 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Queue failover</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Queue Failover Example</h1>
+$Revision: 1017 $
+<h2>Overview</h2>
+<br>
+This example demonstrates the transparent failover of a JMS consumer. A
+connection is made on one node of the cluster and two messages are
+sent. A consumer is created and one of the messages is consumed. The
+node the connection is connected to then fails and the connection fails
+over onto the second node. The second message is then consumed using
+the same consumer.<span style="font-weight: bold;"></span>
+<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+cluster with at least two nodes. The JBoss Messaging cluster must be
+installed and started according to the userguide.
+This example also relies on having access to the <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive included with the release bundle. If you run this example
+from
+an unzipped installation bundle, the example run script is correctly
+configured to find the client jar. Otherwise, you must modify example's
+<span style="font-family: monospace;">build.xml</span> accordingly.<br>
+<span style="font-style: italic;"></span><br>
+<br>
+<br><br>
+For JBoss5, you should copy all as messaging-node0, configure mysql as a database, make it clustered, and copy it as messaging-node1. Start each instance as:
+<br><br>
+./run -c messaging-node0 -Djboss.service.binding.set=ports-01
+<br><br>
+<br>
+and in another window
+<br><br>
+./run.sh -c messaging-node1 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=1
+<br><br>
+<h2>Running the example</h2>
+<span style="font-family: monospace;"></span><span
+ style="font-family: monospace;"></span><br>
+1. Make sure that a JBoss Messaging cluster with at least two nodes is
+up and running.<br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\queue-failover</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ <div style="margin-left: 40px;"><br>
+ </div>
+$ ant<br>
+Buildfile: build.xml<br>
+ <br>
+identify:
+ <br>
+ [echo]
+###########################################################################
+ <br>
+ [echo]
+#
+Running the QUEUE FAILOVER example
+
+ #
+ <br>
+ [echo]
+###########################################################################
+ <br>
+ [echo] The
+queue: testDistributedQueue
+ <br>
+ [echo] The client jar:
+../../../output/lib/jboss-messaging-client.jar
+ <br>
+ <br>
+sanity-check:
+ <br>
+ <br>
+init:
+ <br>
+ <br>
+compile:
+ <br>
+ <br>
+jar:
+ <br>
+ <br>
+deploy:
+ <br>
+ <br>
+sleep:
+ <br>
+ [echo] Sleeping for 5 seconds ...
+ <br>
+ <br>
+run:
+ <br>
+ [java] Distributed queue
+/queue/testDistributedQueue exists
+ <br>
+ [java] The messages were successfully sent to
+the distributed queue
+ <br>
+ [java] Received message: Hello1!
+ <br>
+ [java] 11:12:22,359 ERROR @Timer-0
+[SocketClientInvoker] Got marshalling exception, exiting
+ <br>
+ [java] java.io.IOException: Connection reset
+by peer: socket write error
+ <br>
+ [java] at
+java.net.SocketOutputStream.socketWrite0(Native Method)
+ <br>
+ [java] at
+java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
+ <br>
+ [java] at
+java.net.SocketOutputStream.write(SocketOutputStream.java:136)
+ <br>
+ [java] at
+java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
+ <br>
+ [java] at
+java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
+ <br>
+ [java] at
+java.io.DataOutputStream.flush(DataOutputStream.java:106)
+ <br>
+ [java] at
+org.jboss.serial.io.JBossObjectOutputStream.flush(JBossObjectOutputStream.java:248)
+ <br>
+ [java] at
+org.jboss.jms.server.remoting.JMSWireFormat.serialize(JMSWireFormat.java:1035)
+ <br>
+ [java] at
+org.jboss.jms.server.remoting.JMSWireFormat.write(JMSWireFormat.java:413)
+ <br>
+ [java] at
+org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedWrite(MicroSocketClientInvoker.java:518)
+ <br>
+ [java] at
+org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:340)
+ <br>
+ [java] at
+org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:125)
+ <br>
+ [java] at
+org.jboss.remoting.ConnectionValidator.checkConnection(ConnectionValidator.java:184)
+ <br>
+ [java] at
+org.jboss.remoting.ConnectionValidator.run(ConnectionValidator.java:114)
+ <br>
+ [java] at
+java.util.TimerThread.mainLoop(Timer.java:512)
+ <br>
+ [java] at
+java.util.TimerThread.run(Timer.java:462)
+ <br>
+ [java] 11:12:24,406 INFO @Thread-3
+[HAAspect] HAAspect.ClusteredClientConnectionFactoryDelegate[1]
+completed client-side failover
+ <br>
+ [java] Received message: Hello2!
+ <br>
+ [java] The example connected to JBoss
+Messaging version 1.2.0.Beta1 (1.2)
+ <br>
+ <br>
+ [java] #####################
+ <br>
+ [java] ###
+SUCCESS! ###
+ <br>
+ [java] #####################
+ <br>
+ <br>
+undeploy:
+ <br>
+ [delete] Deleting:
+C:\dev\jboss-4.0.5.GA\server\messaging-node0\deploy\application-server-killer.jar
+ <br>
+ <br>
+BUILD SUCCESSFUL
+ <br>
+Total time: 41 seconds
+ <br>
+ <br>
+ <br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 974 2006-05-22 21:35:38 -0600 (Mon, 22 May 2006) ovidiu $
+
+ -->
+
+<project name="QueueFailoverExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="example.queue.name" value="testDistributedQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the QUEUE FAILOVER example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/lib" />
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <jar destfile="./output/lib/application-server-killer.jar">
+ <fileset dir="../common/etc" includes="META-INF/**" />
+ <fileset dir="../common/output/classes" includes="org/jboss/example/jms/common/bean/*.class" />
+ </jar>
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./output/lib/application-server-killer.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+
+ <target name="run" depends="deploy">
+ <java classname="org.jboss.example.jms.failover.QueueFailoverExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/application-server-killer.jar" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 974 2006-05-22 21:35:38 -0600 (Mon, 22 May 2006) ovidiu $
+
+ -->
+
+<project name="QueueFailoverExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="jboss.configuration1" value="messaging-node1" />
+ <property name="example.queue.name" value="testDistributedQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the QUEUE FAILOVER example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/lib" />
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <jar destfile="./output/lib/application-server-killer.jar">
+ <fileset dir="../common/etc" includes="META-INF/**" />
+ <fileset dir="../common/output/classes" includes="org/jboss/example/jms/common/bean/*.class" />
+ </jar>
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="3" />
+ </antcall>
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration1}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="15" />
+ </antcall>
+ <copy file="./output/lib/application-server-killer.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+
+ <target name="run" depends="deploy">
+ <java classname="org.jboss.example.jms.failover.QueueFailoverExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/application-server-killer.jar" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration1}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,5 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+#Assuming ports-01 which binds jndi on 1199
+java.naming.provider.url=jnp://localhost:1199
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 00:28:39 -0600 (Thu, 22 Dec 2005) ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testDistributedQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="Clustered">true</attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/queue-failover/src/org/jboss/example/jms/failover/QueueFailoverExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,162 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.example.jms.failover;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates a connection to a clustered messaging instance and sends a message to a
+ * clustered queue. The example then kills the cluster node the connection was created to and then
+ * shows how the client code can receive the message with using the *same* connection (that, in
+ * the mean time, have transparently failed over to another cluster node).
+ *
+ * Since this example is also used as a smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 1001 $</tt>
+ *
+ * $Id: TopicExample.java 1001 2006-06-24 09:05:40Z timfox $
+ */
+public class QueueFailoverExample extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+
+ Connection connection = null;
+
+
+ ConnectionFactory cf = null;
+
+ try
+ {
+ // Create a connection to the clustered messaging instance
+
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ClusteredConnectionFactory");
+
+ Queue distributedQueue = (Queue)ic.lookup(destinationName);
+ log("Distributed queue " + destinationName + " exists");
+
+ // When connecting to a messaging cluster, the ConnectionFactory has the capability of
+ // transparently creating physical connections to different cluster nodes, in a round
+ // robin fashion ...
+
+ connection = cf.createConnection();
+
+ connection.start();
+
+ // Send 2 messages to the queue
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer producer = session.createProducer(distributedQueue);
+
+ TextMessage message1 = session.createTextMessage("Hello1!");
+
+ producer.send(message1);
+
+ TextMessage message2 = session.createTextMessage("Hello2!");
+
+ producer.send(message2);
+
+ log("The messages were successfully sent to the distributed queue");
+
+ // Now receive one of the messages
+
+ MessageConsumer consumer = session.createConsumer(distributedQueue);
+
+ TextMessage rm1 = (TextMessage)consumer.receive(2000);
+
+ log("Received message: " + rm1.getText());
+
+ assertEquals("Hello1!", rm1.getText());
+
+ // Kill the active node
+ killActiveNode();
+
+ Thread.sleep(5000);
+
+ // receive the second message on the failed over node
+
+ TextMessage rm2 = (TextMessage)consumer.receive(2000);
+ log("Received message: " + rm2.getText());
+
+
+ assertEquals("Hello2!", rm2.getText());
+
+ displayProviderInfo(connection.getMetaData());
+ }
+ finally
+ {
+ if (ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ try
+ {
+ if (connection != null)
+ {
+ connection.close();
+ }
+ }
+ catch(JMSException e)
+ {
+ log("Could not close connection " + connection + ", exception was " + e);
+ throw e;
+ }
+
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new QueueFailoverExample().run();
+ }
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,251 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Secure Socket example</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Secure Socket Connection Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example shows how to use a secure ConnectionFactory, which creates
+a SSL socket connection between client and server. The example will use
+such a ConnectionFactory to create two JMS connections: the first one
+to send a message to the queue and the second one to read the message
+from the queue. In both cases, the message will be securely sent over
+an encrypted connection. The example is considered successful
+if the client receives without any error the message that was
+previously sent to the queue.<br>
+<br>
+This example needs to have access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed. <br>
+<span style="font-style: italic;"></span></div>
+<br>
+This example also needs to have access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from an unzipped installation bundle, the example run script is
+correctly configured to find the client jar. Otherwise, you must modify
+example's <span style="font-family: monospace;">build.xml</span>
+accordingly.<br>
+<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\jboss-4.2.0.GA</span><br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <span style="font-family: monospace;">cd
+...\examples\secure-socket</span><br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<span style="font-family: monospace;"></span><br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <span style="font-family: monospace;">ant</span><br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+$ ant<br>
+Buildfile: build.xml<br>
+ <br>
+identify:<br>
+ [echo]
+############################################################################<br>
+ [echo]
+#
+Running the SECURE SOCKET
+example
+#<br>
+ [echo]
+############################################################################<br>
+ [echo] The queue: testQueue<br>
+ <br>
+sanity-check:<br>
+ <br>
+init:<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\secure-socket\output<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+ <br>
+compile:<br>
+ [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+ [javac] Compiling 1 source file to
+C:\work\src\cvs\jboss-head\jms\docs\examples\secure-socket\output<br>
+ <br>
+deploy:<br>
+ [copy] Copying 1 file to
+C:\jboss-4.2.0.GA\server\messaging\deploy\jboss-messaging.sar<br>
+ [copy] Copying 1 file to
+C:\jboss-4.2.0.GA\server\messaging\deploy<br>
+ <br>
+sleep:<br>
+ [echo] Sleeping for 10 seconds ...<br>
+ <br>
+run:<br>
+ [java] Queue /queue/testQueue exists<br>
+ [java] The message was successfully sent to
+the testQueue queue<br>
+ [java] Received message: Hello!<br>
+ [java] The example connected to JBoss
+Messaging version 1.3.0.GA (1.0)<br>
+ <br>
+ [java] #####################<br>
+ [java] ###
+SUCCESS! ###<br>
+ [java] #####################<br>
+ <br>
+BUILD SUCCESSFUL<br>
+Total time: 15 seconds<br>
+ <br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<h2>Configuration details</h2>
+<br>
+The example client looks up a specially-configured connection factory (<span
+ style="font-family: monospace;">"/SecureConnectionFactory"</span>)
+that is deployed by the example run script. The secure
+ConnectionFactory relies on a "secured" Remoting Connector to provide
+the SSL connection. The definition of the required services is
+specified in the <span style="font-family: monospace;">etc/messaging-secure-socket-service.xml
+</span>deployment descriptor. <br>
+
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+The SSLSocketBuilder needs a keystore with a public/private key pair.
+The example provides one (<span style="font-family: monospace;">etc/messaging.keystore</span>)
+which is deployed with the rest of the artifacts. In case you need to
+create your own keystore, this is how you do it:<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <pre> keytool -genkey -alias messaging.keypair -keyalg RSA -keystore messaging.keystore -validity 3650</pre>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<p>By default, the client will try to contact a Certificate Authority
+to
+insure the authenticity of the public key it uses to encrypt the
+communication. However, the example's certificate is self-signed, so no
+Certificate Authority will
+recognize it. In order to get the SSL client to trust it and the
+example to complete successfully, we use a client truststore (<span
+ style="font-family: monospace;">/etc/messaging.truststore</span>). In
+case you need to create your own truststore, this is how you do it:<br>
+</p>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <pre> keytool -export -alias messaging.keypair -keystore messaging.keystore -rfc -file messaging.cer<br> keytool -import -alias messaging.keypair -file messaging.cer -keystore messaging.truststore</pre>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<p> </p>
+<p>In order for the truststore to be recognized, the client's
+environment must contain the <tt>javax.net.ssl.trustStore</tt> and <tt>javax.net.ssl.trustStorePassword</tt>
+properties.<br>
+</p>
+<br>
+<h2>Troubleshooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 7597 2009-07-21 14:49:14Z gaohoward $
+
+ -->
+
+<project name="SecureSocketExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="remoting.path" value="../config" />
+ <property name="messaging.client.jar.path" value="../.." />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="messaging-deploy" value="jboss-messaging.sar"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="############################################################################" />
+ <echo message="# Running the SECURE SOCKET example #" />
+ <echo message="############################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="init">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/messaging.keystore" todir="${jboss.home}/server/${jboss.configuration}/deploy/${messaging-deploy}" />
+ <copy file="${remoting.path}/remoting-sslbisocket-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <copy file="./etc/messaging-secure-socket-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.securesocket.SecureSocketExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="org.jboss.remoting.trustStorePassword" value="secureexample" />
+ <sysproperty key="org.jboss.remoting.trustStore" value="./etc/messaging.truststore" />
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-sslbisocket-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-secure-socket-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/${messaging-deploy}/messaging.keystore" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5419 2008-11-24 05:21:45Z gaohoward $
+
+ -->
+
+<project name="SecureSocketExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="remoting.path" value="../config" />
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <property name="messaging-deploy" value="messaging"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="############################################################################" />
+ <echo message="# Running the SECURE SOCKET example #" />
+ <echo message="############################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="init">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="./etc/messaging.keystore" todir="${jboss.home}/server/${jboss.configuration}/deploy/${messaging-deploy}" />
+ <copy file="${remoting.path}/remoting-sslbisocket-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <copy file="./etc/messaging-secure-socket-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.securesocket.SecureSocketExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="org.jboss.remoting.trustStorePassword" value="secureexample" />
+ <sysproperty key="org.jboss.remoting.trustStore" value="./etc/messaging.truststore" />
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-sslbisocket-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-secure-socket-service.xml" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/${messaging-deploy}/messaging.keystore" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 948 2006-05-17 01:24:49Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging-secure-socket-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging-secure-socket-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging-secure-socket-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Secure Socket Transport Example: the deployment descriptor for the secure socket factory
+ service, secure connector and secure connection factory.
+
+ $Id: messaging-secure-socket-service.xml 2773 2007-06-12 13:31:30Z sergeypk $
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+ name="jboss.messaging.destination:service=SecureConnectionFactory"
+ xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends optional-attribute-name="Connector">jboss.messaging:service=Connector,transport=sslbisocket</depends>
+ <attribute name="JNDIBindings">
+ <bindings>
+ <binding>/SecureConnectionFactory</binding>
+ </bindings>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging.keystore
===================================================================
(Binary files differ)
Property changes on: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging.keystore
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging.truststore
===================================================================
(Binary files differ)
Property changes on: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/messaging.truststore
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/secure-socket/src/org/jboss/example/jms/securesocket/SecureSocketExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.securesocket;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates a connection to the default provider and uses the connection to send a
+ * message to the queue "queue/testQueue". Then, the example creates a second connection to the
+ * provider and uses it to receive the message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: SecureSocketExample.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class SecureSocketExample extends ExampleSupport
+{
+
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+ ConnectionFactory cf = null;
+ Connection connection = null;
+ Connection connection2 = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/SecureConnectionFactory");
+ Queue queue = (Queue)ic.lookup(destinationName);
+ log("Queue " + destinationName + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(queue);
+
+ TextMessage message = session.createTextMessage("Hello!");
+ sender.send(message);
+ log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+
+ connection2 = cf.createConnection();
+ Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session2.createConsumer(queue);
+
+ connection2.start();
+
+ message = (TextMessage)consumer.receive(2000);
+ log("Received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ displayProviderInfo(connection2.getMetaData());
+ }
+ finally
+ {
+ if(ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ //ALWAYS close your connection in a finally block to avoid leaks
+ //Closing connection also takes care of closing its related objects e.g. sessions
+ closeConnection(connection);
+
+ closeConnection(connection2);
+
+ }
+
+ }
+
+ private void closeConnection(Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " +jmse);
+ }
+ }
+
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new SecureSocketExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,169 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Servlet Transport</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Servlet Transport Example</h1>
+$Revision: 5394 $
+<h2>Overview</h2>
+<p>
+This example shows how to configure a ConnectionFactory to send
+messages using the Servlet protocol. The example will use
+such a ConnectionFactory to create two JMS connections: the first one
+to send a message to the queue and the second one to read the message
+from the queue. In both cases, the message will be sent over
+an Servlet connection. The example is considered successful
+if the client receives without any error the message that was
+previously sent to the queue.</p>
+<p>
+This example needs to have access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However, the
+example will automatically deploy its own queue, unless a queue with
+the same name is already deployed.
+</p>
+<br>
+This example also needs to have access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from an unzipped installation bundle, the example run script is
+correctly configured to find the client jar. Otherwise, you must modify
+example's <span style="font-family: monospace;">build.xml</span>
+accordingly.<br>
+<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\jboss-4.2.0.GA</span><br>
+<br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <span style="font-family: monospace;">cd
+...\examples\servlet</span><br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<span style="font-family: monospace;"></span><br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; margin-left: 40px; background-color: rgb(255, 255, 255);"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;"><br>
+ <span style="font-family: monospace;">ant</span><br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+<pre>
+$ ant
+Buildfile: build.xml
+
+identify:
+ [echo] ############################################################################
+ [echo] # Running the Servlet example #
+ [echo] ############################################################################
+ [echo] The queue: testQueue
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: C:\java\messaging\docs\examples\http\output\classes
+ [mkdir] Created dir: C:\java\messaging\docs\examples\common\output\classes
+
+compile:
+ [javac] Compiling 5 source files to C:\java\messaging\docs\examples\common\output\classes
+ [javac] Compiling 1 source file to C:\java\messaging\docs\examples\http\output\classes
+
+deploy:
+ [copy] Copying 2 files to C:\jboss-4.2.0.GA\server\messaging\deploy
+ [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging\deploy
+
+sleep:
+ [echo] Sleeping for 10 seconds ...
+
+run:
+ [java] Queue /queue/testQueue exists
+ [java] The message was successfully sent to the testQueue queue
+ [java] Received message: Hello!
+ [java] The example connected to JBoss Messaging version 1.4.0.GA (1.4)
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+undeploy:
+ [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\messaging-servlet-service.xml
+ [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging\deploy\remoting-servlet-service.xml
+ [delete] Deleting directory C:\jboss-4.2.0.GA\server\messaging\deploy\servlet-invoker.war
+
+BUILD SUCCESSFUL
+Total time: 14 seconds</pre>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<h2>Troubleshooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 3140 2007-09-26 08:44:19Z ataylor $
+
+ -->
+
+<project name="ServletExample" default="run">
+
+ <property environment="ENV"/>
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties"/>
+ <property name="remoting.path" value="../config"/>
+ <property name="messaging.client.jar.path" value="../../"/>
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar"/>
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
+ <property name="jboss.configuration" value="messaging"/>
+ <property name="example.queue.name" value="testQueue"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath"/>
+ <pathelement path="../common/output/classes"/>
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/classes"/>
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
+ <fileset file="${jboss.home}/client/jbossall-client.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
+ </path>
+
+ <target name="identify">
+ <echo message="############################################################################"/>
+ <echo message="# Running the Servlet example #"/>
+ <echo message="############################################################################"/>
+ <echo message="The queue: ${example.queue.name}"/>
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}"
+ unless="client.jar.present"/>
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes"/>
+ <mkdir dir="../common/output/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src"/>
+ <classpath refid="common.compilation.classpath"/>
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src"/>
+ <classpath refid="example.compilation.classpath"/>
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy todir="${jboss.home}/server/${jboss.configuration}/deploy">
+ <fileset dir="${remoting.path}">
+ <include name="remoting-servlet-service.xml"/>
+ <include name="servlet-invoker.war/**/*"/>
+ </fileset>
+ </copy>
+ <copy file="./etc/messaging-servlet-service.xml"
+ todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
+ <antcall target="sleep"><param name="sleep.interval" value="10"/></antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.servlet.ServletExample"
+ classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+ <!--
+ <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"/>
+ -->
+ </java>
+ <antcall target="undeploy"/>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-servlet-service.xml" quiet="true"/>
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-servlet-service.xml" quiet="true"/>
+ <delete dir="${jboss.home}/server/${jboss.configuration}/deploy/servlet-invoker.war"/>
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true"/>
+ <delete dir="../common/output" quiet="true"/>
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..."/>
+ <sleep seconds="${sleep.interval}"/>
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 3140 2007-09-26 08:44:19Z ataylor $
+
+ -->
+
+<project name="ServletExample" default="run">
+
+ <property environment="ENV"/>
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="remoting.path" value="../config" />
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="############################################################################"/>
+ <echo message="# Running the Servlet example #"/>
+ <echo message="############################################################################"/>
+ <echo message="The queue: ${example.queue.name}"/>
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes"/>
+ <mkdir dir="../common/output/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src"/>
+ <classpath refid="common.compilation.classpath"/>
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src"/>
+ <classpath refid="example.compilation.classpath"/>
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy todir="${jboss.home}/server/${jboss.configuration}/deploy">
+ <fileset dir="${remoting.path}">
+ <include name="remoting-servlet-service.xml"/>
+ <include name="servlet-invoker.war/**/*"/>
+ </fileset>
+ </copy>
+ <copy file="./etc/messaging-servlet-service.xml"
+ todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
+ <antcall target="sleep"><param name="sleep.interval" value="10"/></antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- QueueExample expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.servlet.ServletExample"
+ classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+ <!--
+ <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"/>
+ -->
+ </java>
+ <antcall target="undeploy"/>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/messaging-servlet-service.xml" quiet="true"/>
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/remoting-servlet-service.xml" quiet="true"/>
+ <delete dir="${jboss.home}/server/${jboss.configuration}/deploy/servlet-invoker.war"/>
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true"/>
+ <delete dir="../common/output" quiet="true"/>
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..."/>
+ <sleep seconds="${sleep.interval}"/>
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
+java.naming.provider.url=http://localhost:8080/invoker/JNDIFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 952 2006-05-17 19:26:54Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/messaging-servlet-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/messaging-servlet-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/messaging-servlet-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Servlet Transport Example.
+
+ $Id: messaging-http-service.xml 2773 2007-06-12 13:31:30Z sergeypk $
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.connectionfactory.ConnectionFactory"
+ name="jboss.messaging.destination:service=ServletConnectionFactory"
+ xmbean-dd="xmdesc/ConnectionFactory-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends optional-attribute-name="Connector">jboss.remoting:service=Connector,transport=servlet,target=jms</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="JNDIBindings">
+ <bindings>
+ <binding>/ServletConnectionFactory</binding>
+ </bindings>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/example/jms/servlet/ServletExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/example/jms/servlet/ServletExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/servlet/src/org/jboss/example/jms/servlet/ServletExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,140 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.servlet;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+
+/**
+ * The example creates a connection to the default provider and uses the connection to send a
+ * message to the queue "queue/testQueue". Then, the example creates a second connection to the
+ * provider and uses it to receive the message.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: HttpExample.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class ServletExample extends ExampleSupport
+{
+
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+ ConnectionFactory cf = null;
+ Connection connection = null;
+ Connection connection2 = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("/ServletConnectionFactory");
+ log("ocnnection factory: " + cf);
+ Queue queue = (Queue)ic.lookup(destinationName);
+ log("Queue " + destinationName + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer sender = session.createProducer(queue);
+
+ TextMessage message = session.createTextMessage("Hello!");
+ sender.send(message);
+ log("The message was successfully sent to the " + queue.getQueueName() + " queue");
+
+ connection2 = cf.createConnection();
+ Session session2 = connection2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session2.createConsumer(queue);
+
+ connection2.start();
+
+ message = (TextMessage)consumer.receive(2000);
+ log("Received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ displayProviderInfo(connection2.getMetaData());
+
+ }
+ finally
+ {
+ if(ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ //ALWAYS close your connection in a finally block to avoid leaks
+ //Closing connection also takes care of closing its related objects e.g. sessions
+ closeConnection(connection);
+ closeConnection(connection2);
+ }
+ }
+
+ private void closeConnection(Connection con)
+ {
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " +jmse);
+ }
+ }
+
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new ServletExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,158 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Stateless Session Bean</title>
+</head>
+<body>
+<br>
+<h1>Sending JMS messages from a Stateless Session Bean<br>
+</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example deploys a stateless session bean that then sends and
+receives messages from a queue. This is a very simple example that
+demonstrates using JBoss Messaging in a managed environment. The
+session bean sends a message to a test queue and then pulls the message
+from the queue using a different connection. The
+example is considered successful if the message is received correctly.<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed. <br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from
+an unzipped installation bundle, the example run script is correctly
+configured to find the client jar. Otherwise, you must modify example's
+<span style="font-family: monospace;">build.xml</span>
+accordingly. <br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA.</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\stateless</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ <div style="margin-left: 40px;"><br>
+ </div>
+$ ant<br>
+Buildfile: build.xml<br>
+ <br>
+identify:<br>
+ [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+ [echo]
+X
+Running the STATELESS SESSION BEAN
+example
+X<br>
+ [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+ [echo] The queue: testQueue<br>
+ <br>
+sanity-check:<br>
+ <br>
+init:<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\classes\META-INF<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\lib<br>
+ <br>
+compile:<br>
+ [javac] Compiling 4 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\classes<br>
+ <br>
+jar:<br>
+ [copy] Copying 2 files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\classes\META-INF<br>
+ [jar] Building jar:
+C:\work\src\cvs\jboss-head\jms\docs\examples\stateless\output\lib\stateless-example.jar<br>
+ <br>
+deploy:<br>
+ [copy] Copying 1 file to
+C:\work\src\jboss-4.2.0.GA\build\output\jboss-4.0.3SP1\server\messaging\deploy<br>
+ <br>
+sleep:<br>
+ [echo] Sleeping for 5 seconds ...<br>
+ <br>
+run:<br>
+ <br>
+send-and-receive:<br>
+ [java] The Hello! message was successfully
+sent to the /queue/testQueue queue<br>
+ [java] Queue browse result: Hello!<br>
+ [java] Received Hello!<br>
+ <br>
+ [java] #####################<br>
+ [java] ###
+SUCCESS! ###<br>
+ [java] #####################<br>
+ <br>
+undeploy:<br>
+ [delete] Deleting:
+C:\work\src\jboss-4.2.0.GA\build\output\jboss-4.0.3SP1\server\messaging\deploy\stateless-example.jar<br>
+ <br>
+BUILD SUCCESSFUL<br>
+Total time: 9 seconds<br>
+ <br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5559 2008-12-22 08:58:16Z gaohoward $
+
+ -->
+
+<project name="StatelessExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the STATELESS SESSION BEAN example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF">
+ <fileset dir="./etc/META-INF" includes="*" />
+ </copy>
+ <jar destfile="./output/lib/stateless-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/jms/stateless/bean/*.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./output/lib/stateless-example.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send-and-receive" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send-and-receive">
+ <!-- The client expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.stateless.client.Client" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/stateless-example.jar" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5408 2008-11-21 04:43:36Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="StatelessExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.queue.name" value="testQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the STATELESS SESSION BEAN example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF">
+ <fileset dir="./etc/META-INF" includes="*" />
+ </copy>
+ <jar destfile="./output/lib/stateless-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/jms/stateless/bean/*.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="./output/lib/stateless-example.jar" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send-and-receive" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send-and-receive">
+ <!-- The client expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.stateless.client.Client" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/stateless-example.jar" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/ejb-jar.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/ejb-jar.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/ejb-jar.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+ "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+ <enterprise-beans>
+ <session>
+ <ejb-name>StatelessSessionExample</ejb-name>
+ <home>org.jboss.example.jms.stateless.bean.StatelessSessionExampleHome</home>
+ <remote>org.jboss.example.jms.stateless.bean.StatelessSessionExample</remote>
+ <ejb-class>org.jboss.example.jms.stateless.bean.StatelessSessionExampleBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/jboss.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/jboss.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/META-INF/jboss.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+ "-//JBoss//DTD JBOSS 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>StatelessSessionExample</ejb-name>
+ <jndi-name>ejb/StatelessSessionExample</jndi-name>
+ </session>
+ </enterprise-beans>
+</jboss>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 563 2005-12-30 22:04:19Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,29 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.stateless.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessSessionExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+
+public interface StatelessSessionExample extends EJBObject
+{
+ public void drain(String queueName) throws RemoteException, Exception;
+
+ public void send(String txt, String queueName) throws RemoteException, Exception;
+
+ public int browse(String queueName) throws RemoteException, Exception;
+
+ public String receive(String queueName) throws RemoteException, Exception;
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleBean.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,253 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.stateless.bean;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessSessionExampleBean.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class StatelessSessionExampleBean implements SessionBean
+{
+
+ private ConnectionFactory cf = null;
+
+ public void drain(String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ Queue queue = (Queue)ic.lookup(queueName);
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue);
+ Message m = null;
+ do
+ {
+ m = consumer.receive(1L);
+ }
+ while(m != null);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public void send(String txt, String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+
+ Queue queue = (Queue)ic.lookup(queueName);
+
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer producer = session.createProducer(queue);
+
+ TextMessage tm = session.createTextMessage(txt);
+
+ producer.send(tm);
+
+ System.out.println("message " + txt + " sent to " + queueName);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public int browse(String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ Queue queue = (Queue)ic.lookup(queueName);
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ QueueBrowser browser = session.createBrowser(queue);
+
+ ArrayList list = new ArrayList();
+ for(Enumeration e = browser.getEnumeration(); e.hasMoreElements(); )
+ {
+ list.add(e.nextElement());
+ }
+
+ return list.size();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public String receive(String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ Queue queue = (Queue)ic.lookup(queueName);
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ System.out.println("blocking to receive message from queue " + queueName + " ...");
+ TextMessage tm = (TextMessage)consumer.receive(5000);
+
+ if (tm == null)
+ {
+ throw new Exception("No message!");
+ }
+
+ System.out.println("Message " + tm.getText() + " received");
+
+ return tm.getText();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public Connection getConnection() throws Exception
+ {
+
+ Connection connection = null;
+
+ try
+ {
+ connection = cf.createConnection();
+
+ connection.start();
+ }
+ catch(Exception e )
+ {
+ if(connection != null)
+ {
+ closeConnection(connection);
+ }
+ System.out.println("Failed to get connection...exception is " + e);
+ throw e;
+ }
+
+ return connection;
+ }
+
+ public void closeConnection(Connection con) throws Exception
+ {
+ try
+ {
+ con.close();
+ }
+ catch(JMSException jmse)
+ {
+ System.out.println("Could not close connection " + con +" exception was " + jmse);
+ throw jmse;
+ }
+ }
+
+ public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbCreate()
+ {
+ try
+ {
+ InitialContext ic = new InitialContext();
+
+ cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ throw new EJBException("Initalization failure: " + e.getMessage());
+ }
+ }
+
+ public void ejbRemove() throws EJBException
+ {
+ try
+ {
+ if(cf != null)
+ {
+ cf = null;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new EJBException("ejbRemove ", e);
+ }
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException
+ {
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/bean/StatelessSessionExampleHome.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,25 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.stateless.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessSessionExampleHome.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+
+public interface StatelessSessionExampleHome extends EJBHome
+{
+ public StatelessSessionExample create() throws RemoteException, CreateException;
+}
+
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless/src/org/jboss/example/jms/stateless/client/Client.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.stateless.client;
+
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.example.jms.stateless.bean.StatelessSessionExample;
+import org.jboss.example.jms.stateless.bean.StatelessSessionExampleHome;
+
+/**
+ * This example deploys a simple Stateless Session Bean that is used as a proxy to send and receive
+ * JMS messages in a managed environment.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2977 $</tt>
+ *
+ * $Id: Client.java 2977 2007-08-08 15:32:14Z timfox $
+ */
+public class Client extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ InitialContext ic = new InitialContext();
+
+ StatelessSessionExampleHome home =
+ (StatelessSessionExampleHome)ic.lookup("ejb/StatelessSessionExample");
+
+ StatelessSessionExample bean = home.create();
+
+ String queueName = getDestinationJNDIName();
+ String text = "Hello!";
+
+ bean.drain(queueName);
+
+ bean.send("Hello!", queueName);
+ log("The " + text + " message was successfully sent to the " + queueName + " queue");
+
+ int num = bean.browse(queueName);
+
+ assertEquals(1, num);
+
+ log("Queue browse result: " + num);
+
+ String result = bean.receive(queueName);
+ log("Received " + result);
+
+ assertEquals("Hello!", result);
+
+ bean.remove();
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new Client().run();
+ }
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,134 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - Stateless Clustered Session Bean</title>
+</head>
+<body>
+
+<h1>Sending JMS messages from a Stateless Clustered Session Bean</h1>
+
+<p>$Revision: 5409 $</p>
+
+<h2>Overview</h2>
+<p>
+This example deploys in a cluster a stateless session bean that can then
+send and receive messages from a queue. This is a very simple example that
+demonstrates using JBoss Messaging in a clustered environment.
+The client uses HA-JNDI to look up the session bean. It then invokes the
+session bean to send a message to a test queue and afterwards consumes the same message.
+</p>
+<p>
+This example relies on having access to a running JBoss Messaging cluster.
+The JBoss Messaging cluster must be installed and started according to
+the "JBoss Messaging Clustered Installation" chapter from the release
+documentation. However, the example will automatically deploy its own
+queue, unless a queue with the same name is already deployed.
+</p>
+<br>
+<p>
+This example also relies on having access to <tt>jboss-messaging-client.jar</tt>
+archive that comes with the release bundle. If you run this example
+from an unzipped installation bundle, the example run script is correctly
+configured to find the client jar. Otherwise, you must modify example's
+<tt>build.xml</tt> accordingly.
+</p>
+<br><br>
+For JBoss5, you should copy all as messaging-node0, configure mysql as a database, make it clustered, and copy it as messaging-node1. Start each instance as:
+<br><br>
+./run -c messaging-node0 -Djboss.service.binding.set=ports-01
+<br><br>
+<br>
+and in another window
+<br><br>
+./run.sh -c messaging-node1 -Djboss.service.binding.set=ports-02 -Djboss.messaging.ServerPeerID=1
+<br><br>
+
+
+<h2>Running the example</h2>
+<p>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <tt>C:\jboss-4.2.0.GA\server\messaging-node0\deploy</tt>,
+then your JBOSS_HOME value should be <tt>C:\jboss-4.2.0.GA</tt>.
+</p>
+<p>
+2. Go to the example's home directory
+</p>
+<blockquote>
+ <pre>cd ...\examples\stateless</pre>
+</blockquote>
+<p>
+3. Run the example:
+</p>
+<blockquote>
+ <pre>ant</pre>
+</blockquote>
+<p>
+The output of a successful run should be similar to:
+</p>
+<blockquote>
+ <pre>$ ant
+Buildfile: build.xml
+
+identify:
+ [echo] ###########################################################################
+ [echo] # Running the STATELESS CLUSTERED SESSION BEAN example #
+ [echo] ###########################################################################
+ [echo] The queue: testFarmQueue
+ [echo] The client jar: ../../../output/lib/jboss-messaging-client.jar
+
+sanity-check:
+
+init:
+ [mkdir] Created dir: C:\java\messaging\docs\examples\stateless-clustered\output\classes\META-INF
+ [mkdir] Created dir: C:\java\messaging\docs\examples\stateless-clustered\output\lib
+
+compile:
+ [javac] Compiling 4 source files to C:\java\messaging\docs\examples\stateless-clustered\output\classes
+ [javac] Note: C:\java\messaging\docs\examples\stateless-clustered\src\org\jboss\example\jms\statelessclustered\bean\StatelessClusteredSessionExampleBean.java uses unchecked or unsafe operations.
+ [javac] Note: Recompile with -Xlint:unchecked for details.
+
+jar:
+ [copy] Copying 2 files to C:\java\messaging\docs\examples\stateless-clustered\output\classes\META-INF
+ [jar] Building jar: C:\java\messaging\docs\examples\stateless-clustered\output\lib\stateless-clustered-example.jar
+
+deploy:
+ [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging-node0\farm
+ [copy] Copying 1 file to C:\jboss-4.2.0.GA\server\messaging-node0\farm
+
+sleep:
+ [echo] Sleeping for 15 seconds ...
+
+run:
+
+send-and-receive:
+ [java] The Hello! message was successfully sent to the /queue/testFarmQueue queue
+ [java] Queue browse result: 1
+ [java] blocking to receive message from queue /queue/testFarmQueue ...
+ [java] Message Hello! received
+ [java]
+ [java] #####################
+ [java] ### SUCCESS! ###
+ [java] #####################
+
+undeploy:
+ [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging-node0\farm\stateless-clustered-example.jar
+ [delete] Deleting: C:\jboss-4.2.0.GA\server\messaging-node0\farm\destinations-farm-service.xml
+
+BUILD SUCCESSFUL
+Total time: 19 seconds
+</pre></blockquote>
+
+<h2>Troublesooting</h2>
+<h3>1. I get <tt>"javax.jms.JMSSecurityException: User null is NOT authenticated"</tt></h3>
+<p>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of the JBoss instance, specifically a properly configured "<tt>messaging</tt>"
+security domain. Follow the instructions from the "Installation" paragraph of
+the release documentation.
+</p>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5559 2008-12-22 08:58:16Z gaohoward $
+
+ -->
+
+<project name="StatelessClusteredExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="example.queue.name" value="testFarmQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the STATELESS CLUSTERED SESSION BEAN example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF">
+ <fileset dir="./etc/META-INF" includes="*" />
+ </copy>
+ <jar destfile="./output/lib/stateless-clustered-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/jms/statelessclustered/bean/*.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./etc/destinations-farm-service.xml" todir="${jboss.home}/server/${jboss.configuration}/farm" />
+ <copy file="./output/lib/stateless-clustered-example.jar" todir="${jboss.home}/server/${jboss.configuration}/farm" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="15" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send-and-receive" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send-and-receive">
+ <!-- The client expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.statelessclustered.client.Client" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/farm/stateless-clustered-example.jar" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/farm/destinations-farm-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5408 2008-11-21 04:43:36Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="StatelessClusteredExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="messaging-node0" />
+ <property name="example.queue.name" value="testFarmQueue" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the STATELESS CLUSTERED SESSION BEAN example #" />
+ <echo message="###########################################################################" />
+ <echo message="The queue: ${example.queue.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF" />
+ <mkdir dir="./output/lib" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <copy todir="./output/classes/META-INF">
+ <fileset dir="./etc/META-INF" includes="*" />
+ </copy>
+ <jar destfile="./output/lib/stateless-clustered-example.jar" basedir="./output/classes" includes="META-INF/**,org/jboss/example/jms/statelessclustered/bean/*.class" />
+ </target>
+
+ <target name="deploy" depends="jar">
+ <copy file="./etc/destinations-farm-service.xml" todir="${jboss.home}/server/${jboss.configuration}/farm" />
+ <copy file="./output/lib/stateless-clustered-example.jar" todir="${jboss.home}/server/${jboss.configuration}/farm" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="15" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="deploy">
+ <antcall target="send-and-receive" />
+ <antcall target="undeploy" />
+ </target>
+
+ <target name="send-and-receive">
+ <!-- The client expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.statelessclustered.client.Client" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/farm/stateless-clustered-example.jar" quiet="true" />
+ <delete file="${jboss.home}/server/${jboss.configuration}/farm/destinations-farm-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/ejb-jar.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/ejb-jar.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/ejb-jar.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,16 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+ "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar>
+ <enterprise-beans>
+ <session>
+ <ejb-name>StatelessClusteredSessionExample</ejb-name>
+ <home>org.jboss.example.jms.statelessclustered.bean.StatelessClusteredSessionExampleHome</home>
+ <remote>org.jboss.example.jms.statelessclustered.bean.StatelessClusteredSessionExample</remote>
+ <ejb-class>org.jboss.example.jms.statelessclustered.bean.StatelessClusteredSessionExampleBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/jboss.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/jboss.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/META-INF/jboss.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC
+ "-//JBoss//DTD JBOSS 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>StatelessClusteredSessionExample</ejb-name>
+ <jndi-name>ejb/StatelessClusteredSessionExample</jndi-name>
+ <clustered>True</clustered>
+ </session>
+ </enterprise-beans>
+</jboss>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/destinations-farm-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/destinations-farm-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/destinations-farm-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testFarmQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="Clustered">true</attribute>
+ </mbean>
+</server>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties - HA-JNDI
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=localhost:1100,localhost:1200
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 2742 2007-05-30 17:07:08Z sergeypk $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,29 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.statelessclustered.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessClusteredSessionExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+
+public interface StatelessClusteredSessionExample extends EJBObject
+{
+ public void drain(String queueName) throws RemoteException, Exception;
+
+ public void send(String txt, String queueName) throws RemoteException, Exception;
+
+ public int browse(String queueName) throws RemoteException, Exception;
+
+ public String receive(String queueName) throws RemoteException, Exception;
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleBean.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleBean.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleBean.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,254 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.statelessclustered.bean;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessClusteredSessionExampleBean.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class StatelessClusteredSessionExampleBean implements SessionBean
+{
+ private ConnectionFactory cf = null;
+
+ public void drain(String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ Queue queue = (Queue)ic.lookup(queueName);
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue);
+ int drainedCount = 0;
+ Message m = null;
+ do
+ {
+ m = consumer.receive(1L);
+ if (m != null) drainedCount++;
+ }
+ while(m != null);
+ System.out.println("Drained " + drainedCount + " messages from queue " + queueName);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public void send(String txt, String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ Queue queue = (Queue)ic.lookup(queueName);
+
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer producer = session.createProducer(queue);
+
+ TextMessage tm = session.createTextMessage(txt);
+
+ producer.send(tm);
+
+ System.out.println("message " + txt + " sent to " + queueName);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public int browse(String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ Queue queue = (Queue)ic.lookup(queueName);
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ QueueBrowser browser = session.createBrowser(queue);
+
+ ArrayList list = new ArrayList();
+ for(Enumeration e = browser.getEnumeration(); e.hasMoreElements(); )
+ {
+ list.add(e.nextElement());
+ }
+
+ return list.size();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public String receive(String queueName) throws Exception
+ {
+ InitialContext ic = new InitialContext();
+ Queue queue = (Queue)ic.lookup(queueName);
+ ic.close();
+
+ Session session = null;
+ Connection conn = null;
+
+ try
+ {
+ conn = getConnection();
+ session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ System.out.println("blocking to receive message from queue " + queueName + " ...");
+ TextMessage tm = (TextMessage)consumer.receive(5000);
+
+ if (tm == null)
+ {
+ throw new Exception("No message!");
+ }
+
+ System.out.println("Message " + tm.getText() + " received");
+
+ return tm.getText();
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ closeConnection(conn);
+ }
+ }
+ }
+
+ public Connection getConnection() throws Exception
+ {
+
+ Connection connection = null;
+
+ try
+ {
+ connection = cf.createConnection();
+
+ connection.start();
+ }
+ catch(Exception e )
+ {
+ if(connection != null)
+ {
+ closeConnection(connection);
+ }
+ System.out.println("Failed to get connection...exception is " + e);
+ throw e;
+ }
+
+ return connection;
+ }
+
+ public void closeConnection(Connection con) throws Exception
+ {
+ try
+ {
+ con.close();
+ }
+ catch(JMSException jmse)
+ {
+ System.out.println("Could not close connection " + con +" exception was " + jmse);
+ throw jmse;
+ }
+ }
+
+ public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbCreate()
+ {
+ try
+ {
+ InitialContext ic = new InitialContext(); // Non-HA
+
+ cf = (ConnectionFactory)ic.lookup("java:/JmsXA");
+
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ throw new EJBException("Initalization failure: " + e.getMessage(), e);
+ }
+ }
+
+ public void ejbRemove() throws EJBException
+ {
+ try
+ {
+ if(cf != null)
+ {
+ cf = null;
+ }
+ }
+ catch(Exception e)
+ {
+ throw new EJBException("ejbRemove ", e);
+ }
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException
+ {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException
+ {
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleHome.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleHome.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/bean/StatelessClusteredSessionExampleHome.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,25 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.statelessclustered.bean;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: StatelessClusteredSessionExampleHome.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+
+public interface StatelessClusteredSessionExampleHome extends EJBHome
+{
+ public StatelessClusteredSessionExample create() throws RemoteException, CreateException;
+}
+
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/client/Client.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/client/Client.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/stateless-clustered/src/org/jboss/example/jms/statelessclustered/client/Client.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.statelessclustered.client;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.example.jms.statelessclustered.bean.StatelessClusteredSessionExample;
+import org.jboss.example.jms.statelessclustered.bean.StatelessClusteredSessionExampleHome;
+
+/**
+ * This example deploys a simple clustered Stateless Session Bean that is used as a proxy to send
+ * and receive JMS messages in a managed environment.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: Client.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class Client extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ InitialContext ic = new InitialContext();
+
+ StatelessClusteredSessionExampleHome home =
+ (StatelessClusteredSessionExampleHome)ic.lookup("ejb/StatelessClusteredSessionExample");
+
+ StatelessClusteredSessionExample bean = home.create();
+
+ String queueName = getDestinationJNDIName();
+ String text = "Hello!";
+
+ bean.drain(queueName);
+
+ bean.send("Hello!", queueName);
+ log("The " + text + " message was successfully sent to the " + queueName + " queue");
+
+ int num = bean.browse(queueName);
+ bean.remove();
+
+ log("Queue browse result: " + num);
+
+ Queue queue = (Queue)ic.lookup(queueName);
+
+ // Not using ClusteredConnectionFactory since that would require message
+ // redistribution to be enabled, and we don't want to bother with the configuration
+ // at this time.
+ ConnectionFactory cf = (ConnectionFactory) ic.lookup("/ConnectionFactory");
+ Connection conn = cf.createConnection();
+
+ try
+ {
+ conn.start();
+ Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ System.out.println("blocking to receive message from queue " + queueName + " ...");
+ TextMessage tm = (TextMessage)consumer.receive(5000);
+
+ if (tm == null)
+ {
+ throw new Exception("No message!");
+ }
+
+ System.out.println("Message " + tm.getText() + " received");
+
+ assertEquals("Hello!", tm.getText());
+ }
+ finally
+ {
+ conn.close();
+ }
+
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args)
+ {
+ new Client().run();
+ }
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,143 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - JMS Topic</title>
+</head>
+<body>
+<br>
+<h1>JBoss Messaging Topic Example</h1>
+$Revision: 2751 $
+<h2>Overview</h2>
+<br>
+This example creates a JMS Connection to a JBoss Messaging instance
+and uses it to create a session, a publisher and a subscriber. The
+publisher sends a message to the topic. The example is considered
+successful
+if the topic subscriber receives the message.<br>
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However,
+the example will automatically deploy its own topic, unless a topic
+with the same name is already deployed. <br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from
+an unzipped installation bundle, the example run script is correctly
+configured to find the client jar. Otherwise, you must modify example's
+<span style="font-family: monospace;">build.xml</span> accordingly.<br>
+<span style="font-style: italic;"></span><br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\default\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA.</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\topic</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ <div style="margin-left: 40px;"><br>
+ </div>
+$ ant<br>
+Buildfile: build.xml<br>
+ <br>
+identify:<br>
+ [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+ [echo]
+X
+Running the TOPIC
+example
+X<br>
+ [echo]
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
+ [echo] The topic: testTopic<br>
+ <br>
+sanity-check:<br>
+ <br>
+init:<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\topic\output<br>
+ [mkdir] Created dir:
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+ <br>
+compile:<br>
+ [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\common\output<br>
+ [javac] Compiling 2 source files to
+C:\work\src\cvs\jboss-head\jms\docs\examples\topic\output<br>
+ <br>
+run:<br>
+ [java] Topic /topic/testTopic exists<br>
+ [java] The message was successfully published
+on the topic<br>
+ [java] Received message: Hello!<br>
+ [java] The example connected to JBoss
+Messaging version 1.2.0.GA (1.2)<br>
+ <br>
+ [java] #####################<br>
+ [java] ###
+SUCCESS! ###<br>
+ [java] #####################<br>
+ <br>
+BUILD SUCCESSFUL<br>
+Total time: 4 seconds<br>
+ <br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<div style="margin-left: 40px;"><br>
+</div>
+<br>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5559 2008-12-22 08:58:16Z gaohoward $
+
+ -->
+
+<project name="TopicExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties" />
+ <property name="messaging.client.jar.path" value="../../" />
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar" />
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}" />
+ <property name="jboss.configuration" value="messaging" />
+ <property name="example.topic.name" value="testTopic" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar" />
+ <fileset file="${jboss.home}/client/jbossall-client.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar" />
+ <fileset file="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the TOPIC example #" />
+ <echo message="###########################################################################" />
+ <echo message="The topic: ${example.topic.name}" />
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <!-- TopicExample expects to find the name of the topic to connect to as value of the
+ 'example.topic.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.topic.TopicExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.topic.name" value="${example.topic.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5408 2008-11-21 04:43:36Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="TopicExample" default="run">
+
+ <property environment="ENV" />
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default" />
+ <property name="example.topic.name" value="testTopic" />
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-javaee.jar" />
+ <fileset file="${messaging.client.jar.name}" />
+ </path>
+
+ <path id="example.compilation.classpath">
+ <path refid="common.compilation.classpath" />
+ <pathelement path="../common/output/classes" />
+ </path>
+
+ <path id="execution.classpath">
+ <pathelement path="./etc" />
+ <pathelement path="../common/output/classes" />
+ <pathelement path="./output/classes" />
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################" />
+ <echo message="# Running the TOPIC example #" />
+ <echo message="###########################################################################" />
+ <echo message="The topic: ${example.topic.name}" />
+ <echo message="The client jar: ${messaging.client.jar.name}" />
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}" />
+ <fail message="Could not find client jar ${messaging.client.jar.name}" unless="client.jar.present" />
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes" />
+ <mkdir dir="../common/output/classes" />
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src" />
+ <classpath refid="common.compilation.classpath" />
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src" />
+ <classpath refid="example.compilation.classpath" />
+ </javac>
+ </target>
+
+ <target name="deploy">
+ <copy file="./etc/topic-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ </target>
+
+ <target name="run" depends="compile, deploy">
+ <!-- TopicExample expects to find the name of the topic to connect to as value of the
+ 'example.topic.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.topic.TopicExample" classpathref="execution.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.topic.name" value="${example.topic.name}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ <antcall target="undeploy"/>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/topic-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true" />
+ <delete dir="../common/output" quiet="true" />
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..." />
+ <sleep seconds="${sleep.interval}" />
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/log4j.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/log4j.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/log4j.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- $Id: log4j.xml 536 2005-12-22 06:28:39Z ovidiu $ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p @%t [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/topic-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/topic-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/etc/topic-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.TopicService"
+ name="jboss.messaging.destination:service=Topic,name=testTopic"
+ xmbean-dd="xmdesc/Topic-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/ExampleListener.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,49 @@
+/**
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.example.jms.topic;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+/**
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @version <tt>$Revision: 2868 $</tt>
+
+ * $Id: ExampleListener.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class ExampleListener implements MessageListener
+{
+ private Message message;
+
+ public synchronized void onMessage(Message message)
+ {
+ this.message = message;
+ notifyAll();
+ }
+
+ public synchronized Message getMessage()
+ {
+ return message;
+ }
+
+ protected synchronized void waitForMessage()
+ {
+ if (message != null)
+ {
+ return;
+ }
+
+ try
+ {
+ wait(5000);
+ }
+ catch(InterruptedException e)
+ {
+ // OK
+ }
+ }
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/TopicExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/TopicExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/topic/src/org/jboss/example/jms/topic/TopicExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.topic;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.naming.InitialContext;
+
+import org.jboss.example.jms.common.ExampleSupport;
+
+/**
+ * The example creates a connection to the default provider and uses the connection to send a
+ * message to the topic "queue/testTopic". The message must be received by a topic subscriber.
+ *
+ * Since this example is also used by the smoke test, it is essential that the VM exits with exit
+ * code 0 in case of successful execution and a non-zero value on failure.
+ *
+ * @author <a href="mailto:ovidiu at feodorov.com">Ovidiu Feodorov</a>
+ * @author <a href="mailto:luc.texier at jboss.org">Luc Texier</a>
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2868 $</tt>
+ *
+ * $Id: TopicExample.java 2868 2007-07-10 20:22:16Z timfox $
+ */
+public class TopicExample extends ExampleSupport
+{
+ public void example() throws Exception
+ {
+ String destinationName = getDestinationJNDIName();
+
+ InitialContext ic = null;
+ Connection connection = null;
+
+ try
+ {
+ ic = new InitialContext();
+
+ ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
+ Topic topic = (Topic)ic.lookup(destinationName);
+ log("Topic " + destinationName + " exists");
+
+ connection = cf.createConnection();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ MessageProducer publisher = session.createProducer(topic);
+ MessageConsumer subscriber = session.createConsumer(topic);
+
+ ExampleListener messageListener = new ExampleListener();
+ subscriber.setMessageListener(messageListener);
+ connection.start();
+
+ TextMessage message = session.createTextMessage("Hello!");
+ publisher.send(message);
+ log("The message was successfully published on the topic");
+
+ messageListener.waitForMessage();
+
+ message = (TextMessage)messageListener.getMessage();
+ log("Received message: " + message.getText());
+ assertEquals("Hello!", message.getText());
+
+ displayProviderInfo(connection.getMetaData());
+
+ }
+ finally
+ {
+ if (ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch(Exception e)
+ {
+ throw e;
+ }
+ }
+
+ // ALWAYS close your connection in a finally block to avoid leaks.
+ // Closing connection also takes care of closing its related objects e.g. sessions.
+ closeConnection(connection);
+ }
+ }
+
+ private void closeConnection(Connection con) throws JMSException
+ {
+
+ try
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ catch(JMSException jmse)
+ {
+ log("Could not close connection " + con +" exception was " + jmse);
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return false;
+ }
+
+ public static void main(String[] args)
+ {
+ new TopicExample().run();
+ }
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/README.html
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/README.html (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/README.html 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,181 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta content="text/html; charset=ISO-8859-1"
+ http-equiv="content-type">
+ <title>JBoss Messaging Example - WebService Environment</title>
+</head>
+<body>
+<br>
+<h1>Sending JMS messages from a WebService<br>
+</h1>
+<h2>Overview</h2>
+<br>
+This example deploys a WebServices that sends messages to a queue.
+The same client will then read the message from the queue, validating
+if the WebService could complete the message send.
+<br>
+This example relies on having access to a running JBoss Messaging
+instance.
+The JBoss Messaging instance must be installed and started according to
+the
+"Installation" paragraph from the release documentation. However,
+the example will automatically deploy its own queue, unless a queue
+with the same name is already deployed. <br>
+<br>
+This example also relies on having access to <span
+ style="font-family: monospace;">jboss-messaging-client.jar</span>
+archive that comes with the release bundle. If you run this example
+from
+an unzipped installation bundle, the example run script is correctly
+configured to find the client jar. Otherwise, you must modify example's
+<span style="font-family: monospace;">build.xml</span>
+accordingly. <br>
+<br>
+This example will also generate client classes using wsdltools from
+JBoss Web Services.<br>
+<br>
+<h2>Running the example</h2>
+1. Set up the JBOSS_HOME environment variable to point to the JBoss
+instance you deployed JBoss Messaging into. For example, if you
+deployed JBoss Messaging in <span style="font-family: monospace;">C:\jboss-4.2.0.GA\server\messaging\deploy,</span>
+then your JBOSS_HOME value should be <span
+ style="font-family: monospace;">C:\</span><span
+ style="font-family: monospace;">jboss-4.2.0.GA</span><br>
+<span style="font-family: monospace;"></span><br>
+2. Go to the example's home directory<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">cd
+...\examples\web-services</span><br>
+</div>
+<br>
+3. Run the example:<br>
+<br>
+<div style="margin-left: 40px;"><span style="font-family: monospace;">ant</span>
+<br>
+<br>
+<br>
+</div>
+The output of a successful run should be similar to:<br>
+<div style="margin-left: 40px;"><br>
+</div>
+<table
+ style="width: 90%; text-align: left; font-family: monospace; background-color: rgb(204, 204, 204); margin-left: 40px;"
+ border="1" cellpadding="2" cellspacing="2">
+ <tbody>
+ <tr>
+ <td style="vertical-align: top;">
+ <div style="margin-left: 40px;"><br>
+ </div>
+example at example:/workspace/jboss-messaging-1.3.0.GA/examples/web-services$
+ant<br>
+Buildfile: build.xml<br>
+ <br>
+identify:<br>
+ [echo]
+###########################################################################<br>
+ [echo]
+#
+Running the WebServices
+example
+#<br>
+ [echo]
+###########################################################################<br>
+ [echo] The
+queue: testQueue<br>
+ [echo] The client jar:
+../..//jboss-messaging-client.jar<br>
+ <br>
+sanity-check:<br>
+ <br>
+init:<br>
+ <br>
+compile:<br>
+ <br>
+war:<br>
+ [jar] Building jar:
+/workspace/jboss-messaging-1.3.0.GA/examples/web-services/output/lib/jms-web-service.war<br>
+ <br>
+deploy:<br>
+ [copy] Copying 1 file to
+/jboss-4.2.0.GA/server/messaging/deploy<br>
+ <br>
+sleep:<br>
+ [echo] Sleeping for 5 seconds ...<br>
+ <br>
+run-wsdl-client:<br>
+ [get] Getting:
+http://127.0.0.1:8080/jms-web-service/JMSWebServiceExample?wsdl<br>
+ [get] To:
+/workspace/jboss-messaging-1.3.0.GA/examples/web-services/output/service.wsdl<br>
+ [wstools] log4j:WARN No appenders could be found for logger
+(org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory).<br>
+ [wstools] log4j:WARN Please initialize the log4j system properly.<br>
+ <br>
+compile-client:<br>
+ [mkdir] Created dir:
+/workspace/jboss-messaging-1.2.0.SP2/examples/web-services/output/client-classes<br>
+ [javac] Compiling 5 source files to
+/workspace/jboss-messaging-1.2.0.SP2/examples/web-services/output/client-classes<br>
+ <br>
+run:<br>
+ <br>
+send-and-receive:<br>
+ [java] log4j:WARN No appenders could be found
+for logger
+(org.jboss.ws.metadata.builder.jaxrpc.JAXRPCClientMetaDataBuilder).<br>
+ [java] log4j:WARN Please initialize the log4j
+system properly.<br>
+ [java] Message was received ok!<br>
+ [java]<br>
+ [java] #####################<br>
+ [java] ###
+SUCCESS! ###<br>
+ [java] #####################<br>
+ <br>
+undeploy:<br>
+ [delete] Deleting:
+/jboss-4.2.0.GA/server/messaging/deploy/jms-web-service.war<br>
+ <br>
+BUILD SUCCESSFUL<br>
+Total time: 12 seconds<br>
+ <br>
+ <br>
+ </td>
+ </tr>
+ </tbody>
+</table>
+<br>
+<h2>Troublesooting</h2>
+<h3>1. I get <span style="font-family: monospace;">"javax.jms.JMSSecurityException:
+User null is NOT authenticated" <br>
+</span></h3>
+You probably didn't install JBoss Messaging correctly. A fresh JBoss
+Messaging installation requires changes in the security configuration
+of a <span style="font-family: monospace;">default </span>JBoss
+instance, specifically a properly configured "<small><span
+ style="font-family: courier new,courier,monospace;">messaging</span></small>"
+security domain. Follow the instructions from the "Installation"
+paragraph of the release documentation. <br>
+<h3>2. <span style="font-family: monospace;">wstools doesn't work</span></h3>
+You could aways using "ant -debug" to verify what Exceptions wstools is
+generating. A common error is a NullPointerException due to a xerces
+update required by JBoss Web Services. You could have more information
+at this <a
+ href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWSFAQXercesNPE">page</a>:<br>
+<br>
+<a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWSFAQXercesNPE">http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWSFAQXercesNPE</a><br>
+<br>
+<br>
+<br>
+<br>
+<hr style="width: 100%; height: 2px;"><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+<br>
+</span>
+</body>
+</html>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 7009 2009-05-26 06:47:08Z gaohoward $
+
+ -->
+
+<project name="WebServicesExample" default="run">
+
+ <property environment="ENV"/>
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <property file="../examples.properties"/>
+ <property name="messaging.client.jar.path" value="../../"/>
+ <property name="messaging.client.jar.name" value="jboss-messaging-client.jar"/>
+ <property name="jboss.home" value="${ENV.JBOSS_HOME}"/>
+ <property name="jboss.configuration" value="messaging"/>
+ <property name="example.queue.name" value="testQueue"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ <fileset file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </path>
+
+ <property name="jboss.client" value="${jboss.home}/client"/>
+
+ <path id="runtime.classpath">
+ <path refid="common.compilation.classpath"/>
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/classes"/>
+ <pathelement location="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+
+ <!-- all this stuff for WebServices -->
+ <pathelement location="${jboss.home}/lib/endorsed/xercesImpl.jar"/>
+ <pathelement location="${jboss.client}/activation.jar"/>
+ <pathelement location="${jboss.client}/commons-logging.jar"/>
+ <pathelement location="${jboss.client}/javassist.jar"/>
+ <pathelement location="${jboss.client}/jbossall-client.jar"/>
+ <pathelement location="${jboss.client}/jbossws-client.jar"/>
+ <pathelement location="${jboss.client}/log4j.jar"/>
+ <pathelement location="${jboss.client}/mail.jar"/>
+ <pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxws.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxrpc.jar"/>
+ <pathelement location="${jboss.client}/jboss-saaj.jar"/>
+ <pathelement location="${jboss.client}/wsdl4j.jar"/>
+ <pathelement location="${jboss.client}/jaxb-api.jar"/>
+ </path>
+
+ <path id="client.classpath">
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
+ <path refid="common.compilation.classpath"/>
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/client-classes"/>
+
+ <!-- all this stuff for WebServices -->
+ <pathelement location="${jboss.client}/activation.jar"/>
+ <pathelement location="${jboss.client}/commons-logging.jar"/>
+ <pathelement location="${jboss.client}/javassist.jar"/>
+ <pathelement location="${jboss.client}/jbossall-client.jar"/>
+ <pathelement location="${jboss.client}/jbossws-client.jar"/>
+ <pathelement location="${jboss.client}/log4j.jar"/>
+ <pathelement location="${jboss.client}/mail.jar"/>
+ <pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxws.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxrpc.jar"/>
+ <pathelement location="${jboss.client}/jboss-saaj.jar"/>
+ <pathelement location="${jboss.client}/wsdl4j.jar"/>
+ <pathelement location="${jboss.client}/jaxb-api.jar"/>
+ <pathelement location="${jboss.home}/lib/endorsed/xercesImpl.jar"/>
+
+
+ <pathelement location="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <pathelement location="${jboss.home}/client/jbossall-client.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
+
+
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################"/>
+ <echo message="# Running the WebServices example #"/>
+ <echo message="###########################################################################"/>
+ <echo message="The queue: ${example.queue.name}"/>
+ <echo message="The client jar: ${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+ <fail message="Could not find client jar ${messaging.client.jar.path}/${messaging.client.jar.name}"
+ unless="client.jar.present"/>
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF"/>
+ <mkdir dir="./output/lib"/>
+ <mkdir dir="../common/output/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src"/>
+ <classpath refid="common.compilation.classpath"/>
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src"/>
+ <classpath refid="runtime.classpath"/>
+ </javac>
+ </target>
+
+ <target name="run-wsdl-client" depends="compile">
+ <taskdef name="wstools" classname="org.jboss.ws.tools.ant.wstools">
+ <classpath refid="runtime.classpath"/>
+ </taskdef>
+
+ <mkdir dir="./output/client"/>
+
+ <get src="http://127.0.0.1:8080/jms-web-service/JMSWebServiceExample?wsdl" dest="./output/service.wsdl" />
+
+ <wstools config="./etc/client-config/client-config.xml"
+ dest="./output/client"/>
+ </target>
+
+
+ <target name="war" depends="compile">
+ <jar destfile="./output/lib/jms-web-service.war">
+ <zipfileset dir="./output/classes" prefix="WEB-INF/classes"/>
+ <zipfileset dir="./etc/WEB-INF" prefix="WEB-INF"/>
+ </jar>
+ </target>
+
+ <target name="deploy" depends="war">
+ <copy file="./output/lib/jms-web-service.war"
+ todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
+ <antcall target="sleep"><param name="sleep.interval" value="10"/></antcall>
+ </target>
+
+ <target name="compile-client">
+ <mkdir dir="./output/client-classes"/>
+ <javac destdir="./output/client-classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./output/client"/>
+ <src path="./src-client"/>
+ <classpath refid="runtime.classpath"/>
+ </javac>
+ </target>
+
+
+ <target name="run" depends="deploy, run-wsdl-client, compile-client">
+ <antcall target="send-and-receive"/>
+ <antcall target="undeploy"/>
+ </target>
+
+ <target name="send-and-receive">
+ <!-- The client expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.webservices.client.Client"
+ classpathref="client.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/jms-web-service.war"
+ quiet="true"/>
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true"/>
+ <delete dir="../common/output" quiet="true"/>
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..."/>
+ <sleep seconds="${sleep.interval}"/>
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml.AS5
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml.AS5 (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/build.xml.AS5 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+
+ To run the example, set JBOSS_HOME and run ant (with no parameters)
+
+ $Id: build.xml 5302 2008-11-07 05:44:31Z clebert.suconic at jboss.com $
+
+ -->
+
+<project name="WebServicesExample" default="run">
+
+ <property environment="ENV"/>
+
+ <!-- These properties may be overriden by calling ants when this example is used in a smoke test -->
+ <condition property="jboss.home" value="${ENV.JBOSS_HOME}" else="../../../">
+ <isset property="ENV.JBOSS_HOME" />
+ </condition>
+ <property name="endorsed.dirs" value="${jboss.home}/lib/endorsed" />
+ <property name="messaging.client.jar.name" value="${jboss.home}/client/jboss-messaging-client.jar" />
+ <property name="jboss.configuration" value="default"/>
+ <property name="example.queue.name" value="testQueue"/>
+
+ <path id="common.compilation.classpath">
+ <fileset file="${jboss.home}/client/jboss-j2ee.jar"/>
+ <fileset dir="${jboss.home}/client" includes="*.jar" />
+ <fileset file="${messaging.client.jar.name}"/>
+ </path>
+
+ <property name="jboss.client" value="${jboss.home}/client"/>
+
+ <path id="runtime.classpath">
+ <path refid="common.compilation.classpath"/>
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/classes"/>
+ <pathelement location="${messaging.client.jar.path}/${messaging.client.jar.name}"/>
+
+ <!-- all this stuff for WebServices -->
+ <pathelement location="${jboss.home}/lib/endorsed/xercesImpl.jar"/>
+ <pathelement location="${jboss.client}/activation.jar"/>
+ <pathelement location="${jboss.client}/commons-logging.jar"/>
+ <pathelement location="${jboss.client}/javassist.jar"/>
+ <pathelement location="${jboss.client}/jbossall-client.jar"/>
+ <pathelement location="${jboss.client}/jbossws-client.jar"/>
+ <pathelement location="${jboss.client}/log4j.jar"/>
+ <pathelement location="${jboss.client}/mail.jar"/>
+ <pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxws.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxrpc.jar"/>
+ <pathelement location="${jboss.client}/jboss-saaj.jar"/>
+ <pathelement location="${jboss.client}/wsdl4j.jar"/>
+ <pathelement location="${jboss.client}/jaxb-api.jar"/>
+ </path>
+
+ <path id="client.classpath">
+ <path refid="common.compilation.classpath"/>
+ <pathelement path="./etc"/>
+ <pathelement path="../common/output/classes"/>
+ <pathelement path="./output/client-classes"/>
+
+ <!-- all this stuff for WebServices -->
+ <fileset file="${jboss.home}/server/${jboss.configuration}/lib/jboss-remoting.jar"/>
+ <pathelement location="${jboss.client}/activation.jar"/>
+ <pathelement location="${jboss.client}/commons-logging.jar"/>
+ <pathelement location="${jboss.client}/javassist.jar"/>
+ <pathelement location="${jboss.client}/jbossall-client.jar"/>
+ <pathelement location="${jboss.client}/jbossws-client.jar"/>
+ <pathelement location="${jboss.client}/log4j.jar"/>
+ <pathelement location="${jboss.client}/mail.jar"/>
+ <pathelement location="${jboss.client}/jboss-xml-binding.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxws.jar"/>
+ <pathelement location="${jboss.client}/jboss-jaxrpc.jar"/>
+ <pathelement location="${jboss.client}/jboss-saaj.jar"/>
+ <pathelement location="${jboss.client}/wsdl4j.jar"/>
+ <pathelement location="${jboss.client}/jaxb-api.jar"/>
+ <pathelement location="${jboss.home}/lib/endorsed/xercesImpl.jar"/>
+
+
+ <pathelement location="${messaging.client.jar.name}"/>
+ <pathelement location="${jboss.home}/client/jbossall-client.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/lib/log4j.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/lib/javassist.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar"/>
+ <pathelement location="${jboss.home}/server/${jboss.configuration}/deploy/jboss-aop-jdk50.deployer/trove.jar"/>
+
+
+ </path>
+
+ <target name="identify">
+ <echo message="###########################################################################"/>
+ <echo message="# Running the WebServices example #"/>
+ <echo message="###########################################################################"/>
+ <echo message="The queue: ${example.queue.name}"/>
+ <echo message="The client jar: ${messaging.client.jar.name}"/>
+ </target>
+
+ <target name="sanity-check" depends="identify">
+ <available property="client.jar.present" file="${messaging.client.jar.name}"/>
+ <fail message="Could not find client jar ${messaging.client.jar.name}"
+ unless="client.jar.present"/>
+ </target>
+
+ <target name="init" depends="sanity-check">
+ <mkdir dir="./output/classes/META-INF"/>
+ <mkdir dir="./output/lib"/>
+ <mkdir dir="../common/output/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac destdir="../common/output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="../common/src"/>
+ <classpath refid="common.compilation.classpath"/>
+ </javac>
+ <javac destdir="./output/classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./src"/>
+ <classpath refid="runtime.classpath"/>
+ </javac>
+ </target>
+
+ <target name="run-wsdl-client" depends="compile">
+ <taskdef name="wstools" classname="org.jboss.ws.tools.ant.wstools">
+ <classpath refid="runtime.classpath"/>
+ </taskdef>
+
+ <mkdir dir="./output/client"/>
+
+ <get src="http://127.0.0.1:8080/jms-web-service/JMSWebServiceExample?wsdl" dest="./output/service.wsdl" />
+
+ <wstools config="./etc/client-config/client-config.xml"
+ dest="./output/client"/>
+ </target>
+
+
+ <target name="war" depends="compile">
+ <jar destfile="./output/lib/jms-web-service.war">
+ <zipfileset dir="./output/classes" prefix="WEB-INF/classes"/>
+ <zipfileset dir="./etc/WEB-INF" prefix="WEB-INF"/>
+ </jar>
+ </target>
+
+ <target name="deploy" depends="war">
+ <copy file="./etc/queue-destinations-service.xml" todir="${jboss.home}/server/${jboss.configuration}/deploy" />
+ <antcall target="sleep">
+ <param name="sleep.interval" value="5" />
+ </antcall>
+ <copy file="./output/lib/jms-web-service.war"
+ todir="${jboss.home}/server/${jboss.configuration}/deploy"/>
+ <antcall target="sleep"><param name="sleep.interval" value="10"/></antcall>
+ </target>
+
+ <target name="compile-client">
+ <mkdir dir="./output/client-classes"/>
+ <javac destdir="./output/client-classes" debug="on" debuglevel="lines,vars,source">
+ <src path="./output/client"/>
+ <src path="./src-client"/>
+ <classpath refid="runtime.classpath"/>
+ </javac>
+ </target>
+
+
+ <target name="run" depends="deploy, run-wsdl-client, compile-client">
+ <antcall target="send-and-receive"/>
+ <antcall target="undeploy"/>
+ </target>
+
+ <target name="send-and-receive">
+ <!-- The client expects to find the name of the queue to connect to as value of the
+ 'example.queue.name' property, which *may* be defined by calling ants when this example
+ is used in a smoke test -->
+ <java classname="org.jboss.example.jms.webservices.client.Client"
+ classpathref="client.classpath" fork="yes" failonerror="true">
+ <sysproperty key="example.queue.name" value="${example.queue.name}"/>
+ <sysproperty key="java.endorsed.dirs" value="${endorsed.dirs}" />
+ <!--
+ <jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_shmem,server=y,suspend=y,address=example"/>
+ -->
+ </java>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/jms-web-service.war"
+ quiet="true"/>
+ <delete file="${jboss.home}/server/${jboss.configuration}/deploy/queue-destinations-service.xml" quiet="true" />
+ </target>
+
+ <target name="clean" depends="undeploy">
+ <delete dir="./output" quiet="true"/>
+ <delete dir="../common/output" quiet="true"/>
+ </target>
+
+ <target name="sleep">
+ <echo message="Sleeping for ${sleep.interval} seconds ..."/>
+ <sleep seconds="${sleep.interval}"/>
+ </target>
+
+</project>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/WEB-INF/web.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/WEB-INF/web.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/WEB-INF/web.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
+ <servlet>
+ <servlet-name>JMSWebServiceExample</servlet-name>
+ <servlet-class>org.jboss.example.jms.webservices.endpoint.WebServiceExampleImpl</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>JMSWebServiceExample</servlet-name>
+ <url-pattern>/JMSWebServiceExample</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/client-config/client-config.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/client-config/client-config.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/client-config/client-config.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,8 @@
+<!-- This is a WebServices config file used by wsstools as showed on JBoss WebServices documentation -->
+
+<configuration>
+ <wsdl-java location="./output/service.wsdl">
+ <mapping location="jaxrpc-mapping.xml" />
+ </wsdl-java>
+</configuration>
+
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/jndi.properties
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/jndi.properties (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/jndi.properties 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,4 @@
+### JBossNS properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/queue-destinations-service.xml
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/queue-destinations-service.xml (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/etc/queue-destinations-service.xml 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Messaging Example Destinations
+ -->
+
+<server>
+
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.messaging.destination:service=Queue,name=testQueue"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ <attribute name="SecurityConfig">
+ <security>
+ <role name="guest" read="true" write="true"/>
+ <role name="publisher" read="true" write="true" create="false"/>
+ <role name="noacc" read="false" write="false" create="false"/>
+ </security>
+ </attribute>
+ </mbean>
+
+</server>
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExample.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.webservices.endpoint;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 2699 $</tt>
+ * $Id: WebServiceExample.java 2699 2007-05-17 05:59:03Z clebert.suconic at jboss.com $
+ */
+public interface WebServiceExample extends Remote
+{
+
+ // Constants ------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ // Public ---------------------------------------------------------------------------------------
+
+ public String sendMessage(String queueName, String message) throws RemoteException;
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src/org/jboss/example/jms/webservices/endpoint/WebServiceExampleImpl.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.webservices.endpoint;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.naming.InitialContext;
+import javax.jms.Destination;
+import javax.jms.ConnectionFactory;
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.MessageProducer;
+import java.rmi.RemoteException;
+
+
+/**
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 3971 $</tt>
+ * $Id: WebServiceExampleImpl.java 3971 2008-03-28 10:31:21Z jmesnil $
+ */
+ at WebService(serviceName="JMSSampleService", name="JMSSample")
+public class WebServiceExampleImpl implements WebServiceExample
+{
+
+ // Constants ------------------------------------------------------------------------------------
+
+ // Attributes -----------------------------------------------------------------------------------
+
+ // Static ---------------------------------------------------------------------------------------
+
+ // Constructors ---------------------------------------------------------------------------------
+
+ // Public ---------------------------------------------------------------------------------------
+
+ @WebMethod(operationName = "sendMessage")
+ public String sendMessage(String queueName, String message) throws RemoteException
+ {
+
+ Connection conn = null;
+ try
+ {
+ System.out.println("sending queue = " + queueName + " message = " + message);
+
+ InitialContext ctx = new InitialContext();
+ Destination dest = (Destination)ctx.lookup(queueName);
+
+ ConnectionFactory factory = (ConnectionFactory)ctx.lookup("/ConnectionFactory");
+ conn = factory.createConnection();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer producer = sess.createProducer(dest);
+ producer.send(sess.createTextMessage(message));
+
+
+ return "ok!";
+ }
+ catch (Exception e)
+ {
+ throw new RemoteException(e.getMessage());
+ }
+ finally
+ {
+ try
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ catch (Exception ignored)
+ {
+ ignored.printStackTrace();
+ }
+ }
+ }
+
+ // Package protected ----------------------------------------------------------------------------
+
+ // Protected ------------------------------------------------------------------------------------
+
+ // Private --------------------------------------------------------------------------------------
+
+ // Inner classes --------------------------------------------------------------------------------
+
+}
Added: projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java
===================================================================
--- projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java (rev 0)
+++ projects/docs/enterprise/5.0/Examples/jboss-messaging-examples/web-service/src-client/org/jboss/example/jms/webservices/client/Client.java 2009-10-16 06:29:24 UTC (rev 95004)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.example.jms.webservices.client;
+
+import org.jboss.example.jms.common.ExampleSupport;
+import org.jboss.example.jms.webservices.endpoint.JMSSample;
+import org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl;
+import org.jboss.ws.core.jaxrpc.client.ServiceImpl;
+import javax.xml.rpc.ServiceFactory;
+import javax.xml.rpc.ServiceException;
+import javax.xml.namespace.QName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.Destination;
+import javax.jms.ConnectionFactory;
+import javax.jms.Session;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.File;
+import java.rmi.RemoteException;
+
+import javax.jms.*;
+import javax.jms.IllegalStateException;
+
+/**
+ * This Client will use auto generated classes from WebServices. You need to compile this class using ant.
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ * @version <tt>$Revision: 3971 $</tt>
+ * $Id: Client.java 3971 2008-03-28 10:31:21Z jmesnil $
+ */
+public class Client extends ExampleSupport
+{
+ private static final String MESSAGE_TEXT = "Hello from a WebService!";
+
+ public void example() throws Exception
+ {
+ sendMessage();
+
+ receiveMessage();
+
+ System.out.println("Message was received ok!");
+ }
+
+ private void sendMessage()
+ throws ServiceException, MalformedURLException, RemoteException
+ {
+ ServiceFactoryImpl factory = (ServiceFactoryImpl) ServiceFactory.newInstance();
+
+ URL wsdlLocation = new URL("http://127.0.0.1:8080/jms-web-service/JMSWebServiceExample?wsdl");
+ QName serviceName = new QName("http://endpoint.webservices.jms.example.jboss.org/", "JMSSampleService");
+
+ File fileMapping = new File("./output/client/jaxrpc-mapping.xml");
+
+ ServiceImpl service = (ServiceImpl)factory.createService(wsdlLocation, serviceName, fileMapping.toURL());
+
+ JMSSample proxy = (JMSSample)service.getPort(JMSSample.class);
+
+ proxy.sendMessage(getDestinationJNDIName(), MESSAGE_TEXT);
+ }
+
+ private void receiveMessage()
+ throws NamingException, JMSException
+ {
+ InitialContext ctx = new InitialContext();
+ Destination dest = (Destination)ctx.lookup(getDestinationJNDIName());
+
+ ConnectionFactory cf = (ConnectionFactory)ctx.lookup("/ConnectionFactory");
+ Connection conn = cf.createConnection();
+ conn.start();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageConsumer consumer = sess.createConsumer(dest);
+ TextMessage msg = (TextMessage)consumer.receive(10000);
+
+ conn.close();
+
+ if (msg == null)
+ {
+ throw new IllegalStateException("Couldn't receive message");
+ }
+
+ if (!msg.getText().equals(MESSAGE_TEXT))
+ {
+ throw new IllegalStateException("Couldn't receive message");
+ }
+ }
+
+ protected boolean isQueueExample()
+ {
+ return true;
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ new Client().run();
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list