Hi everyone,
i started working on ActiveMQ for a few days and i wanna share an experience
i found out to be interesting (and could save a lot of time) to other
people.The project i work on required JAAS, for authentication and
authorization, as well as Camel, in order to integrate Enterprise
Integration Patterns. We decided to start building what we need with a
simple content based router using the EL scripting language.

So the first thing was to download the camel-juel jar from 
http://people.apache.org/repo/m2-snapshot-repository/org/apache/camel/camel-juel/
 
and saved in the activemq lib/ directory.

Then we edited the activemq.xml configuration with:

        <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring";>
                <route>
                    <from uri="activemq:QUEUE.FOO"/>
                    <choice>
                        <when>
                                <el>${in.headers['TESTHEADER'] == 'TEST' }</el>
                                <to uri="activemq:QUEUE.BAR"/>
                        </when>
                        <otherwise>
                                <to uri="activemq:QUEUE.BUZZ"/>
                        </otherwise>
                    </choice>
                </route>                
        </camelContext> 

and we tried starting the broker, and everything was fine, the routing was
able to dispatch to the correct queue based on headers (so messages with
TESTHEADER equals to TEST were dispatched to QUEUE.BAR, everything else to
QUEUE.BUZZ).

We then tried to enable JAAS authentication and authorization with:

<plugins>
  <jaasAuthenticationPlugin configuration="activemq-domain" /> 
</plugins>

setting everything up like explained in
http://activemq.apache.org/security.html.
When we tried to start the broker we end up with:

java.lang.SecurityException: User name or password is invalid
(and a bunch of stack traces)

After a lot of work we were able to understand that, when Camel is started
it tries to connect to the broker in order to create queues and topic
required for routing (in the above example to create QUEUE.FOO,
QUEUE.BAR,QUEUE.BUZZ). Obviously, since there's an authorization required to
access the broker, and you can't provide Camel with a username and a
password (or at least we weren't able to find a way to do that), it cannot
authenticate and so it cannot do anything 

Just to save some work to some of you, remember that you cannot provide
Camel with connection informations as well, so, for example, if you have a
machine with an IP 192.168.0.1 and you change:

        <transportConnectors>
                <transportConnector name="openwire"     
uri="tcp://localhost:61616" 
/>
        </transportConnectors>

,which will bind your broker to both 127.0.0.1 and 192.168.0.1, to

        <transportConnectors>
                <transportConnector name="openwire"     
uri="tcp://192.168.0.1:61616"  
/>
        </transportConnectors>

Camel won't work as well, because it won't be able to connect to the broker,
so it won't be able to install routes.

So we ended up disabling JAAS plugin, in order to be able to use Camel. Now
i have some questions:

1) Is there any way to pass a username and a password to Camel? and if it
isn't, is there any plan to implement such feature? 
2) why is Camel using a TCP connection instead of direct methods invocation?
3) is there any documentation about this problem which maybe i missed?

best regards,
Yari
-- 
View this message in context: 
http://www.nabble.com/ActiveMQ---Camel-tp18336458p18336458.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to