Announcement Announcement Module
Collapse
No announcement yet.
Oracle AQ - specifying connection factory and creating queues Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 10:27 AM. Reason: Updating post

  • #2
    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

    Comment


    • #3
      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 ?

      Comment


      • #4
        problem solved
        thank you for all your replies

        Comment

        Working...
        X