camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" <claus.ib...@gmail.com>
Subject Re: [DISCUSS] Camel 2.0 - default endpoint
Date Thu, 13 Nov 2008 18:04:24 GMT
Hi

I guess the endpoint resolution can be done once. So I still don't see
the valid point of this default

final Endpoint ep = context.getEndpoint("uri");
 ProducerTemplate template = new DefaultTemplate(context);
 while (condition) {
    template.send(ep, body);
 }


/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Thu, Nov 13, 2008 at 3:57 PM, Hadrian Zbarcea <hzbarcea@gmail.com> wrote:
> I think the point is that you can have something like:
>
> ProducerTemplate template = new DefaultTemplate(context, uri);
> while (condition) {
>    template.send(body);
> }
>
> This would work too, of course:
>
> ProducerTemplate template = new DefaultTemplate(context);
> while (condition) {
>    template.send(uri, body);
> }
>
> ... but it would force an endpoint resolution at every iteration.
>
> Hadrian
>
>
> On Nov 13, 2008, at 5:17 AM, Claus Ibsen wrote:
>
>> Hi
>>
>> Hmm is there any documentation with such a sample how to reuse it?
>>
>> I would still like to keep Camel simpler and not support "corner case
>> use-cases", that is not documented or anyhow possible for end-users to
>> figure out how to use.
>>
>> We could maybe reduce some of the default endpoint send/request
>> methods on ProducerTemplate to reduce the number of methods end-users
>> get when they press control + space. If we could keep one for these
>> few uses-cases with reuse?
>>
>>
>>
>> On Wed, Nov 12, 2008 at 5:17 PM, Hadrian Zbarcea <hzbarcea@gmail.com>
>> wrote:
>>>
>>> I just talked to Hiram to figure out why it got there in the first place.
>>> He gives a
>>>
>>> -1 for removing,
>>>
>>> and I change my vote to 0 :).  The idea comes from the spring jms
>>> template
>>> and it's quite handy when you want to reuse the template and keep sending
>>> to
>>> the same uri.  The endpoint uri resolves once.  Well, I can see it's
>>> usefulness.  I'd say let's keep it.
>>>
>>> More opinions welcome,
>>> Hadrian
>>>
>>>
>>>
>>> On Nov 12, 2008, at 8:22 AM, Jon Anstey wrote:
>>>
>>>> I've never used this, nor could I imagine when I'd ever want to use it.
>>>>
>>>> +1 for removing
>>>>
>>>> On Wed, Nov 12, 2008 at 9:34 AM, Hadrian Zbarcea <hzbarcea@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Claus,
>>>>>
>>>>> Now I get it :).  In any non trivial case it's useless and could be
>>>>> confusing/error prone I agree.
>>>>>
>>>>> I think it is there mostly for convenience for developers, so if we
>>>>> take
>>>>> it
>>>>> out the inconvenience would be that they'd have to specify the endpoint
>>>>> (uri) explicitly, which from my point of view is good.
>>>>>
>>>>> A strong +1 from me on this, but I'd like another opinion too.
>>>>>
>>>>> Cheers
>>>>> Hadrian
>>>>>
>>>>>
>>>>>
>>>>> On Nov 12, 2008, at 1:56 AM, Claus Ibsen wrote:
>>>>>
>>>>> Hi
>>>>>>
>>>>>> Yes I did not make my point clear.
>>>>>>
>>>>>> It's the fact that CamelContext requires a default endpoint URI to
be
>>>>>> configured. Then you can use ProducerTemplate.sendBody("Hello World")
>>>>>> and then it will send this body the default endpoint URI. Normally
you
>>>>>> have to provide the URI as well such as:
>>>>>> ProducerTemplate.sendBody("direct:in", Hello World");
>>>>>>
>>>>>> The class DefaultEndpoint should of course be there as the base class
>>>>>> ;)
>>>>>>
>>>>>>
>>>>>>
>>>>>> /Claus
>>>>>>
>>>>>> On Tue, Nov 11, 2008 at 10:40 PM, Hadrian Zbarcea <hzbarcea@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Claus,
>>>>>>>
>>>>>>> DefaultEndpoint is the base class for all Endpoints and provides
a
>>>>>>> default
>>>>>>> implementation of the Endpoint methods.
>>>>>>>
>>>>>>> Am I misunderstanding your question?
>>>>>>>
>>>>>>> Hadrian
>>>>>>>
>>>>>>> On Nov 11, 2008, at 2:22 PM, Claus Ibsen wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>>
>>>>>>>> I am wondering if this "default" endpoint is used by anyone?
I am
>>>>>>>> wondering what the purpose really is and what it solves.
Is it
>>>>>>>> possible to consider to remove this?
>>>>>>>> Would remove many methods for ProducerTemplate so less for
end users
>>>>>>>> to get confused by.
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> /Claus Ibsen
>>>>>>>> Apache Camel Committer
>>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>> /Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> Jon
>>>>
>>>> http://janstey.blogspot.com/
>>>
>>>
>>
>>
>>
>> --
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>
>

Mime
View raw message