Willem,

I've decided to try another solution, which worked well.

I needed to give a message when a connection problem occurs. I'd solved that
using the exception clause in the route definition, that uses a bean to log
the error:

        from(origin)

            .onException(ConnectException.class)
            .maximumRedeliveries(3)
            .handled(true)
            .to("bean:communicationExceptionHandlerBean")
            .end()

        .to(destination);

Failover was not what I was looking for, since my problem is simple.

Anyway thanks for the help.

Best regards,
Ricardo

On Wed, Mar 3, 2010 at 9:51 PM, Willem Jiang <[email protected]> wrote:

> AFAIK, you just need to configure the brokerURL of activeMQ component with
> the failover transport URI[1], like this
>
>  <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>    <property name="brokerURL"
> value="failover://(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100
> "/>
>  </bean>
>
> And I don't think current camel-activemq endpoint's URI support to
> configure the failover transport dynamically, as the brokerURL is
> transparent to camel-activemq endpoint.
>
> Willem
>
>
> Ricardo Melo wrote:
>
>> Hi,
>>
>> I have an issue about using the activemq failover. I think you can help
>> me.
>>
>> My system uses camel (using cxf, mail, tcp and other components) and uses
>> an
>> activemq queue to send out messages, using a variable number of routes
>> "TO"
>> destinations. Recently, We've found the need to use activemq failover when
>> sending a message, and give a message to user if the communication has a
>> problem.
>>
>> In my system all camel routes can be dynamically added/updated, using
>> system
>> received XML messages that specifies the route name, transport type,
>> address
>> and an unique id. For each added route, an activemq queue is created with
>> the sufix "_<routeId>" in its name. Then a camel route is created to send
>> messages from that queue to the route address specified in the message.
>> Thus
>> messages can be sent by email, web services, or whatever.
>>
>> Example:
>> Message contains message "Hello", route id=1, transport=file,
>> address=:/dir
>> Would create a route from("activemq:queue:out_1".to("file:/dir")
>> Then messages to route id=1 would be put in the above queue and then in
>> the
>> file:/dir
>>
>> The questions are:
>>
>> 1) How can I declare the failover in this situation?
>>
>> 1) How can I add the failover to the dynamically added queue, using the
>> received route 'TO' address contained in the message? Is it possible to
>> configure dynamically, using a RoutBuilder?
>>
>> I need to declare a failover that tries to send the message to the "TO"
>> address contained in the message, trying for 1 second.
>>
>> 2) Is it possible to dynamically declare the failover, and if the route is
>> updated, update the failover configuration?
>>
>> Thank you,
>> Ricardo Melo
>>
>>
>


-- 
Ricardo Britto Melo

CFlex - Empower your Decisions
Tel: (+55 19) 3251-5211
Rua BarĂ£o de Paranapanema, 401A
Campinas - SP
www.cflex.com.br

Reply via email to