Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. You will need to make a few jars available to Fedora so it can load and process the ActiveMQ configuration file. Drop the jars xbean-spring-3.4.3.jar and spring-context-2.5.6.jar files into the Fedora webapp WEB-INF/lib directory. It Fedora 3.8, updated copies of these jars are already included.  Most Spring applications provide these jars; if you are using Apache ServiceMix as the container for your remote broker, they can be found in the SERVICEMIX_HOME/lib directory.
  2. Create the Fedora activemq.xml file, put it in FEDORA_HOME/server/config (in newer versions like Fedora 3.8 use FEDORA_HOME/server/config/spring)

    Code Block
    xml
    xml
    borderStylesolid
    <beans xmlns:amq="http://activemq.apache.org/schema/core">
    
      <!-- ActiveMQ JMS Broker configuration -->
      <amq:broker id="broker" useShutdownHook="false">
    
        <amq:managementContext>
          <amq:managementContext connectorPort="1093" createConnector="false"/>
        </amq:managementContext>
    
        <!-- Your remote broker, configured with failover -->
        <amq:networkConnectors>
          <amq:networkConnector uri="static:(failover:(tcp://0.0.0.0:61617))"/>
        </amq:networkConnectors>
    
        <!-- The directory where Fedora will store the ActiveMQ data -->
        <amq:persistenceAdapter>
          <amq:amqPersistenceAdapter directory="file:./data/amq"/>
        </amq:persistenceAdapter>
      </amq:broker>
    
      <!-- Set this to prevent objects from being serialized when
           passed along to your embedded broker;  saves some overhead processing -->
      <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
         <property name="objectMessageSerializationDefered" value="false"/>
    
      </bean>
    
    </beans>
    
    

    This piece of the config file creates the bridge to the remote broker, configured in failover mode:

    Code Block
    xml
    xml
    borderStylesolid
    <amq:networkConnectors>
      <amq:networkConnector uri="static:(failover:(tcp://0.0.0.0:61617))"/>
    </amq:networkConnectors>
    
  3. Configure Fedora to read the activemq.xml file upon startup, create the embedded broker.
    Make sure messaging is enabled in fedora.fcfg:

    Code Block
    xml
    xml
    borderStylesolid
    <module role="org.fcrepo.server.messaging.Messaging" class="org.fcrepo.server.messaging.MessagingModule">
      <comment>Fedora's Java Messaging Service (JMS) Module</comment>
      <param name="enabled" value="true"/>
    [...]
    

    Also change the java.naming.provider.url parameter:

    Code Block
    xml
    xml
    borderStylesolid
    <param name="java.naming.provider.url" value="vm://localhost?brokerConfig=xbean:file:/path/to/fedora_home/server/config/activemq.xml"/>
    
     
    In newer versions like Fedora 3.8
     
    <param name="java.naming.provider.url" value="vm://localhost?brokerConfig=xbean:file:/path/to/fedora_home/server/config/spring/activemq.xml"/>
  4. Restart Fedora, and start up your remote broker (or the other way around: it no longer matters).
    The ActiveMQ failover transport documentation contains a list of useful parameters that you can use to configure connection management to the remote broker (max reconnect attempts, period between reconnects, etc.)

...