activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yari <march...@cli.di.unipi.it>
Subject Re: ActiveMQ & Camel
Date Tue, 08 Jul 2008 14:16:23 GMT

thx a lot,i was able to configure the Camel context with username e password
and everything is working now :) Just needed to add to activemq.xml:

	<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
	  <property name="connectionFactory">
		<bean class="org.apache.activemq.ActiveMQConnectionFactory">
		  <property name="brokerURL" value="vm://localhost"/>
		  <property name="userName"  value="username" />
		  <property name="password"  value="password" />
		</bean>
	  </property>
	</bean>


ammulder wrote:
> 
> To be a little more specific, in ActiveMQ > 5.1.0, you can set a
> username and password on the Camel ActiveMQComponent that's described
> on the page James pointed to.  In ActiveMQ <= 5.1.0, you need to
> configure the ActiveMQConnectionFactory as one bean and set the
> username and password on that one, and then configure the
> ActiveMQComponent or JMSComponent as a separate bean that refers to
> the connection factory (or just make the factory an embedded bean
> definition within the component if you like).  There's an example of
> that syntax (though it doesn't show username and password properties)
> on this page:
> 
> http://activemq.apache.org/camel/jms.html
> 
> Thanks,
>       Aaron
> 
> On Tue, Jul 8, 2008 at 7:13 AM, James Strachan <james.strachan@gmail.com>
> wrote:
>> You can customize the activemq component in your spring.xml to specify
>> the user/password and to switch from the default TCP transport to use
>> VM if you prefer. See...
>>
>> http://activemq.apache.org/camel/activemq.html
>>
>> 2008/7/8 Yari <marchett@cli.di.unipi.it>:
>>>
>>> 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.
>>>
>>>
>>
>>
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://open.iona.com
>>
>>
> 
> 

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


Mime
View raw message