Load route from XML Exception

2013-03-31 Thread liuxu
 Hello,

camel 2.10.3
JDK 1.6

Help to tell me what causes the exception? Thank you very much! 

public static void main(String[] args) throws Exception {
ModelCamelContext ctx = new DefaultCamelContext();
RoutesDefinition rd = 
ctx.loadRoutesDefinition(TestFile.class.getResourceAsStream("routeContext.xml"));

ctx.addRouteDefinitions(rd.getRoutes());

ctx.start();
Thread.sleep(5);

ctx.stop();
}



Exception in thread "main" java.lang.IllegalArgumentException: interface 
org.apache.camel.spi.Required is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at 
com.sun.xml.bind.v2.model.annotation.LocatableAnnotation.create(LocatableAnnotation.java:37)
at 
com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getAllMethodAnnotations(RuntimeInlineAnnotationReader.java:47)
at 
com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getAllMethodAnnotations(RuntimeInlineAnnotationReader.java:17)
at 
com.sun.xml.bind.v2.model.impl.ClassInfoImpl.findGetterSetterProperties(ClassInfoImpl.java:872)
at 
com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:263)
at 
com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:91)
at 
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:127)
at 
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
at 
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
at 
com.sun.xml.bind.v2.model.impl.ReferencePropertyInfoImpl.addAllSubtypes(ReferencePropertyInfoImpl.java:181)
at 
com.sun.xml.bind.v2.model.impl.ReferencePropertyInfoImpl.calcTypes(ReferencePropertyInfoImpl.java:122)
at 
com.sun.xml.bind.v2.model.impl.ReferencePropertyInfoImpl.getElements(ReferencePropertyInfoImpl.java:74)
at 
com.sun.xml.bind.v2.model.impl.RuntimeReferencePropertyInfoImpl.getElements(RuntimeReferencePropertyInfoImpl.java:31)
at 
com.sun.xml.bind.v2.model.impl.ReferencePropertyInfoImpl.ref(ReferencePropertyInfoImpl.java:65)
at 
com.sun.xml.bind.v2.model.impl.RuntimeReferencePropertyInfoImpl.ref(RuntimeReferencePropertyInfoImpl.java:35)
at 
com.sun.xml.bind.v2.model.impl.RuntimeReferencePropertyInfoImpl.ref(RuntimeReferencePropertyInfoImpl.java:15)
at 
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
at 
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
at 
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
at 
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
at 
com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
at 
com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
at 
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:38)
at 
com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:36)
at java.util.AbstractList$Itr.next(AbstractList.java:347)
at 
com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
at 
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:49)
at 
com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:41)
at 
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
at 
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$1.run(JAXBContextImpl.java:343)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$1.run(JAXBContextImpl.java:340)
at java.security.AccessController.doPrivileged(Native Method)
at 
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:340)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:204)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:589)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:299)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at 
org.apache

RE: How can I deal with & character in password when sending an email

2013-03-31 Thread liugang
Does this work on 2.10.4, or only works from 2.11.0?

Thanks.
GangLiu

-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Friday, March 29, 2013 4:18 PM
To: users@camel.apache.org
Subject: Re: How can I deal with & character in password when sending an
email

Hi

See
http://camel.465427.n5.nabble.com/HEADS-UP-Configuring-passwords-in-Camel-en
dpoints-is-now-easier-with-new-RAW-syntax-tp5729782.html

On Fri, Mar 29, 2013 at 9:09 AM, liugang  wrote:
> Hi All:
>
> If the mail password includes a '&' char, then how can I pass it?
>
> I tried %26 or %2526, seems both of them doesn't work.
>
> I'm using camel 2.10.4 .
>
> Can anybody give me a tip? Thanks very much.
>
> GangLiu
>



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



Re: Need help with cxfrs component, actually RESTful service consumption, in general

2013-03-31 Thread Raul Kripalani
Hi guys,

Take a look at the new Simple binding style for CXFRS consumers, which
greatly simplifies consuming REST requests:
https://cwiki.apache.org/confluence/display/CAMEL/CXFRS#CXFRS-ConsumingaRESTRequestSimpleBindingStyle
.

Fresh out of the oven.

Regards,

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Fri, Mar 29, 2013 at 6:43 PM, Chris Wolf  wrote:

> Hello - I just used camel-http to do my RESTful service invocation and
> it's good enough for my basic purposes.
>
>-Chris
>
> On Fri, Mar 29, 2013 at 11:30 AM, Chris Wolf  wrote:
> > On Fri, Mar 29, 2013 at 9:23 AM, Sergey Beryozkin 
> wrote:
> >> On 29/03/13 11:05, Claus Ibsen wrote:
> >>>
> >>> Hi
> >>>
> >>> There is also camel-restlet
> >>> http://camel.apache.org/restlet
> >>>
> >>> It may be easier to get hold of and use. But CXF may have more
> >>> configuration options, but is also IMHO harder to get started with
> >>> using - some of that is us to blame, for not having better
> >>> documentation and samples. And the fact that IMHO camel-cxf has both
> >>> WS and RS in the same big giant component, which IMHO is becoming a
> >>> problem and hurts the lightweightness of Camel and CXF.
> >>
> >> Really ? I agree that it is not the easiest component to use - that is
> fare
> >> and personally I'd have no problems with sharing part of the 'blame'
> for not
> >> contributing, but please don't do this "hurts the Camel " thing, which
> is
> >> FUD IMHO - FYI, I'm perfectly fine with yourself having the
> preferences, no
> >> problems there at all !
> >>
> >> Chris: feel free to experiment with all the other HTTP-aware components,
> >> some of them indeed are simpler to use for a given task.
> >> FYI, I'm going to work on doing a better demo of using CXF JAX-RS
> endpoints
> >> directly within Camel, specifically, using the Camel transport to link
> >> directly to CXF jaxrs:endpoints, and will update the list.
> >>
> >> Thanks, Sergey
> >
> > Even just a basic client making an HTTP GET and getting back some text
> > would be great. I still can't do that.
> > (See my recent reply to Claus)
> >
> > Thanks,
> >
> > Chris
> >
> >>>
> >>>
> >>> You may also take a look at some of the articles about Camel. There
> >>> should be some good ones about REST etc
> >>> http://camel.apache.org/articles
> >>>
> >>> For example this article
> >>> http://www.ofbizian.com/2012/02/apache-camel-rest-example.html
> >>>
> >>> But there is others as well.
> >>>
> >>>
> >>>
> >>> On Thu, Mar 28, 2013 at 11:35 PM, Chris Wolf
>  wrote:
> 
>  So I have the book, "Camel In Action", which is a very good and
>  thorough treatment of camel-core. However, now my development efforts
>  are starting to hit severe turbulence upon making the jump from
>  camel-core to camel-cxf, in particular, how to consume a RESTful
>  service?
> 
>  I read these:
>  http://camel.apache.org/cxfrs.html
>  http://camel.apache.org/cxf-bean-component.html
> 
>  ...but these pages seem to be reference pages for people who have
>  already mastered camel-cxfrs - not newbies, like me.  Can anyone point
>  me to an end-to-end example?  I don't need the server-side - this is
>  legacy and produces XML.
> 
>  N.B. Outside of Camel, I have had much previous experience using CXF
>  for JAX-WS style services, client and server  (never JAX-RS, though)
> 
>  Thanks for any help,
> 
> -Chris
> >>>
> >>>
> >>>
> >>>
> >>
> >>
>


Camel CXF RS: New Simple binding style for JAX-RS

2013-03-31 Thread Raul Kripalani
Hi users,

As you may know, Camel has supported JAX-RS under the camel-cxfrs component
for a long time now.

However, the support has been rather low-level, requiring the user to
manually process the MessageContentsList object coming into the route. Thus
tightly coupling the route logic with the method signature and parameter
indices of the JAX-RS operation. Somewhat inelegant, difficult and
error-prone.

As of Camel 2.11 (soon to be released), there's a new Simple binding style
performing with these improvements:

  * JAX-RS Parameters (@HeaderParam, @QueryParam, etc.) are injected as IN
message headers.
  * The request entity (POJO or other type) becomes the IN message body.
  * Binary @Multipart body parts become attachments, supporting
DataHandler, InputStream, DataSource and CXF's Attachment class.
  * Non-binary @Multipart body parts are mapped as IN message headers.

The Response mapping has also improved, now recognising custom Responses,
the Exchange.HTTP_RESPONSE_CODE header, and more.

This binding style can be activated by setting the bindingStyle parameter
to 'SimpleConsumer'.

Examples and more info here [1]. Or here [2] for the impatient (the Camel
site takes a while to update from the Wiki).

[1]
http://camel.apache.org/cxfrs.html#CXFRS-ConsumingaRESTRequestSimpleBindingStyle
[2]
https://cwiki.apache.org/confluence/display/CAMEL/CXFRS#CXFRS-ConsumingaRESTRequestSimpleBindingStyle

Regards,

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk


It is possible with Camel to use dynamic consumer? **after context start**

2013-03-31 Thread Chris Wolf
Claus,

You addressed the issue of "dynamic URIs for Consumers" back in July-2009:

http://camel.465427.n5.nabble.com/Dynamic-consumers-with-Camel-td476433.html

However, all those use-cases, except for maybe #4, web console, which
I can't run all are about
calculating the URI *before* the context is started.  What I'm looking
for is a way to create and insert
or update a polling consumer's URI - at runtime - *after* the context
is started.

For example:

 from("direct:start")
.beanRef("config")
.convertBodyTo(Document.class)
.setHeader("Ftp_URI").xquery(
"concat('ftp://'" +...some more xpaths into the
inbound config doc...), String.class)
 .pollEnrich(/* whoops! this is referenced at route
setup time, not route runtime... - it won't work */)
 .to("log:...");

So the question, more generally, is is it possible to alter the route
definition - at runtime? i.e. after the route/context are started?

You sorted of hinted at this in that July-2009 posting when you said:

"2) You can always stop, modify and start a route in Camel at runtime."

I don't see how that would work since I would likely be attempting to
modify the route at runtime
from a bean method in the route - or are you suggesting one route
stops/modifies another route?

So the way I see it is - I would create the ftp route with a bogus URI
and option "&startScheduler=false",
on the ftp endpoint, or autoStart=false on the route.  Then in
*another* route - the "configurer" route,
I guess, access the ftp route and reconfigure the endpoint with the
real settings, then start it's poll scheduler (or start it's route).

Something like that?  Any easier, more direct way?

Thanks,


Chris


Re: Camel routing issue

2013-03-31 Thread Chris Wolf
Here you go:


.choice().when(header("Type").isNotNull())
.recipientList(simple("activemq.Inbound.${header.Type}"))
.endChoice()


Sorry for hijacking your thread, but I also was not getting
"recipientList" to implement dynamic destinations.  I get it now,
pretty much,
I just don't know how to specify a polling consumer with dynamic uri...

Regards,

Chris

On Sun, Mar 31, 2013 at 2:21 PM, prabumc...@gmail.com
 wrote:
> Thanks for your faq url,but I did not understand anything from that faq.
>
> as I told already
>
> .to("activemq.Inbound."+ header(" Type")
>
> Please kindly provide with example.
>
> Thanks
> Prabu.n
> On Mar 31, 2013 11:22 PM, "Chris Wolf [via Camel]" <
> ml-node+s465427n5730134...@n5.nabble.com> wrote:
>
>> Ok, I'm starting to get it - a little bit.  As for my concrete
>> example, so far, I have:
>>
>> from("direct:start")
>> .beanRef("config")
>> .convertBodyTo(Document.class)
>> .recipientList().xquery(
>> "concat('ftp://'" +
>> ",//remote[vendorId/@value='CBOE34']/server/@value" +
>>
>> ",//remote[vendorId/@value='CBOE34']/param[name/@value='directory']/value/@value"
>>
>> +
>> ",'?noop=true&username='" +
>> ",//remote[vendorId/@value='CBOE34']/username/@value"
>> +
>> ",'&password='" +
>>
>> ",//remote[vendorId/@value='CBOE34']/password/@value)", String.class);
>>
>> Here's the problem - this will create an FTP Producer - that's not
>> what I need.  I need a dynamically
>> constructed URI for a polling FTP consumer.  I don't think
>> "recipientList" will work...   Any ideas?
>>
>> Thanks,
>>
>> Chris
>>
>> On Sun, Mar 31, 2013 at 10:27 AM, Chris Wolf <[hidden 
>> email]>
>> wrote:
>>
>> > Hi Claus,
>> >
>> > I hate to ask this - but I still don't get it.  I thought
>> > "recipientList" was for sending to multiple, runtime-defined
>> > recipients.  I don't see how this
>> > answers the question of sending to one, single recipient, whose URI is
>> > dynamically constructed - and in my use-case the dynamic settings
>> > are not in properties - so "simple" (property place-holders) won't help
>> me.
>> >
>> > Let me give you a concrete example.  I need to do an ftp download and
>> > the connection information comes from up-stream in the route in the
>> > form of XML (DOM - a Document instance).  Currently, I am trying to do
>> > this with bean binding and method params decorated with @XPath
>> > pointing into the Document with the ftp settings and inside the
>> > this method doing:
>> >
>> > FtpComponent ftpComponent = context.getComponent("ftp",
>> FtpComponent.class);
>> >
>> > ..and then attempt to get the endpoint and call createConsumer(...).
>> > I'm sure this is not the right way to do it, but I don't see how else
>> > - any ideas?
>> >
>> > Thanks,
>> >
>> >
>> > Chris
>> >
>> > On Sun, Mar 31, 2013 at 2:28 AM, Claus Ibsen <[hidden 
>> > email]>
>> wrote:
>> >> Hi
>> >>
>> >> See this FAQ
>> >> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>> >>
>> >>
>> >>
>> >>
>> >> On Sun, Mar 31, 2013 at 5:22 AM, [hidden 
>> >> email]
>> >> <[hidden email] 
>> >> >wrote:
>>
>> >>
>> >>> Thanks Walzer..
>> >>> *
>> >>> *
>> >>> *Queston1:
>> >>>
>> >>> *
>> >>> *Example*
>> >>>
>> >>> .when(header("foo").isEqualTo("bar"))
>> >>> .to("direct:b")
>> >>>
>> >>> In my case i have to add more than 80 condition and forwards to 80
>> >>> different queues.
>> >>>
>> >>> Above example i can only hard-code queue name,But what i want is
>> below.
>> >>>
>> >>> * .when(header("Type").isNotNull())
>> >>> .to("activemq.Inbound."+header("Type"))
>> >>> *
>> >>>
>> >>> Example:If queue type is test,It should forward to *Inbound.test*
>> queue.
>> >>>
>> >>> Above example i tried,but it did not worked,created queue something
>> >>> like this *Inbound.header("type")*
>> >>>
>> >>> *Question2*:
>> >>>
>> >>> from("direct:a")
>> >>> .multicast().to("direct:b", "direct:c", "direct:d");
>> >>>
>> >>> Based on messages header and content type i want forward to different
>> >>> queue.
>> >>>
>> >>> condition will be *OR *and *AND*.How can i do that like above
>> example.*
>> >>> *
>> >>>
>> >>> Thanks in advance*
>> >>> *
>> >>>
>> >>> *Regards*
>> >>>
>> >>> Prabu.N
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> On Sun, Mar 31, 2013 at 2:43 AM, Walzer, Thomas [via Camel] <
>> >>> [hidden email] >
>> wrote:
>> >>>
>> >>> > Hi,
>> >>> >
>> >>> > you could start by reading Claus´ book (p. 44ff) which has a perfect
>> >>> > example or http://ca

Re: Camel routing issue

2013-03-31 Thread prabumc...@gmail.com
Thanks for your faq url,but I did not understand anything from that faq.

as I told already

.to("activemq.Inbound."+ header(" Type")

Please kindly provide with example.

Thanks
Prabu.n
On Mar 31, 2013 11:22 PM, "Chris Wolf [via Camel]" <
ml-node+s465427n5730134...@n5.nabble.com> wrote:

> Ok, I'm starting to get it - a little bit.  As for my concrete
> example, so far, I have:
>
> from("direct:start")
> .beanRef("config")
> .convertBodyTo(Document.class)
> .recipientList().xquery(
> "concat('ftp://'" +
> ",//remote[vendorId/@value='CBOE34']/server/@value" +
>
> ",//remote[vendorId/@value='CBOE34']/param[name/@value='directory']/value/@value"
>
> +
> ",'?noop=true&username='" +
> ",//remote[vendorId/@value='CBOE34']/username/@value"
> +
> ",'&password='" +
>
> ",//remote[vendorId/@value='CBOE34']/password/@value)", String.class);
>
> Here's the problem - this will create an FTP Producer - that's not
> what I need.  I need a dynamically
> constructed URI for a polling FTP consumer.  I don't think
> "recipientList" will work...   Any ideas?
>
> Thanks,
>
> Chris
>
> On Sun, Mar 31, 2013 at 10:27 AM, Chris Wolf <[hidden 
> email]>
> wrote:
>
> > Hi Claus,
> >
> > I hate to ask this - but I still don't get it.  I thought
> > "recipientList" was for sending to multiple, runtime-defined
> > recipients.  I don't see how this
> > answers the question of sending to one, single recipient, whose URI is
> > dynamically constructed - and in my use-case the dynamic settings
> > are not in properties - so "simple" (property place-holders) won't help
> me.
> >
> > Let me give you a concrete example.  I need to do an ftp download and
> > the connection information comes from up-stream in the route in the
> > form of XML (DOM - a Document instance).  Currently, I am trying to do
> > this with bean binding and method params decorated with @XPath
> > pointing into the Document with the ftp settings and inside the
> > this method doing:
> >
> > FtpComponent ftpComponent = context.getComponent("ftp",
> FtpComponent.class);
> >
> > ..and then attempt to get the endpoint and call createConsumer(...).
> > I'm sure this is not the right way to do it, but I don't see how else
> > - any ideas?
> >
> > Thanks,
> >
> >
> > Chris
> >
> > On Sun, Mar 31, 2013 at 2:28 AM, Claus Ibsen <[hidden 
> > email]>
> wrote:
> >> Hi
> >>
> >> See this FAQ
> >> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
> >>
> >>
> >>
> >>
> >> On Sun, Mar 31, 2013 at 5:22 AM, [hidden 
> >> email]
> >> <[hidden email] 
> >> >wrote:
>
> >>
> >>> Thanks Walzer..
> >>> *
> >>> *
> >>> *Queston1:
> >>>
> >>> *
> >>> *Example*
> >>>
> >>> .when(header("foo").isEqualTo("bar"))
> >>> .to("direct:b")
> >>>
> >>> In my case i have to add more than 80 condition and forwards to 80
> >>> different queues.
> >>>
> >>> Above example i can only hard-code queue name,But what i want is
> below.
> >>>
> >>> * .when(header("Type").isNotNull())
> >>> .to("activemq.Inbound."+header("Type"))
> >>> *
> >>>
> >>> Example:If queue type is test,It should forward to *Inbound.test*
> queue.
> >>>
> >>> Above example i tried,but it did not worked,created queue something
> >>> like this *Inbound.header("type")*
> >>>
> >>> *Question2*:
> >>>
> >>> from("direct:a")
> >>> .multicast().to("direct:b", "direct:c", "direct:d");
> >>>
> >>> Based on messages header and content type i want forward to different
> >>> queue.
> >>>
> >>> condition will be *OR *and *AND*.How can i do that like above
> example.*
> >>> *
> >>>
> >>> Thanks in advance*
> >>> *
> >>>
> >>> *Regards*
> >>>
> >>> Prabu.N
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On Sun, Mar 31, 2013 at 2:43 AM, Walzer, Thomas [via Camel] <
> >>> [hidden email] >
> wrote:
> >>>
> >>> > Hi,
> >>> >
> >>> > you could start by reading Claus´ book (p. 44ff) which has a perfect
> >>> > example or http://camel.apache.org/content-based-router.html (just
> >>> > replace the direct: with your queues).
> >>> > If you need to fire your messages to multiple queues:
> >>> > http://camel.apache.org/publish-subscribe-channel.html shows you
> the
> >>> > various ways.
> >>> > When you get the concepts you can just "lego" them together.
> >>> >
> >>> > Regards, Thomas.
> >>> >
> >>> > Am 30.03.2013 um 19:05 schrieb "[hidden email]<
> >>> http://user/SendEmail.jtp?type=node&node=5730116&i=0>"
> >>> > <[hidden email] <
> http://user/SendEmail.jtp?type=node&node=5730116&i=1>>:
> >>> >
> >>> > > Hi Claus,
> >>> > >
> >>> > > Thanks so much Clus for 

Re: Camel routing issue

2013-03-31 Thread Chris Wolf
Ok, I'm starting to get it - a little bit.  As for my concrete
example, so far, I have:

from("direct:start")
.beanRef("config")
.convertBodyTo(Document.class)
.recipientList().xquery(
"concat('ftp://'" +
",//remote[vendorId/@value='CBOE34']/server/@value" +

",//remote[vendorId/@value='CBOE34']/param[name/@value='directory']/value/@value"
+
",'?noop=true&username='" +
",//remote[vendorId/@value='CBOE34']/username/@value" +
",'&password='" +

",//remote[vendorId/@value='CBOE34']/password/@value)", String.class);

Here's the problem - this will create an FTP Producer - that's not
what I need.  I need a dynamically
constructed URI for a polling FTP consumer.  I don't think
"recipientList" will work...   Any ideas?

Thanks,

Chris

On Sun, Mar 31, 2013 at 10:27 AM, Chris Wolf  wrote:
> Hi Claus,
>
> I hate to ask this - but I still don't get it.  I thought
> "recipientList" was for sending to multiple, runtime-defined
> recipients.  I don't see how this
> answers the question of sending to one, single recipient, whose URI is
> dynamically constructed - and in my use-case the dynamic settings
> are not in properties - so "simple" (property place-holders) won't help me.
>
> Let me give you a concrete example.  I need to do an ftp download and
> the connection information comes from up-stream in the route in the
> form of XML (DOM - a Document instance).  Currently, I am trying to do
> this with bean binding and method params decorated with @XPath
> pointing into the Document with the ftp settings and inside the
> this method doing:
>
> FtpComponent ftpComponent = context.getComponent("ftp", FtpComponent.class);
>
> ..and then attempt to get the endpoint and call createConsumer(...).
> I'm sure this is not the right way to do it, but I don't see how else
> - any ideas?
>
> Thanks,
>
>
> Chris
>
> On Sun, Mar 31, 2013 at 2:28 AM, Claus Ibsen  wrote:
>> Hi
>>
>> See this FAQ
>> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>>
>>
>>
>>
>> On Sun, Mar 31, 2013 at 5:22 AM, prabumc...@gmail.com
>> wrote:
>>
>>> Thanks Walzer..
>>> *
>>> *
>>> *Queston1:
>>>
>>> *
>>> *Example*
>>>
>>> .when(header("foo").isEqualTo("bar"))
>>> .to("direct:b")
>>>
>>> In my case i have to add more than 80 condition and forwards to 80
>>> different queues.
>>>
>>> Above example i can only hard-code queue name,But what i want is below.
>>>
>>> * .when(header("Type").isNotNull())
>>> .to("activemq.Inbound."+header("Type"))
>>> *
>>>
>>> Example:If queue type is test,It should forward to *Inbound.test* queue.
>>>
>>> Above example i tried,but it did not worked,created queue something
>>> like this *Inbound.header("type")*
>>>
>>> *Question2*:
>>>
>>> from("direct:a")
>>> .multicast().to("direct:b", "direct:c", "direct:d");
>>>
>>> Based on messages header and content type i want forward to different
>>> queue.
>>>
>>> condition will be *OR *and *AND*.How can i do that like above example.*
>>> *
>>>
>>> Thanks in advance*
>>> *
>>>
>>> *Regards*
>>>
>>> Prabu.N
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sun, Mar 31, 2013 at 2:43 AM, Walzer, Thomas [via Camel] <
>>> ml-node+s465427n5730116...@n5.nabble.com> wrote:
>>>
>>> > Hi,
>>> >
>>> > you could start by reading Claus´ book (p. 44ff) which has a perfect
>>> > example or http://camel.apache.org/content-based-router.html (just
>>> > replace the direct: with your queues).
>>> > If you need to fire your messages to multiple queues:
>>> > http://camel.apache.org/publish-subscribe-channel.html shows you the
>>> > various ways.
>>> > When you get the concepts you can just "lego" them together.
>>> >
>>> > Regards, Thomas.
>>> >
>>> > Am 30.03.2013 um 19:05 schrieb "[hidden email]<
>>> http://user/SendEmail.jtp?type=node&node=5730116&i=0>"
>>> > <[hidden email] >:
>>> >
>>> > > Hi Claus,
>>> > >
>>> > > Thanks so much Clus for help.It is working now.
>>> > >
>>> > > I need your guidance for the following requirement.
>>> > >
>>> > > 1.I have one *inbound queue* it will receive message frequently from my
>>> > > application.
>>> > > 2.From *inbound queue* i need camel routing to move message from
>>> > > another *message
>>> > > based inbound queue* based on message header value.
>>> > > 3.From *message based inbound queue *i* *need camel routing to move
>>> > message
>>> > > to *one or more outbound queue *based on message content*
>>> > > *
>>> > >
>>> > > I need *camel java DSL*sample code for above requirement.*
>>> > > *
>>> > > *
>>> > > *
>>> > > *Thanks in advance*
>>> > >
>>> > >
>>> > > On Sat, Mar 30, 2013 at 3:10 PM, Claus Ibsen-2 [via Camel] <
>>> > > [hidden email] >
>>> > wrote:
>>> > >
>>> > >> Hi
>>> > >>
>>> > >> Do as the exception tells you. Chec

Re: Camel routing issue

2013-03-31 Thread Chris Wolf
Hi Claus,

I hate to ask this - but I still don't get it.  I thought
"recipientList" was for sending to multiple, runtime-defined
recipients.  I don't see how this
answers the question of sending to one, single recipient, whose URI is
dynamically constructed - and in my use-case the dynamic settings
are not in properties - so "simple" (property place-holders) won't help me.

Let me give you a concrete example.  I need to do an ftp download and
the connection information comes from up-stream in the route in the
form of XML (DOM - a Document instance).  Currently, I am trying to do
this with bean binding and method params decorated with @XPath
pointing into the Document with the ftp settings and inside the
this method doing:

FtpComponent ftpComponent = context.getComponent("ftp", FtpComponent.class);

..and then attempt to get the endpoint and call createConsumer(...).
I'm sure this is not the right way to do it, but I don't see how else
- any ideas?

Thanks,


Chris

On Sun, Mar 31, 2013 at 2:28 AM, Claus Ibsen  wrote:
> Hi
>
> See this FAQ
> http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html
>
>
>
>
> On Sun, Mar 31, 2013 at 5:22 AM, prabumc...@gmail.com
> wrote:
>
>> Thanks Walzer..
>> *
>> *
>> *Queston1:
>>
>> *
>> *Example*
>>
>> .when(header("foo").isEqualTo("bar"))
>> .to("direct:b")
>>
>> In my case i have to add more than 80 condition and forwards to 80
>> different queues.
>>
>> Above example i can only hard-code queue name,But what i want is below.
>>
>> * .when(header("Type").isNotNull())
>> .to("activemq.Inbound."+header("Type"))
>> *
>>
>> Example:If queue type is test,It should forward to *Inbound.test* queue.
>>
>> Above example i tried,but it did not worked,created queue something
>> like this *Inbound.header("type")*
>>
>> *Question2*:
>>
>> from("direct:a")
>> .multicast().to("direct:b", "direct:c", "direct:d");
>>
>> Based on messages header and content type i want forward to different
>> queue.
>>
>> condition will be *OR *and *AND*.How can i do that like above example.*
>> *
>>
>> Thanks in advance*
>> *
>>
>> *Regards*
>>
>> Prabu.N
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Mar 31, 2013 at 2:43 AM, Walzer, Thomas [via Camel] <
>> ml-node+s465427n5730116...@n5.nabble.com> wrote:
>>
>> > Hi,
>> >
>> > you could start by reading Claus´ book (p. 44ff) which has a perfect
>> > example or http://camel.apache.org/content-based-router.html (just
>> > replace the direct: with your queues).
>> > If you need to fire your messages to multiple queues:
>> > http://camel.apache.org/publish-subscribe-channel.html shows you the
>> > various ways.
>> > When you get the concepts you can just "lego" them together.
>> >
>> > Regards, Thomas.
>> >
>> > Am 30.03.2013 um 19:05 schrieb "[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5730116&i=0>"
>> > <[hidden email] >:
>> >
>> > > Hi Claus,
>> > >
>> > > Thanks so much Clus for help.It is working now.
>> > >
>> > > I need your guidance for the following requirement.
>> > >
>> > > 1.I have one *inbound queue* it will receive message frequently from my
>> > > application.
>> > > 2.From *inbound queue* i need camel routing to move message from
>> > > another *message
>> > > based inbound queue* based on message header value.
>> > > 3.From *message based inbound queue *i* *need camel routing to move
>> > message
>> > > to *one or more outbound queue *based on message content*
>> > > *
>> > >
>> > > I need *camel java DSL*sample code for above requirement.*
>> > > *
>> > > *
>> > > *
>> > > *Thanks in advance*
>> > >
>> > >
>> > > On Sat, Mar 30, 2013 at 3:10 PM, Claus Ibsen-2 [via Camel] <
>> > > [hidden email] >
>> > wrote:
>> > >
>> > >> Hi
>> > >>
>> > >> Do as the exception tells you. Check route 2. You route from
>> > >> "Inbound.SSS.TestEvent". And that is now know to Camel.
>> > >>
>> > >> Maybe you need to add "activemq:" as prefix so its
>> > >> "activemq:Inbound.SSS.TestEvent".
>> > >>
>> > >>
>> > >> On Fri, Mar 29, 2013 at 7:01 PM, [hidden email]<
>> > http://user/SendEmail.jtp?type=node&node=5730109&i=0>
>> > >> <[hidden email] > >>
>> >
>> > >> wrote:
>> > >>
>> > >>>
>> > >>> I have activemmq  Project in that i have following requirement
>> > >>>
>> > >>> 1.Move message from Inbound queue to type based inbound queue.
>> > >>> 2.Move message from Message type inbound queue to outbound queue
>> > >>>
>> > >>> I have created two bean for to achieve this.
>> > >>>
>> > >>> 1.one for move from inbound to message type  inbound queue
>> > >>> 2.one for move from inbound to outbound queue.
>> > >>>
>> > >>> I have following entry in camel.xml
>> > >>>
>> > >>>   http://camel.apache.org/schema/spring";>
>> > >>
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>>> > >>> class="com.came