Re: Dynamic datasource with Camel 2.15.x

2015-10-02 Thread fxthomas
hello, 

You could try with  SimpleRegistry. It worked fine for me ,though never
tried with PropertyPlaceholderDelegateRegistry.

SimpleRegistry reg = new SimpleRegistry();

I load a lot of beans during camel start time using camel context Object
camelContext = new DefaultCamelContext(loadBeans());

never faced any issue yet ?.




--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamic-datasource-with-Camel-2-15-x-tp5772178p5772181.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: custom Registry in CamelTestSupport

2015-10-02 Thread Joakim Bjørnstad
Hello,

To do this, you need to override creation of the CamelContext.

Then you can test with whatever Registry implementation that you want.

public class CustomRegistryTest extends CamelTestSupport {

@Test
public void shouldTest() throws Exception {

}

@Override
protected CamelContext createCamelContext() throws Exception {
return new DefaultCamelContext(createCustomRegistry());
}

private Registry createCustomRegistry() {
return new SimpleRegistry();
}
}

On Wed, Sep 30, 2015 at 7:43 PM, bprager  wrote:
> I am trying to unit test a custom registry.
> The createRegistry() method which I try to override exist only for
> JndiRegistry.
> How do I use a custom registry?
>
> Thank you.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/custom-Registry-in-CamelTestSupport-tp5772135.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Kind regards
Joakim Bjørnstad


Dynamic datasource with Camel 2.15.x

2015-10-02 Thread burner
Hello Together,

i want to create dynamic datasources on runtime. I found some examples to do
this. But this code:

PropertyPlaceholderDelegateRegistry registry =
(PropertyPlaceholderDelegateRegistry) getContext().getRegistry();
JndiRegistry jndiRegistry = (JndiRegistry ) registry.getRegistry();
jndiRegistry.bind("myDS", ds);

don't work in Camel 2.15 anymore. I get a 
java.lang.ClassCastException:
org.apache.camel.spring.spi.ApplicationContextRegistry cannot be cast to
org.apache.camel.impl.JndiRegistry

Have any of you an idea how I can solve it?

I'm in a RouteBuilder:

RouteBuilder builder = new RouteBuilder() {
public void configure() {
CamelContext context = getContext();

// I create the Datasource
String url = "jdbc:PROT://localhost:PORT/NS";
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("com.jdbc.DBDriver");
ds.setUsername("USER");
ds.setPassword("PASS");
ds.setUrl(url);

// Here I must register the DS, but how? This don't work:
PropertyPlaceholderDelegateRegistry registry =
(PropertyPlaceholderDelegateRegistry) getContext().getRegistry();
JndiRegistry jndiRegistry = (JndiRegistry ) 
registry.getRegistry();
jndiRegistry.bind("myDataSource", ds);

// Here I build my route
from("direct:xyz")
.to("jdbc:myDataSource")
}
}

Thank you for help



--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamic-datasource-with-Camel-2-15-x-tp5772178.html
Sent from the Camel - Users mailing list archive at Nabble.com.


The ExchangesInflight number is large number

2015-10-02 Thread yzhang
Hi,

I'm quite new to the camel and trying to support an application in the
company. Unfortunately, there are some issues with the application

I notice the org.apache.camel -> processors -> "something-here" ->
"threads1" -> Attributes tab -> ExchangesInflight: 895

This lasts for quite a while (like a few hours).

In the meantime, I notice the org.apache.camel -> processors ->
"something-here" -> "threads1(threads)" -> Attributes tab -> ActiveCount: 11
and TaskQueueSize: 884

It looks the numbers can add up: 11 + 884 = 895.

Is there anyway to troubleshoot why this takes quite a few hours to process
just a few object on the "threads1", while the counter part "threads2" just
doing fine. The same application is also deployed on some other hosts, and
they all appear to process well - each item just always less than 1 second
to process. I can see the "threads1" in the org.apache.camel -> processors
takes up to 461,707,607 milliseconds to process and 306,632 milliseconds on
average.

How can I narrow down the issue to find the bottleneck? 

Thank you in advance!

yz



--
View this message in context: 
http://camel.465427.n5.nabble.com/The-ExchangesInflight-number-is-large-number-tp5772186.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Dynamic datasource with Camel 2.15.x

2015-10-02 Thread Joakim Bjørnstad
Hello,

First of all, it seems you use Spring with Camel. The
PropertyPlaceholderDelegateRegistry delegates to the Spring
ApplicationContextRegistry and not any JndiRegistry.

Using this, I don't think you can go this route, since the
ApplicationContextRegistry only allows lookup. And it does this in the
Spring ApplicationContext.

Instead, use Spring mechanics. Create a Configuration, register a
Bean. Use external configuration properties through standard Spring
means.

@Configuration
public class InfrastructureConfig {

@Bean
public DataSource dataSource() {
String url = "jdbc:PROT://localhost:PORT/NS";
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("com.jdbc.DBDriver");
ds.setUsername("USER");
ds.setPassword("PASS");
ds.setUrl(url);
return ds;
}
}

To look it up in your route configuration:

ApplicationContextRegistry registry =
getContext().getRegistry(ApplicationContextRegistry.class);
DataSource dataSource = registry.lookup("dataSource", DataSource.class);

Preferrably this is injected into the beans that need a DataSource. Or
configured using the uri of a component by referring to it
?dataSource=#myDataSource


On Fri, Oct 2, 2015 at 11:35 AM, burner
 wrote:
> Hello Together,
>
> i want to create dynamic datasources on runtime. I found some examples to do
> this. But this code:
>
> PropertyPlaceholderDelegateRegistry registry =
> (PropertyPlaceholderDelegateRegistry) getContext().getRegistry();
> JndiRegistry jndiRegistry = (JndiRegistry ) registry.getRegistry();
> jndiRegistry.bind("myDS", ds);
>
> don't work in Camel 2.15 anymore. I get a
> java.lang.ClassCastException:
> org.apache.camel.spring.spi.ApplicationContextRegistry cannot be cast to
> org.apache.camel.impl.JndiRegistry
>
> Have any of you an idea how I can solve it?
>
> I'm in a RouteBuilder:
>
> RouteBuilder builder = new RouteBuilder() {
> public void configure() {
> CamelContext context = getContext();
>
> // I create the Datasource
> String url = "jdbc:PROT://localhost:PORT/NS";
> BasicDataSource ds = new BasicDataSource();
> ds.setDriverClassName("com.jdbc.DBDriver");
> ds.setUsername("USER");
> ds.setPassword("PASS");
> ds.setUrl(url);
>
> // Here I must register the DS, but how? This don't work:
> PropertyPlaceholderDelegateRegistry registry =
> (PropertyPlaceholderDelegateRegistry) getContext().getRegistry();
> JndiRegistry jndiRegistry = (JndiRegistry ) 
> registry.getRegistry();
> jndiRegistry.bind("myDataSource", ds);
>
> // Here I build my route
> from("direct:xyz")
> .to("jdbc:myDataSource")
> }
> }
>
> Thank you for help
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Dynamic-datasource-with-Camel-2-15-x-tp5772178.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Kind regards
Joakim Bjørnstad


Unstable test with camel-test-blueprint

2015-10-02 Thread Arnaud Deprez
Hi folks,

I'm currently testing routes with camel-test-blueprint 2.15.2 and from time
to time my tests fails (it's like 1 faillure for 1 passed).

When it occurs, I got the following message :
16:19:10.556 [Blueprint Extender: 1] INFO  o.a.a.b.c.BlueprintContainerImpl
- Bundle CustomerRestServiceRouteTest is waiting for namespace handlers [
http://camel.apache.org/schema/blueprint]

Then it waits a bit and then I got plenty of warnings :
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper - Test bundle
headers: Bundle-ManifestVersion=2, Bundle-Name=System Bundle,
Bundle-SymbolicName=de.kalpatec.pojosr.framework, Bundle-Vendor=kalpatec,
Bundle-Version=0.2.1
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.osgi.framework.hooks.bundle.EventHook], bundle:
org.apache.aries.blueprint [34], symbolicName: org.apache.aries.blueprint
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.camel.spi.ComponentResolver], bundle:
org.apache.camel.camel-metrics [24], symbolicName:
org.apache.camel.camel-metrics
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle:
org.apache.aries.blueprint [34], symbolicName: org.apache.aries.blueprint
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.camel.spi.LanguageResolver], bundle:
org.apache.camel.camel-core [18], symbolicName: org.apache.camel.camel-core
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.camel.spi.DataFormatResolver], bundle:
org.apache.camel.camel-jackson [30], symbolicName:
org.apache.camel.camel-jackson
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.camel.spi.ComponentResolver], bundle:
org.apache.camel.camel-core [18], symbolicName: org.apache.camel.camel-core
16:19:40.489 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.felix.cm.PersistenceManager], bundle:
org.apache.felix.configadmin [46], symbolicName:
org.apache.felix.configadmin
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference:
[org.osgi.service.blueprint.container.BlueprintContainer], bundle:
org.apache.camel.camel-blueprint [22], symbolicName:
org.apache.camel.camel-blueprint
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.osgi.service.startlevel.StartLevel], bundle:
de.kalpatec.pojosr.framework [0], symbolicName: de.kalpatec.pojosr.framework
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference:
[org.osgi.service.blueprint.container.BlueprintContainer], bundle:
Lampiris-el2-common-query-odata2 [12], symbolicName:
Lampiris-el2-common-query-odata2
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.camel.spi.TypeConverterLoader], bundle:
de.kalpatec.pojosr.framework [0], symbolicName: de.kalpatec.pojosr.framework
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [contactQueryService], bundle:
de.kalpatec.pojosr.framework [0], symbolicName: de.kalpatec.pojosr.framework
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference:
[be.lampiris.pie2.el2.common.query.odata2.encoder.OData2Encoder], bundle:
Lampiris-el2-common-query-odata2 [12], symbolicName:
Lampiris-el2-common-query-odata2
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle:
org.apache.camel.camel-blueprint [22], symbolicName:
org.apache.camel.camel-blueprint
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.camel.spi.DataFormatResolver], bundle:
org.apache.camel.camel-core [18], symbolicName: org.apache.camel.camel-core
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference:
[org.osgi.service.blueprint.container.BlueprintContainer], bundle:
org.apache.aries.blueprint [34], symbolicName: org.apache.aries.blueprint
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.aries.blueprint.services.ParserService],
bundle: org.apache.aries.blueprint [34], symbolicName:
org.apache.aries.blueprint
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.osgi.service.url.URLStreamHandlerService], bundle:
org.apache.felix.fileinstall [47], symbolicName:
org.apache.felix.fileinstall
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle:
org.apache.aries.blueprint [34], symbolicName: org.apache.aries.blueprint
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: [org.osgi.service.cm.ConfigurationAdmin], bundle:
org.apache.felix.configadmin [46], symbolicName:
org.apache.felix.configadmin
16:19:40.490 [main] WARN  o.a.c.t.b.CamelBlueprintHelper -
ServiceReference: 

User stories Wiki entry

2015-10-02 Thread bprager
I wrote a Camel Registry plug-in for the Consul service registry.
It is available on  GitHub   .
If there is any interest I would appreciate you testing it.

I would also use the opportunity to list it on the  Wiki page
   under External Camel
Components.
Unfortunately, I am not permitted to do that.
Does anybody know, who to ask for permission?

Thank you.




--
View this message in context: 
http://camel.465427.n5.nabble.com/User-stories-Wiki-entry-tp5772179.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: curl

2015-10-02 Thread Suganya
Hi Asaf, Claus,

thanks for your replies.

 did not work and i tried few other escape stuffs as well but none seem
to work. 

The only way that i was able to pass the json is by using a temporary file.


--silent --sslv3 --verbose 
--cacert {{cacertFile}} --key
{{keyFile}} --cert {{certFile}} -H Content-Type:application/json -u {{user}}
-X POST {{host}}/tenants -d @/003/temp.json



*In my case, the JSON needs to be framed dynamically. Its not a static json
content. *

*Any idea on how to frame the JSON content dynamically in camel ?*

I have this as the json string --


/response/JSONString


*I get this above JSON string from one of the external components.

how to write this string to the file and rewrite it everytime?*





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


Re: WMQ Reply-to queue

2015-10-02 Thread Greg Autric
Hi

Have you ever try header message ?
you can include some information mapped from camel internal header to component 
protocol header 

more information with :
http://camel.apache.org/how-to-avoid-sending-some-or-all-message-headers.html
http://camel.apache.org/jms.html#JMS-Messageformatwhenreceiving

But 
exchange.getIn().setHeader("JMS_IBM_Report_COA", MQC.MQRO_COA_WITH_FULL_DATA); 
should work w/o pb

best regards,

Greg AUTRIC
JBoss Middleware Consultant

email   : gautric __at__ redhat __dot__ com
twitter : @gautric_io

Red Hat Global Services
Red Hat France SARLsit: http://www.redhat.fr
Le Linea, 1 rue du General Leclerc, 92047 Paris La Défense Cedex
Sent from webmail

- Mail original -
De: "Sashika" 
À: users@camel.apache.org
Envoyé: Vendredi 2 Octobre 2015 06:25:51
Objet: WMQ Reply-to queue

I'm connecting to a Websphere MQ endpoint and I have successfully configured the
camel Jms component to connect to the queue manager and deliver messages to the
intended queue.
The route in question is a request-reply scenario and I want the wmq to reply to
a queue that I specify. This is configured in the Jms component as 
replyToType=Exclusive=MY.QUEUE
All works fine except the reply does not reach camel and the route fails with a
timeout after waiting for a reply. After bit of research I found out that we
need to instruct wmq to generate the report and send to the reply queue. For
this we have to set something like below in the outgoing Jms message but not
sure how to set it in Camel
message.setIntProperty(WMQConstants.JMS_IBM_REPORT_COA,
MQC.MQRO_COA_WITH_FULL_DATA)
Can anyone suggest me how to achieve this in camel level?
Thanks in advance.


Re: User stories Wiki entry

2015-10-02 Thread Claus Ibsen
Hi

I have added a link to the camel-consult project. Thanks for letting
us know about this project

The link is online now
http://camel.apache.org/user-stories.html

On Fri, Oct 2, 2015 at 1:52 PM, bprager  wrote:
> I wrote a Camel Registry plug-in for the Consul service registry.
> It is available on  GitHub   .
> If there is any interest I would appreciate you testing it.
>
> I would also use the opportunity to list it on the  Wiki page
>    under External Camel
> Components.
> Unfortunately, I am not permitted to do that.
> Does anybody know, who to ask for permission?
>
> Thank you.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/User-stories-Wiki-entry-tp5772179.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Re: User stories Wiki entry

2015-10-02 Thread Greg Autric

Hi

you have to sign the Apache Contributor License Agreement before 
and send a email here after and we will grant you R/W wiki access

all informations are available here :
http://camel.apache.org/how-do-i-edit-the-website.html

thx for your contribution,


Greg AUTRIC
JBoss Middleware Consultant

email   : gautric __at__ redhat __dot__ com
twitter : @gautric_io

Red Hat Global Services
Red Hat France SARLsit: http://www.redhat.fr
Le Linea, 1 rue du General Leclerc, 92047 Paris La Défense Cedex
Sent from webmail

- Mail original -
De: "bprager" 
À: users@camel.apache.org
Envoyé: Vendredi 2 Octobre 2015 13:52:17
Objet: User stories Wiki entry

I wrote a Camel Registry plug-in for the Consul service registry.
It is available on  GitHub   .
If there is any interest I would appreciate you testing it.

I would also use the opportunity to list it on the  Wiki page
   under External Camel
Components.
Unfortunately, I am not permitted to do that.
Does anybody know, who to ask for permission?

Thank you.




--
View this message in context: 
http://camel.465427.n5.nabble.com/User-stories-Wiki-entry-tp5772179.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to retain exchange headers through RoutingSlip

2015-10-02 Thread David Hoffer
I'm using a RoutingSlip to route files but all custom headers set on the
Exchange are discarded.  I assume that's because Camel assumes custom
headers are not useful for file messages but I need a way to pass source
information from the RoutingSlip to the file Processors.

How can I do this?  Is there a way I can override the default behavior of
removing all custom headers?

-Dave


Re: User stories Wiki entry

2015-10-02 Thread bprager
Thank you guys!



--
View this message in context: 
http://camel.465427.n5.nabble.com/User-stories-Wiki-entry-tp5772179p5772193.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Apache Camel bean parameter binding issue with Spring DSL

2015-10-02 Thread wheli
I am running into a strange issue with Apache Camel and Spring DSL. Here is
an excerpt of my Spring defined route:


  
  

  
  

  
  

  
  



Everything works fine up until the last line that I posted. The
extractDocumentRootOid(Exchange exchange) java method is executed and the
result is stored to the "documentRootOid" header. The
getOrganizationByOid(Exchange exchange, String oid) java method is executed
and the result is stored to the "organization" header. The
extractStyleSheetAttributeFromOrganization(Exchange exchange, Organization
organization) java method is executed and the result is stored to the
"organizationStyleSheet" header.

Once it gets to the "transformBodyUsingStyleSheet" method, things get weird.
Here is my method declaration:

public void transformBodyUsingStyleSheet(Exchange exchange, String
styleSheet) 

I put a debugger on the first line of the method and the "styleSheet" value
always appears to be the exchange body, NOT the value that I am trying to
pass in (${header.organizationStyleSheet}). If I look at the headers through
a debugger, I see my "organizationStyleSheet" header and the value that I
expect, so I am guessing that there is an issue with my bean parameter
bindings? Has anyone else ran into this before?

Thanks for any help you can provide.

P.S. I tried replacing "*" with "${exchange}" but got a number of errors
saying "org.apache.camel.ExpressionEvaluationException: Cannot
create/evaluate simple expression: ${exchange} to be bound to parameter at
index: 0 on method"



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: curl

2015-10-02 Thread Suganya
I tried below,

testingsimple>


but getting the below error stating 

 caught: org.apache.camel.language.bean.RuntimeBeanExpressionException:
Failed to invoke method: .stdout on null due to:
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
invoke method: stdout on null due to:
org.apache.camel.component.bean.MethodNotFoundException: Method with name:
stdout not found on bean: testing of type: java.lang.String.
Exchange[Message: testing]:
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
invoke method: .stdout on null due to:
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
invoke method: stdout on null due to:
org.apache.camel.component.bean.MethodNotFoundException: Method with name:
stdout not found on bean: testing of type: java.lang.String.
Exchange[Message: testing]

Please help me out. I tried many other stuffs as well but none seem to work.



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


Re: Cannot write null body to file - using ftp component

2015-10-02 Thread dfgcamel
Thanks for the response Claus.

I've tried the allowNullBody option but it still doesn't work.  I'm
wondering if it could be that in my scenario, I branch and use the
.to("file.. instead a .from("file...  I say this because  I had this
partially working before without the branching and I used .from("file..
directly after the .process( section.  is there a way to achieve a branch
that still allows me to use the .from("file.. syntax?

Thanks,

Dennis...



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-using-ftp-component-tp5772164p5772192.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Apache Camel bean parameter binding issue with Spring DSL

2015-10-02 Thread Claus Ibsen
Can you should the method signature for those methods. Also if they
are void or return a value. And what version of Camel do you use?

On Fri, Oct 2, 2015 at 10:18 PM, wheli  wrote:
> I am running into a strange issue with Apache Camel and Spring DSL. Here is
> an excerpt of my Spring defined route:
>
> 
>   
>   
>  method="extractDocumentRootOid"/>
>   
>   
>  method="getOrganizationByOid(*,${header.documentRootOid})"/>
>   
>   
>  method="extractStyleSheetAttributeFromOrganization(*,${header.organization})"/>
>   
>method="transformBodyUsingStyleSheet(*,${header.organizationStyleSheet}"/>
> 
> 
>
> Everything works fine up until the last line that I posted. The
> extractDocumentRootOid(Exchange exchange) java method is executed and the
> result is stored to the "documentRootOid" header. The
> getOrganizationByOid(Exchange exchange, String oid) java method is executed
> and the result is stored to the "organization" header. The
> extractStyleSheetAttributeFromOrganization(Exchange exchange, Organization
> organization) java method is executed and the result is stored to the
> "organizationStyleSheet" header.
>
> Once it gets to the "transformBodyUsingStyleSheet" method, things get weird.
> Here is my method declaration:
>
> public void transformBodyUsingStyleSheet(Exchange exchange, String
> styleSheet)
>
> I put a debugger on the first line of the method and the "styleSheet" value
> always appears to be the exchange body, NOT the value that I am trying to
> pass in (${header.organizationStyleSheet}). If I look at the headers through
> a debugger, I see my "organizationStyleSheet" header and the value that I
> expect, so I am guessing that there is an issue with my bean parameter
> bindings? Has anyone else ran into this before?
>
> Thanks for any help you can provide.
>
> P.S. I tried replacing "*" with "${exchange}" but got a number of errors
> saying "org.apache.camel.ExpressionEvaluationException: Cannot
> create/evaluate simple expression: ${exchange} to be bound to parameter at
> index: 0 on method"
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Apache-Camel-bean-parameter-binding-issue-with-Spring-DSL-tp5772200.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Re: Incorrect string replacement order in Camel SNMP?

2015-10-02 Thread Claus Ibsen
Hi

Thanks for spotting. You are welcome to log a JIRA and work on a PR or patch.
http://camel.apache.org/contributing

On Sat, Oct 3, 2015 at 3:06 AM, Dmitry Zolotukhin  wrote:
> Hi,
>
> In Camel SNMP, the org.apache.camel.component.snmp.SnmpConverters
> class has a static “getXmlSafeString” method which escapes unsafe
> characters by replacing them. However, the order of applying
> replacements is not correct:
>
> private static String getXmlSafeString(String string) {
>
> return string.replaceAll("<", "").replaceAll(">",
> "").replaceAll("&", "").replaceAll("\"",
> "").replaceAll("'", "");
>
> }
>
>
> It replaces “<” with “” at first, then the “&” is replaced with
> “”. This means that a “<” character in the input string will be
> changed to “”, and then into “lt;”, which is not the intended
> behavior.
>
> This could be fixed by applying the “replaceAll("&", "")”
> transformation first.
>
> --
> Best regards,
> Dmitry



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition


Incorrect string replacement order in Camel SNMP?

2015-10-02 Thread Dmitry Zolotukhin
Hi,

In Camel SNMP, the org.apache.camel.component.snmp.SnmpConverters
class has a static “getXmlSafeString” method which escapes unsafe
characters by replacing them. However, the order of applying
replacements is not correct:

private static String getXmlSafeString(String string) {

return string.replaceAll("<", "").replaceAll(">",
"").replaceAll("&", "").replaceAll("\"",
"").replaceAll("'", "");

}


It replaces “<” with “” at first, then the “&” is replaced with
“”. This means that a “<” character in the input string will be
changed to “”, and then into “lt;”, which is not the intended
behavior.

This could be fixed by applying the “replaceAll("&", "")”
transformation first.

--
Best regards,
Dmitry