[jboss-user] [JCA/JBoss] - Re: MDB with Oracle AQ via Sun Adapter
kr8670
do-not-reply at jboss.com
Tue May 12 15:59:25 EDT 2009
Hi,
Well, the version of oracleaq.rar is as checked out from cvs, cvs log shows:
| revision 1.1.1.1
| date: 2007/02/22 10:40:10; author: sauvage; state: Exp; lines: +0 -0
| Oracle AQ JMS Resource Adapter based on Generic JMS RA 1.7
|
The ra.xml inside tells me:<resourceadapter-version>1.8</resourceadapter-version>
If you are referring to which version of aqapi.jar, I picked the one that came with 10.2.0.3.0. The one with file size 1234676 bytes also gave me possibility to use OCI instead of thin driver. I put he aqapi.jar in server/lib, oracleaq.rar in server/deploy.
I use jboss-4.2.3.GA, SEAM as developement framework, Suse Linux. This is more or less my setup:
| @MessageDriven(name="ChangeListener",activationConfig={
| @ActivationConfigProperty(propertyName="DestinationType", propertyValue="javax.jms.Queue")
| })
|
| @ResourceAdapter("oracleaq.rar")
| @Name("changeListener")
| @TransactionManagement(TransactionManagementType.BEAN)
| @Depends("jboss.j2ee:service=EARDeployment,url='crm.ear'")
| public class ChangeListener implements MessageListener {
|
| @Logger
| private Log log;
|
| @Resource
| private SessionContext sessionContext;
|
| public void onMessage(Message msg) {
| final UserTransaction transaction = sessionContext.getUserTransaction();
|
| try {
| transaction.begin();
| if (msg instanceof TextMessage) {
| ...stuff
| } else {
| log.error("Unknown");
| }
| transaction.commit();
| } catch (Exception e) {
| try {
| transaction.rollback();
| } catch (IllegalStateException e1) {
| e1.printStackTrace();
| } catch (SecurityException e1) {
| e1.printStackTrace();
| } catch (SystemException e1) {
| e1.printStackTrace();
| }
| e.printStackTrace();
| }
| }
| }
|
Most of the config goes in ejb-jar.xml to be able to switch config according to environment:
| <enterprise-beans>
| <message-driven>
| <ejb-name>ChangeListener</ejb-name>
| <ejb-class>bkk.crm.admin.ChangeListener</ejb-class>
| <transaction-type>Bean</transaction-type>
| <activation-config>
| <activation-config-property>
| <activation-config-property-name>DestinationType</activation-config-property-name>
| <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>ConnectionFactoryProperties</activation-config-property-name>
| <activation-config-property-value>@mdbConnectionFactoryProperties@</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>DestinationProperties</activation-config-property-name>
| <activation-config-property-value>@mdbDestinationProperties@</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>UserName</activation-config-property-name>
| <activation-config-property-value>@mdbUserName@</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
| <activation-config-property-name>Password</activation-config-property-name>
| <activation-config-property-value>@mdbPassword@</activation-config-property-value>
| </activation-config-property>
| </activation-config>
| </message-driven>
| </enterprise-beans>
|
But, as you already have got to the point where the first message is delivered, this is familiar to you. Anyway, I hope it helps.
Regards
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4230607#4230607
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4230607
More information about the jboss-user
mailing list