From do-not-reply at jboss.org Tue Jan 17 09:42:43 2012 Content-Type: multipart/mixed; boundary="===============2774782201339902784==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: hornetq-commits at lists.jboss.org Subject: [hornetq-commits] JBoss hornetq SVN: r12033 - branches/Branch_2_2_AS7/hornetq-rest/docbook/reference/en. Date: Tue, 17 Jan 2012 09:42:43 -0500 Message-ID: <201201171442.q0HEghn8014693@svn01.web.mwc.hst.phx2.redhat.com> --===============2774782201339902784== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: jbertram Date: 2012-01-17 09:42:43 -0500 (Tue, 17 Jan 2012) New Revision: 12033 Modified: branches/Branch_2_2_AS7/hornetq-rest/docbook/reference/en/master.xml Log: HORNETQ-823 Modified: branches/Branch_2_2_AS7/hornetq-rest/docbook/reference/en/master.= xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/Branch_2_2_AS7/hornetq-rest/docbook/reference/en/master.xml 20= 12-01-17 14:40:25 UTC (rev 12032) +++ branches/Branch_2_2_AS7/hornetq-rest/docbook/reference/en/master.xml 20= 12-01-17 14:42:43 UTC (rev 12033) @@ -30,7 +30,8 @@ here's a simple example of posting an order to an order processing que= ue express as an HTTP message: = - POST /queue/orders/create HTTP/1.1 + +POST /queue/orders/create HTTP/1.1 Host: example.com Content-Type: application/xml = @@ -38,8 +39,7 @@ <name>Bill</name> <item>iPhone 4</item> <cost>$199.99</cost> -</order> -As you can see, we're just posting some arbitrary XML +</order>As you can see, we're just posting some arb= itrary XML document to a URL. When the XML is received on the server is it proces= sed within HornetQ as a JMS message and distributed through core HornetQ. Simple and easy. Consuming messages from a queue or topic looks very @@ -101,19 +101,21 @@ depends on the RESTEasy project and can currently only run within a servlet container. Install= ing the HornetQ REST interface is a little bit different depending whether - HornetQ is already installed and configured for your environment (i.e. - you're deploying within JBoss 6 AppServer) or you want the HornetQ REST - WAR to startup and manage the HornetQ server. + HornetQ is already installed and configured for your environment (e.g. + you're deploying within JBoss AS 7) or you want the HornetQ REST + WAR to startup and manage the HornetQ server (e.g. you're deploying + within Tomcat). = Installing Within Pre-configured Environment = The section should be used when you want to use the HornetQ RE= ST interface in an environment that already has HornetQ installed and - running, i.e. JBoss 6 Application Server. You must create a Web arch= ive + running, e.g. JBoss AS 7. You must create a Web archive (.WAR) file with the following web.xml settings: = - <web-app> + +<web-app> <listener> <listener-class>org.jboss.resteasy.plugins.server.servlet.Re= steasyBootstrap</listener-class> </listener> @@ -133,22 +135,27 @@ <filter-name>Rest-Messaging</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> +</web-app> = -</web-app - Within your WEB-INF/lib directory you must have the hornetq-rest.jar file. If RESTEasy is not installed within your environment, you must add the RESTEasy jar files within the lib - directory as well. Here's a sample Maven pom.xml that can build your= WAR - for this case. + directory as well (note: RESTEasy is available in most JBoss AS + 7 profiles). Here's a sample Maven pom.xml that can build your + WAR for this case. If you are unfamiliar with the Maven WAR = + plugin please reference the + Maven documentation. = - <project xmlns=3D"http://maven.apache.org/POM/4.0= .0" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" + +<project xmlns=3D"http://maven.apache.org/POM/4.0.0" xmlns:xsi=3D"http:= //www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=3D"http://maven.apache.org/POM/4.0.0 http://ma= ven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.somebody</groupId> <artifactId>myapp</artifactId> <packaging>war</packaging> <name>My App</name> + <version>0.1-SNAPSHOT</version> <repositories> <repository> <id>jboss</id> @@ -156,8 +163,8 @@ </repository> </repositories> = - - <build> + <build> + <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -175,10 +182,26 @@ <version>2.2.6.Final</version> </dependency> </dependencies> -</project> - +</project> = - + JBoss AS 7 loads classes differently than previous versi= ons. + To work properly in AS 7 the the WAR will need this in its MANIFEST.= MF: + Dependencies: org.hornetq, org.jboss.netty + You can add this to the <plugins> sec= tion of the + pom.xml to create this entry automatically: +<plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <archive> + <manifestEntries> + <Dependencies>org.hornetq, org.jboss.netty</Depen= dencies> + </manifestEntries> + </archive> + </configuration> +</plugin> + + = @@ -192,12 +215,12 @@ REST distribution show how to do this. You must also add an addition= al listener to your web.xml file. Here's an example: = - <web-app> + +<web-app> <listener> <listener-class>org.jboss.resteasy.plugins.server.servlet.Re= steasyBootstrap</listener-class> </listener> = - <listener> <listener-class>org.hornetq.rest.integration.HornetqBootstra= pListener</listener-class> </listener> @@ -217,7 +240,6 @@ <filter-name>Rest-Messaging</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> - </web-app> = Here's a Maven pom.xml file for creating a WAR for this @@ -225,13 +247,15 @@ src/main/resources directory so that they are stuffed within the WAR= 's WEB-INF/classes directory! = - <project xmlns=3D"http://maven.apache.org/POM/4.0= .0" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" + +<project xmlns=3D"http://maven.apache.org/POM/4.0.0" xmlns:xsi=3D"http:= //www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=3D"http://maven.apache.org/POM/4.0.0 http://ma= ven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.somebody</groupId> <artifactId>myapp</artifactId> <packaging>war</packaging> <name>My App</name> + <version>0.1-SNAPSHOT</version> <repositories> <repository> <id>jboss</id> @@ -239,6 +263,7 @@ </repository> </repositories> <build> + <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> @@ -253,16 +278,17 @@ <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-core</artifactId> - <version>2.1.1.GA</version> + <version>2.2.9.AS7.Final</version> </dependency> <dependency> <groupId>org.jboss.netty</groupId> <artifactId>netty</artifactId> + <version>3.2.7.Final</version> </dependency> <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-jms</artifactId> - <version>2.1.1.GA</version> + <version>2.2.9.AS7.Final</version> </dependency> <dependency> <groupId>org.jboss.spec.javax.jms</groupId> @@ -277,12 +303,12 @@ <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxrs</artifactId> - <version>2.0.1.GA</version> + <version>2.3.0.GA</version> </dependency> <dependency> <groupId>org.jboss.resteasy</groupId> <artifactId>resteasy-jaxb-provider</artifactId> - <version>2.0.1.GA</version> + <version>2.3.0.GA</version> </dependency> </dependencies> </project> @@ -300,7 +326,8 @@ configuration file. Below is the format of the XML configuration file and the default values for each. = - <rest-messaging> + +<rest-messaging> <server-in-vm-id>0</server-in-vm-id> <use-link-headers>false</use-link-headers> <default-durable-send>false</default-durable-send> @@ -311,8 +338,7 @@ <session-timeout-task-interval>1</session-timeout-task-interva= l> <consumer-session-timeout-seconds>300</consumer-session-timeou= t-seconds> <consumer-window-size>-1</consumer-window-size> -</rest-messaging - +</rest-messaging = Let's give an explanation of each config option. = @@ -435,9 +461,9 @@ To interact with a queue or topic you do a HEAD or GET request= on the following relative URI pattern: = - /queues/{name} -/topics/{name} - + +/queues/{name} +/topics/{name} = The base of the URI is the base URL of the WAR you deployed the HornetQ REST server within as defined in the Installation and @@ -453,15 +479,15 @@ perform your HEAD or GET request on this URI. Here's what a request/response would look like. = - HEAD /queues/jms.queue.bar HTTP/1.1 + +HEAD /queues/jms.queue.bar HTTP/1.1 Host: example.com = --- Response --- HTTP/1.1 200 Ok msg-create: http://example.com/queues/jms.queue.bar/create msg-pull-consumers: http://example.com/queues/jms.queue.bar/pull-consumers -msg-push-consumers: http://example.com/queues/jms.queue.bar/push-consumers - +msg-push-consumers: http://example.com/queues/jms.queue.bar/push-consumers= = The HEAD or GET response contains a number of custom response headers that are URLs to additional REST resources that allow you to @@ -644,7 +670,7 @@ = - It is VERY IMPORTENT that you never re-use + It is VERY IMPORTANT that you never re-use returned msg-create-next headers to post new messag= es. This URL may be uniquely generated for each message and used for dupli= cate detection. If you lose the URL within the --===============2774782201339902784==--