Hi,
  I'm trying to utilize (in the attached activemq configuration file)
the derby-ds DataSource that is commented out in the default
configuration, which has the bean element

 <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
   <property name="databaseName" value="derbydb"/>
   <property name="createDatabase" value="create"/>
</bean>

  I'm also writing an interceptor that extends BrokerFilter, so that
I can have an ActiveMQ-specific plugin.  My question is, how would I
obtain the "derby-ds" DataSource in my BrokerFilter-based plugin?  (I
have the suspicion that this is an extremely simple question, but I
don't know the answer and I'm not familiar enough with Spring to find
it. :)
  Thanks!

--
  J. Patrick Bedell
  [EMAIL PROTECTED]
  http://infoeng.sourceforge.net
  http://rothbardix.blogspot.com
<!-- START SNIPPET: example -->
<beans xmlns="http://activemq.org/config/1.0";
       xmlns:p="java://org.infoeng.ictp.test">

  <!-- Allows us to use system properties as variables in this configuration file -->
  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

  <jetty xmlns="http://mortbay.com/schemas/jetty/1.0";>
    <connectors>
      <nioConnector port="8181" />
    </connectors>
    
    <handlers>
      <webAppContext contextPath="/" resourceBase="webapp"
		     parentLoaderPriority="false" />
    </handlers>
  </jetty>

  <broker useJmx="true">
  
    <!--  Use the following to set the broker memory limit (in bytes)
    <memoryManager>  
        <usageManager id="memory-manager" limit="1048576"/>
    </memoryManager>
    -->
    
    <!-- Use the following to configure how ActiveMQ is exposed in JMX
    <managementContext>
       <managementContext connectorPort="1099" jmxDomainName="org.apache.activemq"/>
    </managementContext>
    -->

    <plugins>
      
      <p:TestICTPInterceptor />
      
    </plugins>


    <!-- In ActiveMQ 4, you can setup destination policies -->  
    <destinationPolicy>
      <policyMap><policyEntries>
        
          <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>
	  
      </policyEntries></policyMap>
    </destinationPolicy>
    
    <persistenceAdapter>
        <journaledJDBC journalLogFiles="5" dataDirectory="${activemq.home}/activemq-data"/>
      <!-- To use a different datasource, use th following syntax : -->
      <!-- 
      <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data" dataSource="#postgres-ds"/>
       -->
    </persistenceAdapter>
  
    <transportConnectors>
       <transportConnector name="default" uri="tcp://localhost:61616" discoveryUri="multicast://default"/>

       <transportConnector name="stomp"   uri="stomp://localhost:61613"/>

    </transportConnectors>
    
    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector name="default" uri="multicast://default"/>
      <!--
      <networkConnector name="host1 and host2" uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
      -->
    </networkConnectors>
    
  </broker>
  
  <!--  This xbean configuration file supports all the standard spring xml configuration options -->
  
  <!-- Postgres DataSource Sample Setup -->
  <!-- 
  <bean id="postgres-ds" class="org.postgresql.ds.PGPoolingDataSource">
    <property name="serverName" value="localhost"/>
    <property name="databaseName" value="activemq"/>
    <property name="portNumber" value="0"/>
    <property name="user" value="activemq"/>
    <property name="password" value="activemq"/>
    <property name="dataSourceName" value="postgres"/>
    <property name="initialConnections" value="1"/>
    <property name="maxConnections" value="10"/>
  </bean>
  -->
  
  <!-- MySql DataSource Sample Setup -->
  <!-- 
  <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
    <property name="username" value="activemq"/>
    <property name="password" value="activemq"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>
  -->  
   
  <!-- Embedded Derby DataSource Sample Setup -->
  <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
    <property name="databaseName" value="derbydb"/>
    <property name="createDatabase" value="create"/>
  </bean>

  <!--
  <bean id="Server"
	class="org.mortbay.jetty.Server" init-method="start" destroy-method="stop">
    <property name="connectors">
      <list>
	<bean id="Connector" class="org.mortbay.jetty.nio.SelectChannelConnector">
	  <property name="port" value="8181"/>
	</bean>
      </list>
    </property>

    <property name="handler">
      <bean id="handlers"
	    class="org.mortbay.jetty.handler.HandlerCollection">
	<property name="handlers">
	  <list>
	    <bean id="contexts"
		  class="org.mortbay.jetty.handler.ContextHandlerCollection">
	      <property name="handlers">
		<list>
		  <bean class="org.mortbay.jetty.webapp.WebAppContext">
		    <property name="contextPath" value="/"/>
		    <property name="resourceBase" value="webapp"/>
		    <property name="parentLoaderPriority" value="false"/>
		  </bean>
		</list>
	      </property>
	    </bean>
	  </list>
	</property>
      </bean>
    </property>
  </bean>
  -->



</beans>
<!-- END SNIPPET: example -->

Reply via email to