Re: Load route from XML Exception

2013-04-01 Thread Willem jiang
Hi,

Why did you need to load CXF internal API to load the routeContext?
Can yo just use SpringCamelContext to load the camel routes?

BTW, can you pass the routeContext.xml here?
It could be much easier for us to reproduce the error by trying your test case.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) 
(English)
  http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, April 1, 2013 at 2:48 PM, liuxu wrote:

> 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.C

Re: Camel routing issue

2013-04-01 Thread Claus Ibsen
Hi

See this EIP
http://camel.apache.org/content-enricher.html

About pollEnrich.

Though pollEnrich currently does support dynamic uris. Its on the roadmap,
for Camel 3.0.
It requires an API change and thus isn't so easy to implement currently on
2.x.

You can always use a java bean / camel processor, and consume the ftp file
from java code.
For example using consumer template.

As you use FTP you may want to set disconnect=true so the connect is not
remained open after usage.



On Sun, Mar 31, 2013 at 7:51 PM, Chris Wolf  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  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] <
> http://user/SendEmail.jtp?type=node&node=5730116&i=1>>:
> >>> >
> >>> > > Hi Claus,
> >>> > >
> >>> > > Thanks so much Clus for help.It is working now.
> >>> > >
> >>> > > I need your guidance for the fo

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

2013-04-01 Thread Claus Ibsen
Camel 2.11


On Mon, Apr 1, 2013 at 5:47 AM, liugang  wrote:

> 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
>
>


-- 
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: Camel CXF RS: New Simple binding style for JAX-RS

2013-04-01 Thread Claus Ibsen
Hi

This seems indeed much better.

It would be great with an example in examples, as well with a web page to
go along. We dont have any REST examples out of the box in Camel.
http://camel.apache.org/examples



On Sun, Mar 31, 2013 at 10:10 PM, Raul Kripalani  wrote:

> 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
>



-- 
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: Camel CXF RS: New Simple binding style for JAX-RS

2013-04-01 Thread Raul Kripalani
Hi Claus,

Yeah, I plan to add more examples soon. And a blog post is in the pipeline
too ;)

Thanks,

*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 Mon, Apr 1, 2013 at 9:45 AM, Claus Ibsen  wrote:

> Hi
>
> This seems indeed much better.
>
> It would be great with an example in examples, as well with a web page to
> go along. We dont have any REST examples out of the box in Camel.
> http://camel.apache.org/examples
>
>
>
> On Sun, Mar 31, 2013 at 10:10 PM, Raul Kripalani  wrote:
>
> > 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
> >
>
>
>
> --
> 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: Camel routing issue

2013-04-01 Thread prabumc...@gmail.com
Like Chris suggest i tried below way


 .when(header("TYPE").isNotNull())
   .to("activemq:queue.Inbound.${header.Type}")


But queue created *${header.Type}* like this not *Inbound.test*

Please kindly give me example.

*Regards*
Prabu.N



On Mon, Apr 1, 2013 at 2:03 PM, Claus Ibsen-2 [via Camel] <
ml-node+s465427n5730152...@n5.nabble.com> wrote:

> Hi
>
> See this EIP
> http://camel.apache.org/content-enricher.html
>
> About pollEnrich.
>
> Though pollEnrich currently does support dynamic uris. Its on the roadmap,
> for Camel 3.0.
> It requires an API change and thus isn't so easy to implement currently on
> 2.x.
>
> You can always use a java bean / camel processor, and consume the ftp file
> from java code.
> For example using consumer template.
>
> As you use FTP you may want to set disconnect=true so the connect is not
> remained open after usage.
>
>
>
> On Sun, Mar 31, 2013 at 7:51 PM, Chris Wolf <[hidden 
> email]>
> 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
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >

Re: Camel routing issue

2013-04-01 Thread prabumc...@gmail.com
Chris,The following code worked fine.

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

but,one issue is that.I added *.otherwise()* , it giving error.

.choice().when(header("Type").isNotNull())
 .recipientList(simple("activemq.Inbound.${header.Type}"))
*.otherwise()
.to("activemq:queue:Invalid.queue")*
.endChoice();

please kindly help me.



On Mon, Apr 1, 2013 at 2:32 PM, Prabu  wrote:

> Like Chris suggest i tried below way
>
>
>  .when(header("TYPE").isNotNull())
>.to("activemq:queue.Inbound.${header.Type}")
>
>
> But queue created *${header.Type}* like this not *Inbound.test*
>
> Please kindly give me example.
>
> *Regards*
> Prabu.N
>
>
>
> On Mon, Apr 1, 2013 at 2:03 PM, Claus Ibsen-2 [via Camel] <
> ml-node+s465427n5730152...@n5.nabble.com> wrote:
>
>> Hi
>>
>> See this EIP
>> http://camel.apache.org/content-enricher.html
>>
>> About pollEnrich.
>>
>> Though pollEnrich currently does support dynamic uris. Its on the
>> roadmap,
>> for Camel 3.0.
>> It requires an API change and thus isn't so easy to implement currently
>> on
>> 2.x.
>>
>> You can always use a java bean / camel processor, and consume the ftp
>> file
>> from java code.
>> For example using consumer template.
>>
>> As you use FTP you may want to set disconnect=true so the connect is not
>> remained open after usage.
>>
>>
>>
>> On Sun, Mar 31, 2013 at 7:51 PM, Chris Wolf <[hidden 
>> email]>
>> 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 

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

2013-04-01 Thread Martin Stiborský
Hi,
that's really awesome. Thanks a lot. Can't wait to try it out and
incorporate into our project.



On Mon, Apr 1, 2013 at 10:52 AM, Raul Kripalani  wrote:

> Hi Claus,
>
> Yeah, I plan to add more examples soon. And a blog post is in the pipeline
> too ;)
>
> Thanks,
>
> *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 Mon, Apr 1, 2013 at 9:45 AM, Claus Ibsen  wrote:
>
> > Hi
> >
> > This seems indeed much better.
> >
> > It would be great with an example in examples, as well with a web page to
> > go along. We dont have any REST examples out of the box in Camel.
> > http://camel.apache.org/examples
> >
> >
> >
> > On Sun, Mar 31, 2013 at 10:10 PM, Raul Kripalani 
> wrote:
> >
> > > 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
> > >
> >
> >
> >
> > --
> > 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
> >
>



-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: st...@njs.netlab.cz
Twitter: http://www.twitter.com/stibi


Re: Performance puzzle. Slow splitter on object array?

2013-04-01 Thread Christian Müller
To be honest, I don't understand how your body gets splitted... The body
which your splitter receives is the GernericPayload object, right?

Best,
Christian


On Tue, Mar 26, 2013 at 10:58 PM, MarkD wrote:

> Of course, i'll paste the entire route:
>
>
> 
> 
> uri="netty:{{broadcastTmProtocol}}://{{broadcastTmHost}}:{{broadcastTmPort}}?receiveBufferSizePredictor=65536&decoders=#broadcastDecoder&sync=false"
> />
> 
> ${body}
> 
> 
> 
>  />
> 
> 
> 
>
>
> You'll notice this is slightly different to the hawtio diagram. The from
> seda:udp endpoint which started the route in the image was a product of us
> making sure it wasn't the netty endpoint/codec causing the bottleneck. It
> wasn't so we put the route back to the one pasted above.
> The parallelProcessing and streaming options were adding just in case. The
> website says they are false by default but the xsd claims they are true :)
>
> As you can see it's literally a simple expression on the in body.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Performance-puzzle-Slow-splitter-on-object-array-tp5729867p5729873.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: SMPP stop route problem

2013-04-01 Thread Christian Müller
Please find my comments inline...

Best,
Christian


On Wed, Mar 27, 2013 at 9:04 AM, fclose  wrote:

> Christian, I still have a question about what you said
>
>
>
> Christian Mueller wrote
> > If you want to return another error code, simply catch the exception in
> > your route and rethrow an org.jsmpp.extra.ProcessRequestException (with
> > the
> > error code you want) which is returned to the SMSC.
>
>
> As my route is defined using the spring dsl and looks like below, how would
> you recommend me to catch the exception and throw another one ?
>
Exactly. You can use the doTry() doCatch() DSL.


> using a failure handler ?
> maybe it would be converting the route to the java dsl
>
>
>
>  deadLetterUri="smsReceivingDLQueue">
>  logHandled="false"/>
> 
>
>
>  errorHandlerRef="smsReceivingErrorHandler">
> 
> 
> 
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729903.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Cannot rollback() inside an XASession with AMQ 5.6

2013-04-01 Thread Christian Müller
With Camel 2.10.4 and ActiveMQ 5.7.0 I can reproduce the issue.
However, by using Camel 2.10.4 and ActiveMQ 5.8.0 everything works fine for
me. I updated my GitHub project [1]. Can you please verify whether you
still have the issue with these versions.

[1] https://github.com/muellerc/camel-in-transaction

Best,
Christian


On Fri, Mar 29, 2013 at 7:56 PM, Christian Müller <
christian.muel...@gmail.com> wrote:

> Will try it in the next days...
>
> Sent from a mobile device
> Am 29.03.2013 16:08 schrieb "Fladnag" :
>
> > And can you use Camel 2.10.x? I will upgrade the examples to the latest
>> > Camel version in the next day...
>>
>> Same issue with this environment :
>> SMX 4.5.1
>> Camel 2.10.4
>> AMQ 5.7.0
>> Aries 0.3
>> Spring 3.0.7
>>
>> With a fresh download of SMX 4.5.1 distribution, I just doing that :
>> * Starting SMX
>> * osgi:list | grep Transaction
>> for found Aries Transaction Manager bundle id
>> * osgi:update 
>> * copy my blueprint file to deploy
>>
>> The update of aries TM is necessary because without it, the bundle does
>> not
>> register org.springframework.transaction.PlatformTransactionManager
>> interface.
>> (Check with osgi:ls )
>>
>> In org.apache.aries.transaction.TransactionManagerService, the PlatformTM
>> is
>> registered only if we can construct a Spring transaction, but Spring
>> Transaction Manager start after aries... so it don't work at startup.
>>
>> The stack with this environment :
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Cannot-rollback-inside-an-XASession-with-AMQ-5-6-tp5730081p5730089.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>


Re: Camel routing issue

2013-04-01 Thread Chris Wolf
Prabu,

There's a note on the Camel website about a potential compiler error
when using "otherwise()", along with a workaround. Unfortunately, I
can't find it now.

On the other hand, I think this might work:

from("direct:start")
.choice().when(header("Type").isNotNull())
.recipientList(simple("activemq.Inbound.${header.Type}"))
.end() // <=== added this to close "when" block
.otherwise()
.to("activemq:queue:Invalid.queue")
.endChoice();

N.B. this only solved compilation - I didn't actually do a runtime test.

-Chris

On Mon, Apr 1, 2013 at 7:18 AM, prabumc...@gmail.com
 wrote:
> Chris,The following code worked fine.
>
> .choice().when(header("Type").isNotNull())
>  .recipientList(simple("activemq.Inbound.${header.Type}"))
> .endChoice()
>
> but,one issue is that.I added *.otherwise()* , it giving error.
>
> .choice().when(header("Type").isNotNull())
>  .recipientList(simple("activemq.Inbound.${header.Type}"))
> *.otherwise()
> .to("activemq:queue:Invalid.queue")*
> .endChoice();
>
> please kindly help me.
>
>
>
> On Mon, Apr 1, 2013 at 2:32 PM, Prabu  wrote:
>
>> Like Chris suggest i tried below way
>>
>>
>>  .when(header("TYPE").isNotNull())
>>.to("activemq:queue.Inbound.${header.Type}")
>>
>>
>> But queue created *${header.Type}* like this not *Inbound.test*
>>
>> Please kindly give me example.
>>
>> *Regards*
>> Prabu.N
>>
>>
>>
>> On Mon, Apr 1, 2013 at 2:03 PM, Claus Ibsen-2 [via Camel] <
>> ml-node+s465427n5730152...@n5.nabble.com> wrote:
>>
>>> Hi
>>>
>>> See this EIP
>>> http://camel.apache.org/content-enricher.html
>>>
>>> About pollEnrich.
>>>
>>> Though pollEnrich currently does support dynamic uris. Its on the
>>> roadmap,
>>> for Camel 3.0.
>>> It requires an API change and thus isn't so easy to implement currently
>>> on
>>> 2.x.
>>>
>>> You can always use a java bean / camel processor, and consume the ftp
>>> file
>>> from java code.
>>> For example using consumer template.
>>>
>>> As you use FTP you may want to set disconnect=true so the connect is not
>>> remained open after usage.
>>>
>>>
>>>
>>> On Sun, Mar 31, 2013 at 7:51 PM, Chris Wolf <[hidden 
>>> email]>
>>> 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-dy

Multiple routes send exchange to direct point

2013-04-01 Thread Darwish
Hi ,

if i have let say route1 ,route2,routn all forward the exchange to same
direct route .

The question  is the exchanges execution will run in-parallel form all
routes in direct route  ( i think/hope so ) or will runt in sequential 

if not  i will used seda point 

any help 



-
Othman Darwish
ProgressSoft Corp.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Multiple-routes-send-exchange-to-direct-point-tp5730163.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple routes send exchange to direct point

2013-04-01 Thread Christian Müller
In parallel.

Sent from a mobile device
Am 01.04.2013 15:43 schrieb "Darwish" :

> Hi ,
>
> if i have let say route1 ,route2,routn all forward the exchange to same
> direct route .
>
> The question  is the exchanges execution will run in-parallel form all
> routes in direct route  ( i think/hope so ) or will runt in sequential
>
> if not  i will used seda point
>
> any help
>
>
>
> -
> Othman Darwish
> ProgressSoft Corp.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Multiple-routes-send-exchange-to-direct-point-tp5730163.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel routing issue

2013-04-01 Thread Chris Wolf
Hi Claus,

Thanks for the response - I could not see any obvious way to configure
an FTP Consumer at ***runtime***,
either via bean, processor or consumer template.  If you have a
concrete example, that would be great to see...

...otherwise, here's the solution I came up with:


-Chris



  // simulate incoming message from JMS...
  from("timer:kickoff?repeatCount=1")
  .to("direct:start");

  // upon receipt of FTP config from JMS, invoke  FtpConfigurer bean
to reconfigure
  // FTP route, then start it...
  from("direct:start")
  .beanRef("configRdr") // config reader bean not shown here
  .convertBodyTo(Document.class)
  // sets a bunch of headers from DOM, e.g.:
  
.setHeader("ftp-config.host").xquery("//remote[remoteId/@value='CBOE34']/server/@value",
String.class)
  .setHeader("ftp-route-id", constant("ftp.route"))
  .beanRef("ftpConfigurer");

  // FTP route will only be started by FtpConfigurer bean after it's
dynamically re-configured...
  from("ftp://bogushost/bogusdir?startScheduler=false";) // the  URI
will be reconfigured...
  .routeId("ftp.route").noAutoStartup()
  .log("Received file ${file:onlyname}")
  .to("file:/tmp/local/data");

  public class FtpConfigurer {
public void configureFtpConsumer(Exchange exchange) throws Exception {
CamelContext context = exchange.getContext();
Map headers = exchange.getIn().getHeaders();
Map parameters = new HashMap();

// Filter headers for ftp-config specific headers...
for (Map.Entry entry : headers.entrySet()) {
String key = entry.getKey();
if (key.startsWith("ftp-config."))
parameters.put(key.substring("ftp-config.".length()),
entry.getValue());
}

String routeId = exchange.getIn().getHeader("ftp-route-id",
String.class);
Route ftpRoute = context.getRoute(routeId);
FtpConsumer c = (FtpConsumer) ftpRoute.getConsumer();
FtpEndpoint rfe = (FtpEndpoint) c.getEndpoint();
FtpConfiguration rfc = rfe.getConfiguration();

// Need to crack open FtpConsumer's "endpointPath" field since
// there's no mutator (setter)
Class cls = c.getClass();
Field endpointPath_fld = cls.getDeclaredField("endpointPath");
endpointPath_fld.setAccessible(true);
endpointPath_fld.set(c, (String)parameters.get("directory"));

// Need to crack open FtpEndpoint, actually DefaultEndpoint -
the ultimate base class
// since there's no mutator (setter) for the "endpointUri" field
cls = rfe.getClass();
Field endpointUri_fld = null;
while (endpointUri_fld == null) {
// TODO: maybe change logic to just stop at class=DefaultEndpoint
// rather then using NoSuchFieldException
try {
endpointUri_fld = cls.getDeclaredField("endpointUri");
} catch (NoSuchFieldException nsfe) {
cls = cls.getSuperclass();
}
}
endpointUri_fld.setAccessible(true);
endpointUri_fld.set(rfe,
String.format("ftp://%s/%s";,
(String)parameters.get("host"), (String)parameters.get("directory")));

// set reference properties first as they use # syntax that
fools the regular properties setter
EndpointHelper.setReferenceProperties(context, rfc, parameters);
EndpointHelper.setProperties(context, rfc, parameters);
EndpointHelper.setReferenceProperties(context, rfe, parameters);
EndpointHelper.setProperties(context, rfe, parameters);
c.setStartScheduler(true);

context.startRoute(routeId);
  }
}

On Mon, Apr 1, 2013 at 4:32 AM, Claus Ibsen  wrote:
> Hi
>
> See this EIP
> http://camel.apache.org/content-enricher.html
>
> About pollEnrich.
>
> Though pollEnrich currently does support dynamic uris. Its on the roadmap,
> for Camel 3.0.
> It requires an API change and thus isn't so easy to implement currently on
> 2.x.
>
> You can always use a java bean / camel processor, and consume the ftp file
> from java code.
> For example using consumer template.
>
> As you use FTP you may want to set disconnect=true so the connect is not
> remained open after usage.
>
>
>
> On Sun, Mar 31, 2013 at 7:51 PM, Chris Wolf  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);
>>
>

Re: Camel routing issue

2013-04-01 Thread prabumc...@gmail.com
Hi *Chris / **Claus*,

I have one *Inbound* queue,based on header and content type,I want forward
to outbound queue.
*
Example 1:
*
*
Inbound.queue name : **Inbound.Test.DDD
Outbound.queue name : SOURHQueueName

*
*Criteria or Condition :
*
Message property *PAST_EVENT_INTERVAL type* is : *0*
  *AND*
Message *Type* value is : *card.test *or* card.expiry.test*

*Example 2:*

*Inbound.queue name : **Inbound.Test.SSS
Outbound.queue name : WESTQueueName
*
*Criteria or Condition :*
Message property *PAST_EVENT_INTERVAL type* is : *0*
 *AND
*
Message *Type *value *start with* :*card.event*

I want achieve this using camel routing java DSL.

Please help me.How can i use AND,OR and regular expression in camel routing

*Regards*
Prabu.N


On Mon, Apr 1, 2013 at 7:43 PM, Chris Wolf [via Camel] <
ml-node+s465427n5730166...@n5.nabble.com> wrote:

> Hi Claus,
>
> Thanks for the response - I could not see any obvious way to configure
> an FTP Consumer at ***runtime***,
> either via bean, processor or consumer template.  If you have a
> concrete example, that would be great to see...
>
> ...otherwise, here's the solution I came up with:
>
>
> -Chris
>
>
>
>   // simulate incoming message from JMS...
>   from("timer:kickoff?repeatCount=1")
>   .to("direct:start");
>
>   // upon receipt of FTP config from JMS, invoke  FtpConfigurer bean
> to reconfigure
>   // FTP route, then start it...
>   from("direct:start")
>   .beanRef("configRdr") // config reader bean not shown here
>   .convertBodyTo(Document.class)
>   // sets a bunch of headers from DOM, e.g.:
>
> .setHeader("ftp-config.host").xquery("//remote[remoteId/@value='CBOE34']/server/@value",
>
> String.class)
>   .setHeader("ftp-route-id", constant("ftp.route"))
>   .beanRef("ftpConfigurer");
>
>   // FTP route will only be started by FtpConfigurer bean after it's
> dynamically re-configured...
>   from("ftp://bogushost/bogusdir?startScheduler=false";) // the  URI
> will be reconfigured...
>   .routeId("ftp.route").noAutoStartup()
>   .log("Received file ${file:onlyname}")
>   .to("file:/tmp/local/data");
>
>   public class FtpConfigurer {
> public void configureFtpConsumer(Exchange exchange) throws Exception {
> CamelContext context = exchange.getContext();
> Map headers = exchange.getIn().getHeaders();
> Map parameters = new HashMap();
>
> // Filter headers for ftp-config specific headers...
> for (Map.Entry entry : headers.entrySet()) {
> String key = entry.getKey();
> if (key.startsWith("ftp-config."))
> parameters.put(key.substring("ftp-config.".length()),
> entry.getValue());
> }
>
> String routeId = exchange.getIn().getHeader("ftp-route-id",
> String.class);
> Route ftpRoute = context.getRoute(routeId);
> FtpConsumer c = (FtpConsumer) ftpRoute.getConsumer();
> FtpEndpoint rfe = (FtpEndpoint) c.getEndpoint();
> FtpConfiguration rfc = rfe.getConfiguration();
>
> // Need to crack open FtpConsumer's "endpointPath" field since
> // there's no mutator (setter)
> Class cls = c.getClass();
> Field endpointPath_fld = cls.getDeclaredField("endpointPath");
> endpointPath_fld.setAccessible(true);
> endpointPath_fld.set(c, (String)parameters.get("directory"));
>
> // Need to crack open FtpEndpoint, actually DefaultEndpoint -
> the ultimate base class
> // since there's no mutator (setter) for the "endpointUri" field
> cls = rfe.getClass();
> Field endpointUri_fld = null;
> while (endpointUri_fld == null) {
> // TODO: maybe change logic to just stop at
> class=DefaultEndpoint
> // rather then using NoSuchFieldException
> try {
> endpointUri_fld = cls.getDeclaredField("endpointUri");
> } catch (NoSuchFieldException nsfe) {
> cls = cls.getSuperclass();
> }
> }
> endpointUri_fld.setAccessible(true);
> endpointUri_fld.set(rfe,
> String.format("ftp://%s/%s";,
> (String)parameters.get("host"), (String)parameters.get("directory")));
>
> // set reference properties first as they use # syntax that
> fools the regular properties setter
> EndpointHelper.setReferenceProperties(context, rfc, parameters);
> EndpointHelper.setProperties(context, rfc, parameters);
> EndpointHelper.setReferenceProperties(context, rfe, parameters);
> EndpointHelper.setProperties(context, rfe, parameters);
> c.setStartScheduler(true);
>
> context.startRoute(routeId);
>   }
> }
>
> On Mon, Apr 1, 2013 at 4:32 AM, Claus Ibsen <[hidden 
> email]>
> wrote:
>
> > Hi
> >
> > See this EIP
> > http://camel.apache.org/content-enricher.html
> >
> > About pollEnrich.
> >
> > Though pollEnrich currently does support dynamic uris. Its on the
> roadmap,
> > for Camel 3.0.

Only one cxf endpoint exposed using non-Spring CXF servlet

2013-04-01 Thread helander
I am using trying too use the non-Spring CXF servlet  (JBoss web container)

@WebServlet(value="/mycxf/*", name="MyCxfServlet")
public class CxfServlet extends CXFNonSpringServlet {
public void init(ServletConfig sc) throws ServletException {
setBus(BusFactory.getDefaultBus());
super.init(sc);
}

}

With the following routes in a DefaultCamelContext

from("cxf:/xyzabc?dataFormat=MESSAGE&serviceClass=DummyService").to("log:input");

from("cxf:/abcxyz?dataFormat=MESSAGE&serviceClass=DummyServiceA").to("log:input");

from("cxf:/123456?dataFormat=MESSAGE&serviceClass=DummyServiceB").to("log:input");

When I access the server at .../mycxf  I get a service list that only
contains one of the three services defined by the routes.

I can append the service address and ?wsdl and get the "WSDL" content
(generated from the serviceClass).

Anyone that have any ideas what the problem could be?

Thanks

Lars

 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Only-one-cxf-endpoint-exposed-using-non-Spring-CXF-servlet-tp5730169.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Ciphers with camel-sftp

2013-04-01 Thread lleclerc
Is my question too vague ? Not related to camel ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Ciphers-with-camel-sftp-tp5730052p5730171.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Content-based routing with Expressions and Predicates

2013-04-01 Thread Chris Wolf
(I took the liberty to change the Subject since the message history has both my
 FTP issue and Prabu's routing issue - my fault, sorry)

Prabu, I strongly recommend getting and reading Claus's book "Camel In Action",
like Thomas Walzer suggested upon your first post.  You also should be
familiar with the concepts on these pages:

http://camel.apache.org/content-based-router.html
http://camel.apache.org/predicate.html
http://camel.apache.org/expression.html
http://camel.apache.org/languages.html
(and this is the page I mentioned before, but couldn't find at the time...)
http://camel.apache.org/why-can-i-not-use-when-or-otherwise-in-a-java-camel-route.html


...but, really, everything you're asking for is answered on this one page:
http://camel.apache.org/predicate.html

...in any case, I think your example 1 & 2 would be
implemented something as follows:

(Be advised, Gmail forces lines wraps around column 72 or so,
 so the code formatting will be mangled)


Don't forget to statically import the predicates you will be using in
compound expressions..

import static org.apache.camel.builder.PredicateBuilder.and;
import static org.apache.camel.builder.PredicateBuilder.or;

Predicate cardEvent = PredicateBuilder.regex(header("Type"), "^card\\.event.*");

from("jms:Inbound.Test.DDD").choice()
  // Your "Example 1"
.when(and(property("PAST_EVENT_INTERVAL").isEqualTo("0"),
or(header("Type").isEqualTo("card.test"),
header("Type").isEqualTo("card.expiry.test")
 ))).to("jms:SOUTHQueueName")
  // Your "Example 2"
.when(and(property("PAST_EVENT_INTERVAL").isEqualTo("0"), cardEvent))
.to("jms:WESTQueueName")
.otherwise().to("jms:dead.letter.queue")
.end();

I also recommend that you not use a header named "Type", since that's
easily confused with
data type or type parameter.  Maybe some like CARD_OP...

Regards,

Chris


On Mon, Apr 1, 2013 at 11:36 AM, prabumc...@gmail.com
 wrote:
>
> Hi *Chris / **Claus*,
>
> I have one *Inbound* queue,based on header and content type,I want forward
> to outbound queue.
> *
> Example 1:
> *
> *
> Inbound.queue name : **Inbound.Test.DDD
> Outbound.queue name : SOURHQueueName
>
> *
> *Criteria or Condition :
> *
> Message property *PAST_EVENT_INTERVAL type* is : *0*
>   *AND*
> Message *Type* value is : *card.test *or* card.expiry.test*
>
> *Example 2:*
>
> *Inbound.queue name : **Inbound.Test.SSS
> Outbound.queue name : WESTQueueName
> *
> *Criteria or Condition :*
> Message property *PAST_EVENT_INTERVAL type* is : *0*
>  *AND
> *
> Message *Type *value *start with* :*card.event*
>
> I want achieve this using camel routing java DSL.
>
> Please help me.How can i use AND,OR and regular expression in camel routing
>
> *Regards*
> Prabu.N
>
> > >> >> 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

Re: Ciphers with camel-sftp

2013-04-01 Thread Christian Müller
Camel use jsch [1] under the hut. May be you can find out more there, what
they support...

[1] http://www.jcraft.com/jsch/

Best,
Christian


On Mon, Apr 1, 2013 at 7:15 PM, lleclerc  wrote:

> Is my question too vague ? Not related to camel ?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Ciphers-with-camel-sftp-tp5730052p5730171.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


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

2013-04-01 Thread Sergey Beryozkin

Hi Raul
On 31/03/13 23:10, Raul Kripalani wrote:

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).



It looks impressive, making it easy to work with multi-parts, among 
other things, would likely help users a lot, major thanks.

Sergey


[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



Re: Camel file component preMove creates directory before read lock acquired?

2013-04-01 Thread icemanltd
This behavior is causing an issue. I have specified
preMove=temp/${exchangeID} with noop=true idempotent=false and
readLock=rename. I was expecting that the lock would first be acquired, then
the file moved to the preMove directory and then processing would begin and
eventually end leaving the file in the preMove directory.

If I ensure the file cannot be renamed (by opening the file in an editor
that holds an exclusive lock on the file), I will get a number of empty
directories being created under the temp directory. Finally when I release
the lock the file will moved to the appropriate directory under temp.

Am I doing something wrong, what is the behavior I should expect?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-file-component-preMove-creates-directory-before-read-lock-acquired-tp5728193p5730176.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Invoking .tokenizeXML from a custom processor

2013-04-01 Thread dkum003

Hi,

I am aware that we can invoke the .tokenizeXML from the route builder. But
is there a way to invoke this through a processor. 

Say i want to split the xml to write it to a set of xml tags. I do not want
to write custom logic using xpath/dom to split this. Instead i would like to
use camel's .tokenizeXML method. 

Could you please guide me on this.

Regards,
Dhananjay



--
View this message in context: 
http://camel.465427.n5.nabble.com/Invoking-tokenizeXML-from-a-custom-processor-tp5730189.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Route starts when deployed with a cxf endpoint

2013-04-01 Thread dkum003

Hi Christian,

Thank you for the project. The auto start up works absolutely fine in this
case because your .to end point is a FTP location. As i said in my post ,
this works fine for FTP,SFTP,File. But when you configure a CXF endpoint as
the .to location, the route starts when deployed.


Regards,
Manish



--
View this message in context: 
http://camel.465427.n5.nabble.com/Route-starts-when-deployed-with-a-cxf-endpoint-tp5729593p5730188.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Multiple routes send exchange to direct point

2013-04-01 Thread Darwish
Thank you 



-
Othman Darwish
ProgressSoft Corp.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Multiple-routes-send-exchange-to-direct-point-tp5730163p5730167.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Invoking .tokenizeXML from a custom processor

2013-04-01 Thread Claus Ibsen
Hi

You can use the Tokenize language

org.apache.camel.language.tokenizer.TokenizeLanguage

It has a number of static methods to easily create the expression.
Then you can use that from a processor.



On Tue, Apr 2, 2013 at 7:29 AM, dkum003  wrote:

>
> Hi,
>
> I am aware that we can invoke the .tokenizeXML from the route builder. But
> is there a way to invoke this through a processor.
>
> Say i want to split the xml to write it to a set of xml tags. I do not want
> to write custom logic using xpath/dom to split this. Instead i would like
> to
> use camel's .tokenizeXML method.
>
> Could you please guide me on this.
>
> Regards,
> Dhananjay
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Invoking-tokenizeXML-from-a-custom-processor-tp5730189.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
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