James that is a perfect example. The annotation and producer template makes 1+1=3.
So let's keep it as is. /Claus Ibsen Apache Camel Committer Blog: http://davsclaus.blogspot.com/ On Mon, Nov 24, 2008 at 5:55 PM, James Strachan <[EMAIL PROTECTED]> wrote: > 2008/11/15 Claus Ibsen <[EMAIL PROTECTED]>: >> Hi >> >> Thanks for the explanation. But What I am raising a voice for is the >> Camel entry level users. When they start to use ProducerTemplate they >> get a long list of methods. So it can be confusing which method to >> use. Just to eplain the difference between sendXXX and requestXXX is >> quite "hard enought". So having this 3rd option that is very rarely >> used is on option I would like to eliminate. >> >> I have yet to see any documentation, end users requesting about it, >> unit test etc that uses this feature. >> >> There are 5 methods with the default thingy >> >> There are 8 methods with send >> There are 12 methods with sendBody >> There are 2 methods with request >> There are 6 methods with requestBody >> >> A total of: 33 methods. >> >> >> But I will turn my attention to other issues to tackle ;( >> >> >> >> /Claus Ibsen >> Apache Camel Committer >> Blog: http://davsclaus.blogspot.com/ >> >> >> >> On Fri, Nov 14, 2008 at 5:26 PM, Hiram Chirino <[EMAIL PROTECTED]> wrote: >>> The idea is that in Dependency Injection scenario is it's simpler to 1 >>> inject one thing (the template) into another object rather than 2 >>> things (the object and the endpoint). >>> >>> It's an ease of use issue. And camel is all about ease of use. >>> >>> Is this really complicating things that much? I would think there are >>> tougher issues to tackle. >>> >>> On Thu, Nov 13, 2008 at 1:04 PM, Claus Ibsen <[EMAIL PROTECTED]> wrote: >>>> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> >>>>>> 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 <[EMAIL PROTECTED]> >>>>>>>> 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 <[EMAIL PROTECTED]> >>>>>>>>>> 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/ >>>>> >>>>> >>>> >>> >>> >>> >>> -- >>> Regards, >>> Hiram >>> >>> Blog: http://hiramchirino.com >>> >>> Open Source SOA >>> http://open.iona.com >>> > > > So I'm cool with removing the defaultEndpointUri from the CamelContext > btw - creating a default ProducerTemplate without specifying a default > endpoint URI could just barf if you tried to send to the default > endpoint. > > However having a default endpoint URI on a ProducerTemplate is a good > thing; it lets folks send messages without having to worry, in their > Java code - of specifying where it goes unless they want to mediate > between multiple endpoints which they know about. > > e.g. > > public class MyFoo { > @Produce(ref="someEndpoint") > ProducerTemplate template; > > ... > template.sendBody("<hello>world!</hello>/>"); > > you then don't have to inject 2 objects; one the URI/endpoint and one > the producer. > > > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://fusesource.com/ >
