Ok, I got it working.

The dynamicTopics and dynamicQueues are DEFINITELY the way to go - much simpler than configuring every destination in JNDI.

The jndi.properties I used was pretty much the one in the activemq settings page. The trick for me was getting blazeDS's jms adapter to have the context configured correctly and find it properly.

In case anyone else wants to use Camel + ActiveMQ + BlazeDS + Flex to build messaging channels for their RIA - here's what a working BlazeDS messaging-config.xml file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<service id="message-service" class="flex.messaging.services.MessageService">

    <adapters>
<adapter-definition id="actionscript" class="flex.messaging.services.messaging.adapters.ActionScriptAdapter" default="true" /> <adapter-definition id="jms" class="flex.messaging.services.messaging.adapters.JMSAdapter"/>
    </adapters>

    <default-channels>
                <channel ref="my-streaming-amf"/>
                <channel ref="my-polling-amf"/>
    </default-channels>

   <destination id="inbound-sms-destination">
    <properties>
    <jms>
      <destination-type>Topic</destination-type>
      <message-type>javax.jms.TextMessage</message-type>
      <connection-factory>topicConnectionFactory</connection-factory>
<destination-jndi-name>dynamicTopics/SMSReturnMessages</ destination-jndi-name>
      <delivery-mode>NON_PERSISTENT</delivery-mode>
      <message-priority>DEFAULT_PRIORITY</message-priority>
      <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
      <initial-context-environment>
        <property>
          <name>Context.INITIAL_CONTEXT_FACTORY</name>
<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
        </property>
        <property>
          <name>Context.PROVIDER_URL</name>
          <value>vm://localhost</value>
        </property>
      </initial-context-environment>
    </jms>
    </properties>
    <adapter ref="jms"/>
    </destination>
</service>

This goes along with the service-config.xml file that defines the different streaming channels... etc. It's true that BlazeDS doesn't really talk to camel at all, but by having camel involved it obviously opens up a great number of possibilities for some pretty cool applications.

Thanks for the pointers.

Ryan

On Oct 1, 2008, at 3:08 AM, James Strachan wrote:

Agreed with everything Claus just said - that JNDI support page
describes how to setup JNDI to include the various destinations. Also
look at the "Dynamically creating destinations" section - its a JNDI
naming convention to avoid you having to configure each destination!
Saves loads of hassle with JNDI.

Note that BlazeDS will be using the JMS API and JNDI directly - it
won't be using Camel at all. You then just use the actual JMS
queue/topic names you are using in Camel land - you don't need to mess
around with all that JNDI muck unless you really want to - I'd
recommend avoiding it to be honest; its just another level of
indirection that just adds complexity for no real use.

e.g. imagine if each URI in a web app had to be looked up, by another
name, in JNDI before you could use it in a web app - how hard would
servlets/HTML be?

2008/10/1 Claus Ibsen <[EMAIL PROTECTED]>:
Hi

Ah that is more an ActiveMQ question than Camel. How to register activemq queues in a JNDI tree.

A valid question I would like to know how to as well ;)

Try go to
http://activemq.apache.org
and enter jndi in the search field

http://activemq.apache.org/jndi-support.html

But I am sure James or the other activemq experts will be able to give a better hint.



Med venlig hilsen

Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Ryan Gardner [mailto:[EMAIL PROTECTED]
Sent: 1. oktober 2008 05:03
To: [email protected]
Subject: Camel, activemq endpoints, and jndi

I'm working with Camel, Spring, and Flex - using BlazeDS to interface
with my flex clients. The server is running on tomcat.

BlazeDS has support out of the box for adapting a JMS channel to a
flex client and handling messages passed back and forth to the flex
client. The default way to use the BlazeDS JMS adapter invovles
retrieving the endpoints from JNDI.

What's the best way to get Camel to register activemq jms endpoints in
JNDI?

Here's a snippet of what the JMS configuration looks like in the XML
file that configures the BlazeDS server:

----
<destination id="some-jms-destination">
   <properties>
   <jms>
     <destination-type>Topic</destination-type>
     <message-type>javax.jms.TextMessage</message-type>
     <connection-factory>java:comp/env/jms/flex/
TopicConnectionFactory</connection-factory>
     <destination-jndi-name>java:comp/env/jms/SomeJMSEndpoint</
destination-jndi-name>
     <delivery-mode>NON_PERSISTENT</delivery-mode>
     <message-priority>DEFAULT_PRIORITY</message-priority>
     <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
     <initial-context-environment>
       <property>
         <name>Context.INITIAL_CONTEXT_FACTORY</name>

<value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
       </property>
       <property>
         <name>Context.PROVIDER_URL</name>
         <value>tcp://localhost:61616</value>
       </property>
     </initial-context-environment>
   </jms>
   </properties>
   <adapter ref="jms"/>
   </destination>
-----

So the easiest thing would be if I could get my endpoints to be
registered in JNDI so that the line:

       <destination-jndi-name>java:comp/env/jms/SomeJMSEndpoint</
destination-jndi-name>

would just find the JMS queue and I'd be good to go.

Any tips from those more familiar with JMS than I am? (which is most
anyone on this list, I'm sure)

Ryan




--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to