Broker Configuration

With multiple listeners, it is better to have fedora messages pushed to a remote broker for higher availability. This means that when Fedora (i.e. Tomcat) is restarted, any listeners won't notice the change – this further decouples fedora from other components such as Solr.

The configuration first requires following the steps described in the Fedora Messaging guide. This involves changing the value of java.naming.provider.url in fedora.fcfg and creating an activemq.xml configuration file. I also changed the names of the two topics from fedora.apim.update and fedora.apim.access to values in line with the (shared) remote broker. Also, I have configured fedora.apim.update to be a queue rather than a topic.

The following configuration will connect the fedora broker to host1 or host2 over SSL.

<beans 
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
 
  <!-- ActiveMQ JMS Broker configuration -->
  <amq:broker id="fedorabroker" useShutdownHook="false">
 
    <amq:managementContext>
      <amq:managementContext createConnector="false"/>
    </amq:managementContext>
 
    <!-- Your remote broker, configured with failover -->
    <amq:networkConnectors>
        <amq:networkConnector name="fedorabridge" dynamicOnly="true"
            uri="static:(failover:(ssl://host1:port,ssl://host2:port)?randomize=true)"
            userName="..."
            password="...">
            <amq:dynamicallyIncludedDestinations>
                <amq:topic physicalName="name.of.messaging.topic.>"/>
                <amq:queue physicalName="name.of.messaging.queue.>"/>
            </amq:dynamicallyIncludedDestinations>
        </amq:networkConnector>
    </amq:networkConnectors>
 
    <!-- The directory where Fedora will store the ActiveMQ data -->
    <amq:persistenceAdapter>
        <amq:amqPersistenceAdapter directory="file:/opt/fedora/data/activemq-data"/>
    </amq:persistenceAdapter>
 
    <amq:sslContext>
        <amq:sslContext
            keyStore="file:/path/to/truststore"
            keyStorePassword="..."
            trustStore="file:/path/to/truststore"
            trustStorePassword="..."/>
    </amq:sslContext>
  </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>
broker_config.txt · Last modified: 2013/03/19 14:01 by acoburn@amherst.edu
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International