I'm trying to connect to our JMS service (Apache ActiveMQ), but am not
having much luck.  Here are some config files.

message-config.xml
<destination id="flex-jms-topic">
  <adapter ref="jms"/>
  <properties>
   <server>
    <allow-subtopics>true</allow-subtopics>
    <subtopic-separator>.</subtopic-separator>
   </server>
   <jms>
    <destination-type>Topic</destination-type>
    <message-type>javax.jms.TextMessage</message-type>
    <connection-factory>TopicConnectionFactory</connection-factory>
    <destination-jndi-name>GTBTopic</destination-jndi-name>
    <delivery-mode>NON_PERSISTENT</delivery-mode>
    <message-priority>DEFAULT_PRIORITY</message-priority>
    <preserve-jms-headers>"true"</preserve-jms-headers>
    <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
    <max-producers>1</max-producers>
    <initial-context-environment>
     <property>
      <name>Context.SECURITY_PRINCIPAL</name>
      <value>userA</value>
     </property>
     <property>
      <name>Context.SECURITY_CREDENTIALS</name>
      <value>pw123</value>
     </property>
     <property>
      <name>Context.PROVIDER_URL</name>
      <value>tcp://localhost:61616</value>
     </property>
     <property>
      <name>Context.INITIAL_CONTEXT_FACTORY</name>
      <value>org.apache.activemq.jndi.
             ActiveMQInitialContextFactory</value>
     </property>
    </initial-context-environment>
   </jms>
  </properties>
</destination>


I subscribe to this topic in my Application's creationComplete handler.
// Subscribe to JMS topic
__jmsTopicConsumer = new Consumer();
__jmsTopicConsumer.destination = "flex-jms-topic";
__jmsTopicConsumer.subtopic = "data.*";
__jmsTopicConsumer.addEventListener(MessageEvent.MESSAGE,
onJMSMessageResult);
__jmsTopicConsumer.addEventListener(MessageFaultEvent.FAULT,
onJMSMessageFault);
__jmsTopicConsumer.subscribe();


Here's my ActiveMQ configuration, which is mostly the default settings.
activemq.xml
<beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:amq="http://activemq.org/config/1.0";
   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.org/config/1.0
http://activemq.apache.org/schema/activemq-core.xsd
   http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd";>

<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfi\
gurer"/>
  <broker xmlns="http://activemq.org/config/1.0";
      brokerName="localhost"
      dataDirectory="${activemq.base}/data">
   <destinationPolicy>
    <policyMap>
     <policyEntries>
       <policyEntry topic="FOO.>"
           producerFlowControl="false"
           memoryLimit="1mb">
       <dispatchPolicy>
        <strictOrderDispatchPolicy/>
       </dispatchPolicy>
       <subscriptionRecoveryPolicy>
        <lastImageSubscriptionRecoveryPolicy/>
       </subscriptionRecoveryPolicy>
      </policyEntry>
     </policyEntries>
    </policyMap>
   </destinationPolicy>
   <transportConnectors>
    <transportConnector name="openwire"
        uri="tcp://localhost:61616"
        discoveryUri="multicast://default"/>
    <transportConnector name="ssl"
        uri="ssl://localhost:61617"/>
    <transportConnector name="stomp"
        uri="stomp://localhost:61613"/>
    <transportConnector name="xmpp"
        uri="xmpp://localhost:61222"/>
   </transportConnectors>
   <networkConnectors>
    <networkConnector name="default-nc"
        uri="static://tcp://localhost:61616"/>
   </networkConnectors>
  </broker>
  <commandAgent config here>
  <jetty config here>
</beans>


I even configured a static topic.
jndi.properties
java.naming.factory.initial =
org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url = vm://localhost
topic.MyTopic = FOO.MyTopic


I know the static topic is created because I can go to the ActiveMQ web
console and see the topic 'MyTopic' listed.

Any help would be appreciated as I've been at this for a few days now.

Thanks,
   Geoff

Reply via email to