Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.0-rc2
  • Fix Version/s: 1.0
  • Component/s: Transport: JMS
  • Labels:
    None
  • Environment:
  • Similar Issues:
    None

Description

This connector will let Mule talk via the jms api to a queue in an oracle database without using jndi. We needed this feature because with oracle standard edition, one can not export a queue to a repository.
This connector can e.g. be used to send a jms message when some table has changed in the database.

  1. JmsConnector.java
    02/Feb/05 02:22 AM
    14 kB
    Henk
  2. JmsOracleAQSupport.java
    10/Feb/05 07:18 AM
    7 kB
    Henk
  3. JmsOracleAQSupport.java
    02/Feb/05 02:24 AM
    7 kB
    Henk
  4. OracleAQConnector.java
    10/Feb/05 07:17 AM
    4 kB
    Henk

Activity

Hide
Henk added a comment -

The changed jmsConnector class.

Show
Henk added a comment - The changed jmsConnector class.
Hide
Henk added a comment -

The oracle aq support. It provides the JmsOracleAQSupport class.

Show
Henk added a comment - The oracle aq support. It provides the JmsOracleAQSupport class.
Hide
Henk added a comment -

The way to configure the connector :

<connector name="oracleAQConnector"
className="org.mule.providers.jms.JmsConnector">
<properties>
<property name="specification" value="oracleAQ" />
<property name="username" value="user" />
<property name="password" value="pass" />
<property name="oracleAQHost" value="host" />
<property name="oracleAQDB" value="db" />
<property name="oracleAQPort" value="1521" />
<property name="oracleAQDrivername" value="oci8" />
</properties>
</connector>

Show
Henk added a comment - The way to configure the connector : <connector name="oracleAQConnector" className="org.mule.providers.jms.JmsConnector"> <properties> <property name="specification" value="oracleAQ" /> <property name="username" value="user" /> <property name="password" value="pass" /> <property name="oracleAQHost" value="host" /> <property name="oracleAQDB" value="db" /> <property name="oracleAQPort" value="1521" /> <property name="oracleAQDrivername" value="oci8" /> </properties> </connector>
Hide
Ross Mason added a comment -

Why is the JmsOracleAQSupport needed? Also it contains some hardcoded info -

if (session instanceof XAQueueSession

session instanceof AQjmsSession) { //return ((AQjmsSession) session).getQueue(nameComponents[0], // nameComponents[1]); return ((AQjmsSession) session).getQueue("stephane", name); } else tok1-block-tok
Show
Ross Mason added a comment - Why is the JmsOracleAQSupport needed? Also it contains some hardcoded info - if (session instanceof XAQueueSession
session instanceof AQjmsSession) { //return ((AQjmsSession) session).getQueue(nameComponents[0], // nameComponents[1]); return ((AQjmsSession) session).getQueue("stephane", name); } else tok1-block-tok
Hide
Henk added a comment -

JmsOracleAQSupport is needed because of the not-very-standard way one gets a reference to a queue.
You can see we have to add the DB schema in the getQueue method.
Here it is hardcoded because until now I have no way of providing this info to the JmsOracleAQSupport class.
One solution is make an alias in the oracle db for this queue so that the schema name is not neccessary.

Note that I have cleaned up stuff a bit. I will shortly introduce a OracleAQConnector which extends jmsConnector.
Still struggling with transaction support though.

Show
Henk added a comment - JmsOracleAQSupport is needed because of the not-very-standard way one gets a reference to a queue. You can see we have to add the DB schema in the getQueue method. Here it is hardcoded because until now I have no way of providing this info to the JmsOracleAQSupport class. One solution is make an alias in the oracle db for this queue so that the schema name is not neccessary. Note that I have cleaned up stuff a bit. I will shortly introduce a OracleAQConnector which extends jmsConnector. Still struggling with transaction support though.
Hide
Ross Mason added a comment -

Why don't you make the schema name a property of the connector and pass it into the custom OracleJmsSupport in the constructor.

Also this class should extend Jms102bSupport and only override the necessary methods.

Same goes for the connector, but you have done that I think. Something like this will work -

public class OracleJmsConnector extends JmsConnector
{
/* CHANGE BY HENK */
public String oracleAQHost = null;

public String oracleAQDB = null;

public int oracleAQPort;

public String oracleAQDrivername = null;

/* END CHANGE BY HENK */

/*

  • (non-Javadoc)
  • @see org.mule.providers.UMOConnector#create(java.util.HashMap)
    */
    public void doInitialise() throws InitialisationException {
    initFromServiceDescriptor();
    try {
    //If we have a connection factory, there is no need to initialise
    //the JndiContext
    if (getConnectionFactory() == null) { initJndiContext(); } else { //Set these to false so that the jndiContext //will not be used by the JmsSupport classes setJndiDestinations(false); setForceJndiDestinations(false); }
    /* CHANGE BY HENK */
    setJmsSupport(new OracleJmsSupport(getJndiContext(),
    isJndiDestinations(), isForceJndiDestinations()));

/* END CHANGE BY HENK */
setConnection(createConnection());
} catch (Exception e) { throw new InitialisationException( "Failed to create Jms Connector: " + e.getMessage(), e); }
}

protected ConnectionFactory createConnectionFactory()
throws InitialisationException, NamingException {

try { return AQjmsFactory.getQueueConnectionFactory(oracleAQHost, oracleAQDB, oracleAQPort, oracleAQDrivername); } catch (JMSException e) { throw new InitialisationException( "Unable to get Oracle AQ connectionfactory."); }

}

public String getUsername() { return username; }

public void setUsername(String username) { this.username = username; }

public String getPassword() { return password; }

public void setPassword(String password) { this.password = password; }

public String getOracleAQHost() { return oracleAQHost; }

public void setOracleAQHost(String oracleAQHost) { this.oracleAQHost = oracleAQHost; }

public int getOracleAQPort() { return oracleAQPort; }

public void setOracleAQPort(int oracleAQPort) { this.oracleAQPort = oracleAQPort; }

public String getOracleAQDrivername() { return oracleAQDrivername; }

public void setOracleAQDrivername(String oracleAQDrivername) { this.oracleAQDrivername = oracleAQDrivername; }

public String getOracleAQDB() { return oracleAQDB; }

public void setOracleAQDB(String oracleAQDB) { this.oracleAQDB = oracleAQDB; }

}

Show
Ross Mason added a comment - Why don't you make the schema name a property of the connector and pass it into the custom OracleJmsSupport in the constructor. Also this class should extend Jms102bSupport and only override the necessary methods. Same goes for the connector, but you have done that I think. Something like this will work - public class OracleJmsConnector extends JmsConnector { /* CHANGE BY HENK */ public String oracleAQHost = null; public String oracleAQDB = null; public int oracleAQPort; public String oracleAQDrivername = null; /* END CHANGE BY HENK */ /*
  • (non-Javadoc)
  • @see org.mule.providers.UMOConnector#create(java.util.HashMap) */ public void doInitialise() throws InitialisationException { initFromServiceDescriptor(); try { //If we have a connection factory, there is no need to initialise //the JndiContext if (getConnectionFactory() == null) { initJndiContext(); } else { //Set these to false so that the jndiContext //will not be used by the JmsSupport classes setJndiDestinations(false); setForceJndiDestinations(false); } /* CHANGE BY HENK */ setJmsSupport(new OracleJmsSupport(getJndiContext(), isJndiDestinations(), isForceJndiDestinations()));
/* END CHANGE BY HENK */ setConnection(createConnection()); } catch (Exception e) { throw new InitialisationException( "Failed to create Jms Connector: " + e.getMessage(), e); } } protected ConnectionFactory createConnectionFactory() throws InitialisationException, NamingException { try { return AQjmsFactory.getQueueConnectionFactory(oracleAQHost, oracleAQDB, oracleAQPort, oracleAQDrivername); } catch (JMSException e) { throw new InitialisationException( "Unable to get Oracle AQ connectionfactory."); } } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getOracleAQHost() { return oracleAQHost; } public void setOracleAQHost(String oracleAQHost) { this.oracleAQHost = oracleAQHost; } public int getOracleAQPort() { return oracleAQPort; } public void setOracleAQPort(int oracleAQPort) { this.oracleAQPort = oracleAQPort; } public String getOracleAQDrivername() { return oracleAQDrivername; } public void setOracleAQDrivername(String oracleAQDrivername) { this.oracleAQDrivername = oracleAQDrivername; } public String getOracleAQDB() { return oracleAQDB; } public void setOracleAQDB(String oracleAQDB) { this.oracleAQDB = oracleAQDB; } }
Hide
Henk added a comment -

Here is the connector that works if you don't use transactions.

Show
Henk added a comment - Here is the connector that works if you don't use transactions.
Hide
Henk added a comment -

updated

Show
Henk added a comment - updated
Hide
Henk added a comment -

Hi,

I have updated the jmsOracleAQSupport class and added the OracleAQConnector.
You can remove the old files.
I resolved the issue with the hardcoded schema.
The OracleAQConnector uses an XAConnection to oracle, but for the moment this does not seem to work. I will have to look into it. One thing I noticed was that for XA transactions to work in oracle, you have to get an Xid. This is something that the transaction manager should do. Tyrex doesn't and I haven't used another manager.

Show
Henk added a comment - Hi, I have updated the jmsOracleAQSupport class and added the OracleAQConnector. You can remove the old files. I resolved the issue with the hardcoded schema. The OracleAQConnector uses an XAConnection to oracle, but for the moment this does not seem to work. I will have to look into it. One thing I noticed was that for XA transactions to work in oracle, you have to get an Xid. This is something that the transaction manager should do. Tyrex doesn't and I haven't used another manager.
Hide
Ross Mason added a comment -

Hi,

what's the status of this?

Ross

Show
Ross Mason added a comment - Hi, what's the status of this? Ross
Hide
Henk added a comment -

It should work. We have a problem with our Oracle 9i installation which has some issues with XA transactions. We will need to patch our server, which is out of my hands. My guess is that the code works if one has a solid installation of oracle 9i or greater.

Show
Henk added a comment - It should work. We have a problem with our Oracle 9i installation which has some issues with XA transactions. We will need to patch our server, which is out of my hands. My guess is that the code works if one has a solid installation of oracle 9i or greater.
Hide
Ross Mason added a comment -

Hi,
I have checked this code in under a new project in the sandbox called vendor-patches.
This code can be found under oracle-aq/src/java/org/mule/vendor/oracle/aq (note I have changed the package name).

Thanks for submitting this. Please keep it updated if you find any bugs.

Cheers,

Ross

Show
Ross Mason added a comment - Hi, I have checked this code in under a new project in the sandbox called vendor-patches. This code can be found under oracle-aq/src/java/org/mule/vendor/oracle/aq (note I have changed the package name). Thanks for submitting this. Please keep it updated if you find any bugs. Cheers, Ross

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: