You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by harinair <ha...@hotmail.com> on 2009/01/27 04:15:50 UTC

Camel Remote File Producer / Recipient List Password Issue

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.


Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Ramon Buckland <ra...@gmail.com>.
 > Question: should we add this "feature in" ?

I have answered this question myself unless others object.
I will add in this "method" for username:password configuration.

The reason is is that finally I am sinking my teeth into the commons-vfs and
part of CAMEL-1241, and commons-vfs standard config is as follows.

*URI Format*

webdav://[ *username* [: *password* ]@] *hostname* [: *port* ][ *
absolute-path* ]


.. and similar for sftp, ftp http endpoint, so it will just make sense to
match the current s/ftp endpoints up to this.

(will do it last)

r.

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Ramon Buckland <ra...@gmail.com>.
I created a quick test (added a test method to
camel-ftp/..UriConfigurationTest.

As it turns out, the URI object passed to the RemoteConfiguration does not
distinguish a seperate username / password.
Currently the username is in uri.getUserInfo(). When you supply
ftp://username:password@ you see userInfo as "username:password".

In this case, the only way to handle this is to split on a colon. Which
means colon then has to be escaped it is it part of a username (we could say
that the first colon is the separator).

URI is doing the correct thing, userInfo has the "user info", username AND
password. We would need to split it if it is there.
And handle a :colon username , such as ftp://my%3Ausername:password@host:port/
by url (de)encoded format.

Question: should we add this "feature in" ?




On Tue, Jan 27, 2009 at 19:18, Ramon Buckland <ra...@gmail.com>wrote:

>
> Ramon do you mind creating a unit test with that kind of URI so we can
>> have it supported?
>> Consider it done.
>>
>
>
>

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Ramon Buckland <ra...@gmail.com>.
> Ramon do you mind creating a unit test with that kind of URI so we can
> have it supported?
> Consider it done.
>

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 27, 2009 at 8:27 AM, Ramon Buckland
<ra...@gmail.com> wrote:
> Hi,
>
> Does the s/ftp components use or support sftp://username:password@host:port
> ?
> Would it be much to change this ?
> (I should know the answer to this as I have been staring at this code for
> days now :-)
Yeah it should as we use a java.net.URI that can extract the info, but
I can see the password might be missing

    public void configure(URI uri) {
        super.configure(uri);
        setProtocol(uri.getScheme());
        setDefaultPort();
        setUsername(uri.getUserInfo());
        setHost(uri.getHost());
        setPort(uri.getPort());
    }

I think its the authority but I cant remember and as usualy the damm
Javadoc from the JDK core is without any good examples.

Ramon do you mind creating a unit test with that kind of URI so we can
have it supported?



>
> r.
>
>
> On Tue, Jan 27, 2009 at 18:18, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> I think I have spotted the code that strips the parameters
>> RemoteFileComponent has this code
>>
>>        // get the uri part before the options as they can be non URI valid
>> such
>>        // as the expression using $ chars
>>        if (uri.indexOf("?") != -1) {
>>            uri = uri.substring(0, uri.indexOf("?"));
>>        }
>>
>> I will dig a bit into this. I do think it needs to be removed.
>>
>> On Tue, Jan 27, 2009 at 4:15 AM, harinair <ha...@hotmail.com> wrote:
>> >
>> > 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.
>> >
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Ramon Buckland <ra...@gmail.com>.
Hi,

Does the s/ftp components use or support sftp://username:password@host:port
?
Would it be much to change this ?
(I should know the answer to this as I have been staring at this code for
days now :-)

r.


On Tue, Jan 27, 2009 at 18:18, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> I think I have spotted the code that strips the parameters
> RemoteFileComponent has this code
>
>        // get the uri part before the options as they can be non URI valid
> such
>        // as the expression using $ chars
>        if (uri.indexOf("?") != -1) {
>            uri = uri.substring(0, uri.indexOf("?"));
>        }
>
> I will dig a bit into this. I do think it needs to be removed.
>
> On Tue, Jan 27, 2009 at 4:15 AM, harinair <ha...@hotmail.com> wrote:
> >
> > 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.
> >
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Bug spotted and fixed
https://issues.apache.org/activemq/browse/CAMEL-1296

Its fixed in 1.x and trunk.

Thanks for reporting.


On Tue, Jan 27, 2009 at 8:18 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> I think I have spotted the code that strips the parameters
> RemoteFileComponent has this code
>
>        // get the uri part before the options as they can be non URI valid such
>        // as the expression using $ chars
>        if (uri.indexOf("?") != -1) {
>            uri = uri.substring(0, uri.indexOf("?"));
>        }
>
> I will dig a bit into this. I do think it needs to be removed.
>
> On Tue, Jan 27, 2009 at 4:15 AM, harinair <ha...@hotmail.com> wrote:
>>
>> 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.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I think I have spotted the code that strips the parameters
RemoteFileComponent has this code

        // get the uri part before the options as they can be non URI valid such
        // as the expression using $ chars
        if (uri.indexOf("?") != -1) {
            uri = uri.substring(0, uri.indexOf("?"));
        }

I will dig a bit into this. I do think it needs to be removed.

On Tue, Jan 27, 2009 at 4:15 AM, harinair <ha...@hotmail.com> wrote:
>
> 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.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by harinair <ha...@hotmail.com>.

That is wonderful. I was thinking that everyone ignored my message. I was
thinking of fixing it myself by making RemoteFileEndpoint to give out the
full URI. But since it was a interface that might have been called by many
other modules, I was not sure of the ramifications.

Regards,
Hari Gangadharan


Ramon Buckland-5 wrote:
> 
> Hi Hari,
> 
> Claus was able to identify that it is a bug
> 
> 
>> Bug spotted and fixed
>> https://issues.apache.org/activemq/browse/CAMEL-1296
>>
>> Its fixed in 1.x and trunk.
> 
> To use this fixed version, you will need to compile the camel 1.x branch.
> The following url details the location of the camel source.
> 
> http://camel.apache.org/source.html
> 
> You will need to checkout and compile
> https://svn.apache.org/repos/asf/camel/branches/camel-1.x
> 
> regards
> Ramon
> 
> 

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


Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Claus Ibsen <cl...@gmail.com>.
Yeah its fixed in the 1.x branch and trunk as well.

As a workaround you can:
1) Create the endpoint manually (without using the Camel xxxComponent)
2) Setting the endpointUri as a property

Ad 2)
Its kinda like setting the endpoint twice:
from("ftp://foo?password=secret&endpointUri=ftp://foo?passwordESCAPED&password=secrect")

Or you could probably fix it like this:
Endpoint ftp = context.getEndpoint("ftp://foo?password=secret");
ftp.setEndpointUri("ftp://foo?password=secret");

from(frp).to("xxx");

Ad 1)
Its like creating the endpoint manually
Endpoint ftp = new xxxx()
// set all properties on ftp
from(frp).to("xxx");



On Wed, Jan 28, 2009 at 10:26 PM, Ramon Buckland
<ra...@gmail.com> wrote:
> Hi Hari,
>
> Claus was able to identify that it is a bug
>
>
>> Bug spotted and fixed
>> https://issues.apache.org/activemq/browse/CAMEL-1296
>>
>> Its fixed in 1.x and trunk.
>
> To use this fixed version, you will need to compile the camel 1.x branch.
> The following url details the location of the camel source.
>
> http://camel.apache.org/source.html
>
> You will need to checkout and compile
> https://svn.apache.org/repos/asf/camel/branches/camel-1.x
>
> regards
> Ramon


>
> On Thu, Jan 29, 2009 at 08:17, harinair <ha...@hotmail.com> wrote:
>
>>
>> Anybody have idea on how I can fix this? Is there any problem if I provide
>> the full URI in RemoteFileEndpoint?
>>
>> Hari Gangadharan
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Ramon Buckland <ra...@gmail.com>.
Hi Hari,

Claus was able to identify that it is a bug


> Bug spotted and fixed
> https://issues.apache.org/activemq/browse/CAMEL-1296
>
> Its fixed in 1.x and trunk.

To use this fixed version, you will need to compile the camel 1.x branch.
The following url details the location of the camel source.

http://camel.apache.org/source.html

You will need to checkout and compile
https://svn.apache.org/repos/asf/camel/branches/camel-1.x

regards
Ramon

On Thu, Jan 29, 2009 at 08:17, harinair <ha...@hotmail.com> wrote:

>
> Anybody have idea on how I can fix this? Is there any problem if I provide
> the full URI in RemoteFileEndpoint?
>
> Hari Gangadharan
>

Re: Camel Remote File Producer / Recipient List Password Issue

Posted by harinair <ha...@hotmail.com>.
Anybody have idea on how I can fix this? Is there any problem if I provide
the full URI in RemoteFileEndpoint?

Hari Gangadharan




harinair wrote:
> 
> 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-tp21678952s22882p21715228.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Remote File Producer / Recipient List Password Issue

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I need more coffee in the morning. But you can set the password in the URI.

Such as:
"sftp://secret@myhost:22/mydir"

Lets see if that dont work, as a workaround.

Which version of Camel are you using? If you are on 2.0 then yes there
are some major refactorings in the file and ftp component at the
moment.

Could you create a sample project that has this issue? Or small unit
test or something? Would be nice to use for the bug hunting and fix.



On Tue, Jan 27, 2009 at 4:15 AM, harinair <ha...@hotmail.com> wrote:
>
> 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.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/