Results 1 to 4 of 4

Thread: Oracle AQ - specifying connection factory and creating queues

  1. #1
    Join Date
    Oct 2008
    Location
    Frankfurt
    Posts
    4

    Default Oracle AQ - specifying connection factory and creating queues

    Hello everyone,

    I am trying to connect to a remote Oracle AQ broker. I have something that looks like this:

    Code:
    <bean id="connectionFactoryOracleAQ" class="oracle.jms.AQjmsFactory"
    		factory-method="getQueueConnectionFactory">
    		<constructor-arg index="0">
    			<value>host</value>
    		</constructor-arg>
    		<constructor-arg index="1" type="java.lang.String">
    			<value>db-id</value>
    		</constructor-arg>
    		<constructor-arg index="2" type="int">
    			<value>1521</value>
    		</constructor-arg>
    		<constructor-arg index="3">
    			<value>thin</value>
    		</constructor-arg>
    	</bean>
    Later I have to specify the username and password. My question is whether the following way of doing it is correct:

    Code:
    <bean id="jmsConnector"
    		class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
    		<property name="targetConnectionFactory">
    			<ref bean="connectionFactoryOracleAQ"/>
    		</property>
    		<property name="username">
    			<value>myUsername</value>
    		</property>
    		<property name="password">
    			<value>myPassword</value>
    		</property>
    	</bean>
    I basically want to read from a remote queue, say TEST and then just put what I read on an internal queue.
    I succeeded doing that with a remote Acive MQ broker. I declared a camel context and did the routing with camel.

    Code:
    <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
    		<property name="connectionFactory">
    			<bean class="org.apache.activemq.ActiveMQConnectionFactory">
    				<property name="brokerURL"
    					value="tcp://host:port"/>
    			</bean>
    		</property>
    </bean>
    
    <camelContext id="camel"
    		xmlns="activemq.apache.org/camel/schema/spring">
    		<route>
    			<from uri="jms:TEST"/>
    			<to uri="activemq:internalQUEUE"/>
    		</route>
    </camelContext>
    As you can see by saying jms:TEST, my application looks to read from a queue TEST on the remote active MQ broker defined by the "jms" bean.
    I could do the same in this case, but the problem happens when I need to pass the password and the username.

    Is there any spring virtuoso that can help me with this ?
    Last edited by selezovikj; Oct 7th, 2008 at 10:27 AM. Reason: Updating post

  2. #2
    Join Date
    Oct 2008
    Location
    Frankfurt
    Posts
    4

    Default

    And what is this thing about not being able to post links if you haven't made 15 posts ?
    Come on guys ... I have a link inside my code

  3. #3
    Join Date
    Oct 2008
    Location
    Frankfurt
    Posts
    4

    Default

    Ok I figured it out.
    But I still need help with injecting a bean.
    Can anyone tell me if this is valid:

    Code:
    <bean id="connectionFactoryOracleAQ" class="oracle.jms.AQjmsFactory"
                    factory-method="getQueueConnectionFactory">
                    <constructor-arg index="0">
                            <value>host</value>
                    </constructor-arg>
                    <constructor-arg index="1" type="java.lang.String">
                            <value>db-id</value>
                    </constructor-arg>
                    <constructor-arg index="2" type="int">
                            <value>1521</value>
                    </constructor-arg>
                    <constructor-arg index="3">
                            <value>thin</value>
                    </constructor-arg>
    </bean> 
    
    <bean id="credentials"
                    class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
                    <property name="targetConnectionFactory">
                            <ref bean="connectionFactoryOracleAQ"/>
                    </property>
                    <property name="username">
                            <value>USER</value>
                    </property>
                    <property name="password">
                            <value>PASS</value>
                    </property>
    </bean>
           
    <bean id="jms2" class="org.apache.camel.component.jms.JmsComponent">
            <property name="connectionFactory">
                <inject bean="credentials"/>
            </property>
    </bean>
    Is this the way to inject a bean ?

  4. #4
    Join Date
    Oct 2008
    Location
    Frankfurt
    Posts
    4

    Default

    problem solved
    thank you for all your replies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •