From do-not-reply at jboss.org Mon Oct 11 09:42:52 2010 Content-Type: multipart/mixed; boundary="===============8963711121745831908==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: hornetq-commits at lists.jboss.org Subject: [hornetq-commits] JBoss hornetq SVN: r9768 - trunk/docs/user-manual/en. Date: Mon, 11 Oct 2010 09:42:51 -0400 Message-ID: <201010111342.o9BDgpfg016578@svn01.web.mwc.hst.phx2.redhat.com> --===============8963711121745831908== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ataylor Date: 2010-10-11 09:42:51 -0400 (Mon, 11 Oct 2010) New Revision: 9768 Modified: trunk/docs/user-manual/en/appserver-integration.xml Log: https://jira.jboss.org/browse/HORNETQ-462 - added to JCA section Modified: trunk/docs/user-manual/en/appserver-integration.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 --- trunk/docs/user-manual/en/appserver-integration.xml 2010-10-11 12:34:44= UTC (rev 9767) +++ trunk/docs/user-manual/en/appserver-integration.xml 2010-10-11 13:42:51= UTC (rev 9768) @@ -28,7 +28,7 @@ outflow of messages sent from other JEE components, e.g. EJBs and = Servlets. This section explains the basics behind configuring the differen= t JEE components in the AS. -
+
Configuring Message-Driven Beans The delivery of messages to an MDB using HornetQ is configur= ed on the JCA Adapter via a configuration file ra.xml which can be fo= und under the
+ Configuring the JBoss Application Server to connect to Remo= te HornetQ Server + This is a step by step guide on how to configure a JBoss app= lication server that doesn't have HornetQ installed + to use a remote instance of HornetQ +
+ Configuring Jboss 5 + Firstly download and install JBoss AS 5 as per the JBoss= installation guide and HornetQ as per the + HornetQ installation guide. After thatt he following steps= are required + + + Copy the following jars from the HornetQ distrib= ution to the lib directory of + which ever JBossAs configuration you have chosen, i.e.= default. + + + hornetq-core-client.jar + + + hornetq-jms-client.jar + + + hornetq-ra.jar (this can be found inside= the hornetq-ra.rar archive) + + + netty.jar + + + + + create the directories hornetq-ra.rar and hornetq-ra.rar/META-INF + under the deploy directory in y= our JBoss config directory + + + under the hornetq-ra.rar/META-INF create a ra.xml file or + copy it from the HornetQ distribution (again it can be= found in the hornetq-ra.rar archive) + and configure it as follows + + <?xml version=3D"1.0" encoding=3D"UTF-8"?> + + <connector xmlns=3D"http://java.sun.com/xml/ns/= j2ee" + xmlns:xsi=3D"http://www.w3.org/2001/XML= Schema-instance" + xsi:schemaLocation=3D"http://java.sun.c= om/xml/ns/j2ee + http://java.sun.com/xml/ns/j2ee/connect= or_1_5.xsd" + version=3D"1.5"> + + <description>HornetQ 2.0 Resource Adapter Al= ternate Configuration</description> + <display-name>HornetQ 2.0 Resource Adapter A= lternate Configuration</display-name> + + <vendor-name>Red Hat Middleware LLC</vend= or-name> + <eis-type>JMS 1.1 Server</eis-type> + <resourceadapter-version>1.0</resourceada= pter-version> + + <license> + <description> + Copyright 2009 Red Hat, Inc. + Red Hat licenses this file to you under the Apach= e License, version + 2.0 (the "License"); you may not use this file ex= cept in compliance + with the License. You may obtain a copy of the L= icense at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in= writing, software + distributed under the License is distributed on a= n "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eit= her express or + implied. See the License for the specific langua= ge governing + permissions and limitations under the License. + </description> + <license-required>true</license-requir= ed> + </license> + + <resourceadapter> + <resourceadapter-class>org.hornetq.ra.Hor= netQResourceAdapter</resourceadapter-class> + <config-property> + <description>The transport type</de= scription> + <config-property-name>ConnectorClassNa= me</config-property-name> + <config-property-type>java.lang.String= </config-property-type> + <config-property-value>org.hornetq.cor= e.remoting.impl.netty.NettyConnectorFactory</config-property-value> + </config-property> + <config-property> + <description>The transport configurati= on. These values must be in the form of key=3Dval;key=3Dval;</descriptio= n> + <config-property-name>ConnectionParame= ters</config-property-name> + <config-property-type>java.lang.String= </config-property-type> + <config-prope= rty-value>host=3D127.0.0.1;port=3D5445</config-property-value> + </config-property> + + <outbound-resourceadapter> + <connection-definition> + <managedconnectionfactory-class>org= .hornetq.ra.HornetQRAManagedConnectionFactory</managedconnectionfactory-= class> + + <config-property> + <description>The default session= type</description> + <config-property-name>SessionDef= aultType</config-property-name> + <config-property-type>java.lang.= String</config-property-type> + <config-property-value>javax.jms= .Queue</config-property-value> + </config-property> + <config-property> + <description>Try to obtain a loc= k within specified number of seconds; less than or equal to 0 disable this = functionality</description> + <config-property-name>UseTryLock= </config-property-name> + <config-property-type>java.lang.= Integer</config-property-type> + <config-property-value>0</con= fig-property-value> + </config-property> + + <connectionfactory-interface>org.ho= rnetq.ra.HornetQRAConnectionFactory</connectionfactory-interface> + <connectionfactory-impl-class>org.h= ornetq.ra.HornetQRAConnectionFactoryImpl</connectionfactory-impl-class> + <connection-interface>javax.jms.Ses= sion</connection-interface> + <connection-impl-class>org.hornetq.= ra.HornetQRASession</connection-impl-class> + </connection-definition> + <transaction-support>XATransaction<= /transaction-support> + <authentication-mechanism> + <authentication-mechanism-type>Basi= cPassword</authentication-mechanism-type> + <credential-interface>javax.resourc= e.spi.security.PasswordCredential</credential-interface> + </authentication-mechanism> + <reauthentication-support>false</re= authentication-support> + </outbound-resourceadapter> + + <inbound-resourceadapter> + <messageadapter> + <messagelistener> + <messagelistener-type>javax.jms.= MessageListener</messagelistener-type> + <activationspec> + <activationspec-class>org.hor= netq.ra.inflow.HornetQActivationSpec</activationspec-class> + <required-config-property> + <config-property-name>des= tination</config-property-name> + </required-config-property> + </activationspec> + </messagelistener> + </messageadapter> + </inbound-resourceadapter> + + </resourceadapter> + </connector> + + + The important part of this configuration is the = part in bold, i.e. <config-property-value>host=3D127.0.0.1;port=3D5445&l= t;/config-property-value>. + This should be configured to the host and port of the = remote HornetQ server. + + + At this point you should be able to now deploy MDB's tha= t consume from the remote server. You will however, + have to make sure that your MDB's have the annotation @ResourceAdapter("hornetq-ra.rar") + added, this is illustrated in the Configuring Message-Driven Beans section. + If you don't want to add this annotation then you can delete t= he generic resource adapter jms-ra.rar + and rename the hornetq-ra.rar to this. + If you also want to use the remote HornetQ server for ou= tgoing connections, i.e. sending messages, then + do the following: + + + Create a file called hornetq-ds.xml in the deploy directory + (in fact you can call this anything you want as long a= s it ends in -ds.xml). Then + add the following: + + <connection-factories> + <!-- + JMS XA Resource adapter, use this for outbound JMS= connections. + Inbound connections are defined at the @MDB activa= tion or at the resource-adapter properties. + --> + <tx-connection-factory> + <jndi-name>RemoteJmsXA</jndi-name> + <xa-transaction/> + <rar-name>hornetq-ra.rar</rar-name> + <connection-definition>org.hornetq.ra.HornetQ= RAConnectionFactory</connection-definition> + <config-property name=3D"SessionDefaultType" = type=3D"java.lang.String">javax.jms.Topic</config-property> + <config-property name=3D"ConnectorClassName" = type=3D"java.lang.String">org.hornetq.core.remoting.impl.netty.NettyConnect= orFactory</config-property> + <config-property name=3D"ConnectionParameters= " type=3D"java.lang.String">host=3D127.0.0.1;port=3D5445</config-propert= y> + <max-pool-size>20</max-pool-size> + </tx-connection-factory> + + + </connection-factories> + + Again you will see that the host and port are co= nfigured here to match the remote HornetQ servers + configuration. The other important attributes are:= + + + jndi-name - This is the name used to loo= k up the JMS connection factory from within your JEE client + + + rar-name - This should match the directo= ry that you created to hold the Resource Adapter + configuration + + + + + Now you should be able to send messages using the JCA JM= S connection pooling within an XA transaction. +
+
+ Configuring Jboss 5 + The steps to do this are exactly the same as for JBoss 4= , you will have to create a jboss.xml definition + file for your MDB with the following entry + + <message-driven> + <ejb-name>MyMDB</ejb-name> + <resource-adapter-name>jms-ra.rar</resource= -adapter-name> + </message-driven> + + Also you will need to edit the standardjboss.xm= l and uncomment the section with the + following 'Uncomment to use JMS message inflow from jmsra.rar'= and then comment out the invoker-proxy-binding + called 'message-driven-bean' +
+
+
High Availability JNDI (HA-JNDI) If you are using JNDI to look-up JMS queues, topics and conn= ection factories from a cluster of servers, it is likely you will want to use HA-JNDI = so that your JNDI look-ups --===============8963711121745831908==--