You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bruno Borges <br...@gmail.com> on 2010/09/21 19:17:50 UTC

Endpoint consumer created only on from()

Is this statement correct?

Are all endpoint's consumers only created when Endpoint is referenced by a
from() ?

Cheers,
Bruno Borges
www.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
 - Francois de La Rochefoucauld

Re: Endpoint consumer created only on from()

Posted by Bruno Borges <br...@gmail.com>.
It is where I am right now.

The OFTP protocol states that is the sever who will let the client know
about incoming files.

What I'm doing now is remodeling the consumer (pollingConsumer) to first ask
the route if it wants to receive a file before actually downloading it.
So every poll will produce first an InOut message per file. The component
will let the route accept or reject the incoming file by faulting the
message or not, and to set in the Out message body an object of type File or
OutputStream. If the route does not override store location with an
OutputStream, consumer will exchange an InOnly message containing a
GenericFile<File>. If this is not the case (route did override store
location with an OutputStream), then a second InOnly message containing
metadata about that file will be sent to the route.

What do you think?

Cheers

Bruno Borges
www.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
 - Francois de La Rochefoucauld



On Wed, Sep 22, 2010 at 2:36 AM, Hadrian Zbarcea <hz...@gmail.com> wrote:

> The question is more what MEP does the remote server use.
>
> The choices you exposed seem to imply that the remote server would return
> incoming files, which would be an InOut.
> However, an ftp server or file system (an smtp server as well) use an
> InOnly pattern (on the producer side) so there is no response (or
> incomingFile).
> By not populating an out in the Exchange, camel will automatically send the
> original message (from the outbox) to the rest of the route, therefore you
> don't need to do anything on that side.
> To use incomingFiles you would need a PollingConsumer. That would be the
> enabler for the second route in Claus' example.
>
> Hadrian
>
>
> On Sep 22, 2010, at 12:32 AM, Claus Ibsen wrote:
>
> > On Tue, Sep 21, 2010 at 8:24 PM, Bruno Borges <br...@gmail.com>
> wrote:
> >> So, considering this route:
> >>
> >> from("file:/outbox").to("someRemoteServer").to("file:/home/inbox");
> >>
> >> What do you consider to be a better design:
> >>
> >> 1- a) files from outbox goes to remoteServer-producer
> >>     b) remoteServer-producer sends file to remote connection
> >>     c) remoteServer-endpoint forward remote incomingFiles to this route
> >> rather files from outbox
> >>
> >> 2- a) files from outbox goes to remoteServer-producer
> >>     b) remoteServer-producer sends file to remote connection
> >>     c) remoteServer-endpoint continue processing files from outbox to
> the
> >> rest of this route
> >>
> >>
> >
> > It really depends what the removeServer protocol is? Is it a file
> > based then I would assume it would be more correct to do as the
> > regular file/ftp does which would be.
> >
> > from("file:/outbox").to("someRemoteServer");
> > from("someRemoteServer").to("file:/home/inbox");
> >
> > To have it in 2 routes. One as the producer, and the other as the
> consumer.
> > They can work independent.
> >
> > And if you do this in Camel
> > from("file:/outbox").to("someRemoteServer").to("xxxx")
> >
> > Then you can continue route the file to XXXX as well if you need it.
> >
> >
> >
> >
> >>
> >> Bruno Borges
> >> www.brunoborges.com.br
> >> +55 21 76727099
> >>
> >> "The glory of great men should always be
> >> measured by the means they have used to
> >> acquire it."
> >>  - Francois de La Rochefoucauld
> >>
> >>
> >>
> >> On Tue, Sep 21, 2010 at 2:57 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >>
> >>> On Tue, Sep 21, 2010 at 7:17 PM, Bruno Borges <br...@gmail.com>
> >>> wrote:
> >>>> Is this statement correct?
> >>>>
> >>>> Are all endpoint's consumers only created when Endpoint is referenced
> by
> >>> a
> >>>> from() ?
> >>>>
> >>>
> >>> consumers is created when they are needed. And from(xx) is created a
> >>> consumer on endpoint xxx.
> >>> Where as to(xxx) is created a producer on endpoint xxxx.
> >>>
> >>>
> >>>> Cheers,
> >>>> Bruno Borges
> >>>> www.brunoborges.com.br
> >>>> +55 21 76727099
> >>>>
> >>>> "The glory of great men should always be
> >>>> measured by the means they have used to
> >>>> acquire it."
> >>>>  - Francois de La Rochefoucauld
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Claus Ibsen
> >>> Apache Camel Committer
> >>>
> >>> Author of Camel in Action: http://www.manning.com/ibsen/
> >>> Open Source Integration: http://fusesource.com
> >>> Blog: http://davsclaus.blogspot.com/
> >>> Twitter: http://twitter.com/davsclaus
> >>>
> >>
> >
> >
> >
> > --
> > Claus Ibsen
> > Apache Camel Committer
> >
> > Author of Camel in Action: http://www.manning.com/ibsen/
> > Open Source Integration: http://fusesource.com
> > Blog: http://davsclaus.blogspot.com/
> > Twitter: http://twitter.com/davsclaus
>
>

Re: Endpoint consumer created only on from()

Posted by Hadrian Zbarcea <hz...@gmail.com>.
The question is more what MEP does the remote server use.

The choices you exposed seem to imply that the remote server would return incoming files, which would be an InOut.
However, an ftp server or file system (an smtp server as well) use an InOnly pattern (on the producer side) so there is no response (or incomingFile).
By not populating an out in the Exchange, camel will automatically send the original message (from the outbox) to the rest of the route, therefore you don't need to do anything on that side.
To use incomingFiles you would need a PollingConsumer. That would be the enabler for the second route in Claus' example.

Hadrian


On Sep 22, 2010, at 12:32 AM, Claus Ibsen wrote:

> On Tue, Sep 21, 2010 at 8:24 PM, Bruno Borges <br...@gmail.com> wrote:
>> So, considering this route:
>> 
>> from("file:/outbox").to("someRemoteServer").to("file:/home/inbox");
>> 
>> What do you consider to be a better design:
>> 
>> 1- a) files from outbox goes to remoteServer-producer
>>     b) remoteServer-producer sends file to remote connection
>>     c) remoteServer-endpoint forward remote incomingFiles to this route
>> rather files from outbox
>> 
>> 2- a) files from outbox goes to remoteServer-producer
>>     b) remoteServer-producer sends file to remote connection
>>     c) remoteServer-endpoint continue processing files from outbox to the
>> rest of this route
>> 
>> 
> 
> It really depends what the removeServer protocol is? Is it a file
> based then I would assume it would be more correct to do as the
> regular file/ftp does which would be.
> 
> from("file:/outbox").to("someRemoteServer");
> from("someRemoteServer").to("file:/home/inbox");
> 
> To have it in 2 routes. One as the producer, and the other as the consumer.
> They can work independent.
> 
> And if you do this in Camel
> from("file:/outbox").to("someRemoteServer").to("xxxx")
> 
> Then you can continue route the file to XXXX as well if you need it.
> 
> 
> 
> 
>> 
>> Bruno Borges
>> www.brunoborges.com.br
>> +55 21 76727099
>> 
>> "The glory of great men should always be
>> measured by the means they have used to
>> acquire it."
>>  - Francois de La Rochefoucauld
>> 
>> 
>> 
>> On Tue, Sep 21, 2010 at 2:57 PM, Claus Ibsen <cl...@gmail.com> wrote:
>> 
>>> On Tue, Sep 21, 2010 at 7:17 PM, Bruno Borges <br...@gmail.com>
>>> wrote:
>>>> Is this statement correct?
>>>> 
>>>> Are all endpoint's consumers only created when Endpoint is referenced by
>>> a
>>>> from() ?
>>>> 
>>> 
>>> consumers is created when they are needed. And from(xx) is created a
>>> consumer on endpoint xxx.
>>> Where as to(xxx) is created a producer on endpoint xxxx.
>>> 
>>> 
>>>> Cheers,
>>>> Bruno Borges
>>>> www.brunoborges.com.br
>>>> +55 21 76727099
>>>> 
>>>> "The glory of great men should always be
>>>> measured by the means they have used to
>>>> acquire it."
>>>>  - Francois de La Rochefoucauld
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>> 
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> 
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus


Re: Endpoint consumer created only on from()

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Sep 21, 2010 at 8:24 PM, Bruno Borges <br...@gmail.com> wrote:
> So, considering this route:
>
> from("file:/outbox").to("someRemoteServer").to("file:/home/inbox");
>
> What do you consider to be a better design:
>
> 1- a) files from outbox goes to remoteServer-producer
>     b) remoteServer-producer sends file to remote connection
>     c) remoteServer-endpoint forward remote incomingFiles to this route
> rather files from outbox
>
> 2- a) files from outbox goes to remoteServer-producer
>     b) remoteServer-producer sends file to remote connection
>     c) remoteServer-endpoint continue processing files from outbox to the
> rest of this route
>
>

It really depends what the removeServer protocol is? Is it a file
based then I would assume it would be more correct to do as the
regular file/ftp does which would be.

from("file:/outbox").to("someRemoteServer");
from("someRemoteServer").to("file:/home/inbox");

To have it in 2 routes. One as the producer, and the other as the consumer.
They can work independent.

And if you do this in Camel
from("file:/outbox").to("someRemoteServer").to("xxxx")

Then you can continue route the file to XXXX as well if you need it.




>
> Bruno Borges
> www.brunoborges.com.br
> +55 21 76727099
>
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
>  - Francois de La Rochefoucauld
>
>
>
> On Tue, Sep 21, 2010 at 2:57 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Tue, Sep 21, 2010 at 7:17 PM, Bruno Borges <br...@gmail.com>
>> wrote:
>> > Is this statement correct?
>> >
>> > Are all endpoint's consumers only created when Endpoint is referenced by
>> a
>> > from() ?
>> >
>>
>> consumers is created when they are needed. And from(xx) is created a
>> consumer on endpoint xxx.
>> Where as to(xxx) is created a producer on endpoint xxxx.
>>
>>
>> > Cheers,
>> > Bruno Borges
>> > www.brunoborges.com.br
>> > +55 21 76727099
>> >
>> > "The glory of great men should always be
>> > measured by the means they have used to
>> > acquire it."
>> >  - Francois de La Rochefoucauld
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Endpoint consumer created only on from()

Posted by Bruno Borges <br...@gmail.com>.
So, considering this route:

from("file:/outbox").to("someRemoteServer").to("file:/home/inbox");

What do you consider to be a better design:

1- a) files from outbox goes to remoteServer-producer
     b) remoteServer-producer sends file to remote connection
     c) remoteServer-endpoint forward remote incomingFiles to this route
rather files from outbox

2- a) files from outbox goes to remoteServer-producer
     b) remoteServer-producer sends file to remote connection
     c) remoteServer-endpoint continue processing files from outbox to the
rest of this route



Bruno Borges
www.brunoborges.com.br
+55 21 76727099

"The glory of great men should always be
measured by the means they have used to
acquire it."
 - Francois de La Rochefoucauld



On Tue, Sep 21, 2010 at 2:57 PM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Sep 21, 2010 at 7:17 PM, Bruno Borges <br...@gmail.com>
> wrote:
> > Is this statement correct?
> >
> > Are all endpoint's consumers only created when Endpoint is referenced by
> a
> > from() ?
> >
>
> consumers is created when they are needed. And from(xx) is created a
> consumer on endpoint xxx.
> Where as to(xxx) is created a producer on endpoint xxxx.
>
>
> > Cheers,
> > Bruno Borges
> > www.brunoborges.com.br
> > +55 21 76727099
> >
> > "The glory of great men should always be
> > measured by the means they have used to
> > acquire it."
> >  - Francois de La Rochefoucauld
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: Endpoint consumer created only on from()

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Sep 21, 2010 at 7:17 PM, Bruno Borges <br...@gmail.com> wrote:
> Is this statement correct?
>
> Are all endpoint's consumers only created when Endpoint is referenced by a
> from() ?
>

consumers is created when they are needed. And from(xx) is created a
consumer on endpoint xxx.
Where as to(xxx) is created a producer on endpoint xxxx.


> Cheers,
> Bruno Borges
> www.brunoborges.com.br
> +55 21 76727099
>
> "The glory of great men should always be
> measured by the means they have used to
> acquire it."
>  - Francois de La Rochefoucauld
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus