Page tree

Versions Compared

Key

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

...

Code Block
title/etc/hydra/activemq/instances-available/provisioning/activemq.xml
<beans
  xmlns="http://www.springframework.org/schema/beans"
  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.xsd
  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
    <!-- Allows us to use system properties as variables in this configuration file -->
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" />
    <!--
        The <broker> element is used to configure the ActiveMQ broker.
    -->
    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}">
        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" >
                    <!-- The constantPendingMessageLimitStrategy is used to prevent
                         slow topic consumers to block producers and affect other consumers
                         by limiting the number of messages that are retained
                         For more information, see:
                         http://activemq.apache.org/slow-consumer-handling.html
                    -->
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

        <!--
            The managementContext is used to configure how ActiveMQ is exposed in
            JMX. By default, ActiveMQ uses the MBean server that is started by
            the JVM. For more information, see:
            http://activemq.apache.org/jmx.html
        -->
        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>
        <!--
            The transport connectors expose ActiveMQ over a given protocol to
            clients and other brokers. For more information, see:
            http://activemq.apache.org/configuring-transports.html
        -->
        <transportConnectors>
            <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
            <transportConnector name="openwire" uri="tcp://127.0.0.1:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
            <transportConnector name="stomp" uri="stomp://127.0.0.1:61613?transport.hbGracePeriodMultiplier=1.5"/>
        </transportConnectors>
        <!-- destroy the spring context on shutdown to stop jetty -->
        <shutdownHooks>
            <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
        </shutdownHooks>
    </broker>
    <camelContext xmlns="http://camel.apache.org/schema/spring" id="camel">
        <route>
            <from uri="oracleTopic:topic:AIS_NET.HP_COMMANDS_1?clientId=ActiveMQ&amp;durableSubscriptionName=HP"/>
            <to uri="activemq:queue:hydra_commands_1"/>
        </route>
        <route>
            <from uri="activemq:queue:hydra_command_results_1"/>
            <to uri="oracleTopic:topic:AIS_NET.HP_COM_RES_1?clientId=ActiveMQ&amp;durableSubscriptionName=HP"/>
        </route>
        <route>
            <from uri="oracleTopic:topic:AIS_NET.HP_PROFILES_1?clientId=ActiveMQ&amp;durableSubscriptionName=HP"/>
            <to uri="activemq:queue:hydra_profiles_1"/>
        </route>
        <route>
            <from uri="oracleTopic:topic:AIS_NET.HP_EQUIPMENT_BINDS_1?clientId=ActiveMQ&amp;durableSubscriptionName=HP"/>
            <to uri="activemq:queue:hydra_equipment_binds_1"/>
        </route>
    </camelContext>
    <bean id="activeMQConfig" class="org.apache.activemq.camel.component.ActiveMQConfiguration">
        <property name="cacheLevelName" value="CACHE_CONSUMER" />
        <property name="concurrentConsumers" value="1" />
    </bean>
    <bean id="connectionFactoryOracleAQTopic" class="oracle.jms.AQjmsFactory"
          factory-method="getQueueConnectionFactory">
        <constructor-arg index="0">
            <value>jdbc:oracle:thin:@//127.0.0.1:1521/hydra</value>
        </constructor-arg>
        <constructor-arg index="1" type="java.util.Properties">
            <value></value>
        </constructor-arg>
    </bean>
    <bean id="oracleTopicCredentials" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory">
            <ref bean="connectionFactoryOracleAQTopic"/>
        </property>
        <property name="username">
            <value>AIS_PROVISIONING</value>
        </property>
        <property name="password">
            <value>read_manual</value>
        </property>
    </bean>
    <bean id="oracleTopic" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="oracleTopicCredentials"/>
    </bean>
    <!--
        Enable web consoles, REST and Ajax APIs and demos
        Take a look at ${ACTIVEMQ_BASE}/conf/jetty.xml for more details
    -->
    <import resource="jetty.xml"/>
</beans>

...

  • Брокер слушает порт 127.0.0.1:61616 для взаимодействия с агентом HEX по протоколу OpenWire;
  • Брокер слушает порт 127.0.0.1:61613 для взаимодействия с агентом HARD по протоколу STOMP;
  • Anchor
    commands_queues
    commands_queues
    Сообщения с командами для выполнения агентом HEX брокер извлекает из очереди HP_COMMANDS_1 схемы AIS_NET БД Oracle и помещает их в свою очередь hydra_commands_1;
  • Сообщения с результатами выполнения команд от агента HEX брокер извлекает из своей очереди hydra_command_results_1 и помещает их в очередь HP_COM_RES_1 схемы AIS_NET БД Oracle;
  • Сообщения с профилями оборудования для агента HARD брокер извлекает из очереди HP_PROFILES_1 схемы AIS_NET БД Oracle и помещает их в свою очередь hydra_profiles_1;
  • Сообщения с привязками оборудования для агента HARD брокер извлекает из очереди HP_EQUIPMENT_BINDS_1 схемы AIS_NET БД Oracle и помещает их в свою очередь hydra_equipment_binds_1;
  • БД Oracle называется hydra и доступна на порту 127.0.0.1:1521;
  • Для работы с БД Oracle используется пользователь базы данных AIS_PROVISIONING c паролем read_manual.

...