forgot to mention that I am also restarting the route after that code.
camelContext.stopRoute(endpointKey.getRouteId());
List<RouteDefinition> routeList = new
ArrayList<RouteDefinition>();
routeList.add(routeDef);
camelContext.removeRouteDefinitions(routeList);
camelContext.addRouteDefinitions(routeList);
Jejo
jejmaster wrote:
>
> Hi,
>
> So here's what i did:
>
> RouteDefinition routeDef =
> camelContext.getRouteDefinition("routeId");
> List<FromDefinition> fromDefinitions = routeDef.getInputs();
>
> for (FromDefinition fromDef : fromDefinitions) {
> JmsEndpoint jmsEndpoint = (JmsEndpoint)
> fromDef.getEndpoint();
> if (jmsEndpoint.getConfiguration() instanceof
> ActiveMQConfiguration) {
> ActiveMQConfiguration activeMQConfiguration =
> (ActiveMQConfiguration) jmsEndpoint.getConfiguration();
> PooledConnectionFactory factory =
> (PooledConnectionFactory) activeMQConfiguration.getConnectionFactory();
> ActiveMQConnectionFactory activeMQConnectionFactory =
> (ActiveMQConnectionFactory) factory.getConnectionFactory();
> activeMQConnectionFactory.setBrokerURL(address);
> break;
> }
> }
>
> This works initially when it cannot connect to the brokerURL address.
> However, when it is hooked and connected to the working brokerURL address,
> it cannot change the address anymore. It seems that when its already
> hooked, it cannot be unhooked and be changed to other address.
>
> Thanks,
> Jejo
>
>
>
> willem.jiang wrote:
>>
>> Claus Ibsen wrote:
>>> On Wed, May 26, 2010 at 6:36 AM, jejmaster <[email protected]> wrote:
>>>> Hi,
>>>>
>>>> I would like to inquire regarding changing the JMS broker url on run
>>>> time.
>>>> Basically, I would like to manage the broker url in the database and
>>>> for
>>>> every change, it will automatically point to that jms broker url which
>>>> camel
>>>> is polling to.
>>>>
>>>> Any suggestions?
>>>>
>>>
>>> You want a Camel JMS Client to dynamic change to a different remote
>>> broker URL?
>>>
>>> You can do this by stopping the consumer. Change the broker URL and
>>> start the consumer again.
>>
>> Just one more note you can update the connectionFactory's brokerURL from
>> the JmsEndpoint or the JmsConfiguration which is hold by JmsComponent.
>>
>>
>>>
>>>
>>>> Thanks.
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/Change-JMS-Consumer-broker-address-dynamically-tp28676362p28676362.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/Change-JMS-Consumer-broker-address-dynamically-tp28676362p28739180.html
Sent from the Camel - Users mailing list archive at Nabble.com.