camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From harinair <har...@hotmail.com>
Subject Camel Remote File Producer / Recipient List Password Issue
Date Tue, 27 Jan 2009 03:15:50 GMT

Claus and others:

I think I encountered a bug in using Remote File Component (SFTP) with
recipientList
My route is similar to this:

        <route errorHandlerRef="dataPushErrorHandler">
            <from ref="routerDeliveryChannelCQueue" />
            <process ref="securityHeaderGenerator" />
            <to ref="routerLogDefault" />
            <recipientList>
                <xpath resultType="java.lang.String">$routerRoute</xpath>
            </recipientList>
            <to uri="bean:responseVerificationProcessor?method=process" />
        </route>


So if you look at it I send the exchange to the recipient specified in
header routerRoute. Now the recipient list uses a ProducerCache which relies
on the Endpoint URI as the key - so every time recipientList asks for a
producer, ProducerCache gives a producer from the Map based on Endpoint URI:

[code]
    public synchronized Producer<E> getProducer(Endpoint<E> endpoint) {
        String key = endpoint.getEndpointUri();
        Producer<E> answer = producers.get(key);
        if (answer == null) {
            try {
                answer = endpoint.createProducer();
                answer.start();
            } catch (Exception e) {
                throw new FailedToCreateProducerException(endpoint, e);
            }
            producers.put(key, answer);
        }
        return answer;
    }
[/code]

Now the RemoteFileEndpoint substitutes the uri trimmed to the "?". Hence for
"sftp://myhost:22/mydir?password=secret", the uri is sftp://myhost:22/mydir

So essentially, even if I put a new url (with changes after the '?' -
example a change in password), still the old producer will be used by the
RecipientList unless the whole Camel is restarted (and thus clearing the Map
in the ProducerCache). I really have to do something to fix this since if a
customer corrects the password (using a separate web UI) that never gets
refreshed because the new password passed through the routerRoute header is
ignored by the recipientList due to the presence of a stale misconfigured
Producer with the "same uri" in the ProducerCache.

Claus, How can I resolve this? Could you understand what I am talking about?
Is there any work around? The latest Camel trunk does not have the Producers
-- so there is a re-engineering happening to the Producers? According to me
instead of using the pruned URI probably the full URI is to be used. Any
comments?

Hari Gangadharan

-- 
View this message in context: http://www.nabble.com/Camel-Remote-File-Producer---Recipient-List-Password-Issue-tp21678952s22882p21678952.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message