Camel REST DSL - using provided SSL port in karaf
Hello All, In my karaf instances, I have many bundles deployed and I use pax-jetty to provide SSL using this configuration in etc/org.ops4j.pax.web.cfg: org.osgi.service.http.enabled=false org.osgi.service.http.secure.enabled=true org.ops4j.pax.web.ssl.keystore=mykeystore.jks org.ops4j.pax.web.ssl.keypassword=password org.ops4j.pax.web.ssl.password=password org.osgi.service.http.port.secure=8443 I want to expose a REST service using the Camel REST DSL. I am able to expose a REST endpoint using a different port, however, I would like to re-use this existing port as I only want one inbound SSL port to my server. Is this possible? I can get this configuration to work, but it will provide its own port instead of re-using the one that I provide through karaf. Any ideas? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-REST-DSL-using-provided-SSL-port-in-karaf-tp5795607.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Camel Log - Karaf
Hi Shuston, I can do log:set DEBUG but then I log everything. I have a file endpoint that I poll from and that generates too much logging for it to be useful. Is there a way to isolate it to the route or context level? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Log-Karaf-tp5789034p5789046.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel Log - Karaf
Hello All, I have a log statement in a camel route that is at the DEBUG loggingLevel: >From the karaf console, how can I set the logging level for the camel context? I know that I can run a karaf command like this to set the logging level for a java package: log:set DEBUG org.packagename.here However, I am not sure what to use for the package name for a camel route or camel context. Any ideas on how I can change the logging level for a camel route? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Log-Karaf-tp5789034.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel 2.14.4 and CXF 3.0.6
Hello All, I am currently using Camel 2.14.4 for all of our deployments. It uses CXF version 3.0.5. CXF 3.0.6 has a very nice feature in it which allows support for legacy SSL connections: https://issues.apache.org/jira/browse/CXF-6414 With this feature, you can upgrade one server at a time from Java 6 to Java 8. Otherwise if you upgrade a server, all your web service SSL clients in java6 will be broken since SSLv2Hello is not allowed in CXF 3.0.5. Of course the straight forward solution is to use Camel 2.15.x or even one of the newer versions. However, there are some conflicts with Spring dropping OSGi support and this would require a migration to blueprint which is not possible for our team right now. Is it possible to use Camel 2.14.x in karaf with CXF 3.0.6? Does anyone have any pointers on how to do this? Or will there be a maintenance release on Camel 2.14.x that will do a minor version upgrade on CXF? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-2-14-4-and-CXF-3-0-6-tp5775249.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel 2.14.4 and CXF 3.0.6
Thanks Claus, I ran these commands: feature:repo-add cxf 3.0.6 feature:install cxf feature:repo-add camel 2.14.4 feature:install camel It looks like CXF 3.0.6 is active although cxf 3.0.5 features are present when I run feature:list | grep cxf in karaf 3.0.5. I will do some further testing but this should get us where we need to be. Thanks! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-2-14-4-and-CXF-3-0-6-tp5775249p5775252.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Soap Body is Empty or Partial XML
Thanks Aki, My first step in the Camel Route is to convert the body to a string. I was able to work around it by turning off streaming and since I need to modify the payload, I don't need streaming in this use case. Is it possible that the default for Streaming in older versions of Camel like 2.10.7 was false? That would explain the anamolies when we upgraded to Camel 2.14.x Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364p5774840.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Soap Body is Empty or Partial XML
Hello All, I added the parameter: allowStreaming=false to the CXF endpoints that were causing an issue and then they started to work normally. It definitely seems like a bug because I would send consecutive schema valid messages and one would fail with the WoodStox exception and the other would not. Disabling streaming works but I believe there is a bug with the stream being sent from CXF to Camel. Maybe it could be related to this JIRA issue: https://issues.apache.org/jira/browse/CAMEL-8663 In my use case, I need to modify the payload and extract elements from it so it needs to be converted to a DOM anyway. Hopefully this helps the next person who sees this issue. However, does anyone know how to set the allowStreaming property globally for all CXF endpoints? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364p5774624.html Sent from the Camel - Users mailing list archive at Nabble.com.
Soap Body is Empty or Partial XML
Hello All, I am using Camel 2.14.4 and deploy to Apache Karaf 3.0.5 with Java 8. I have a web service that I am exposing over HTTP and it worked fine in Camel 2.10.7. When I hit the service now, it returns a WoodStox error when trying to convertBodyTo a String or Document: Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting a close tag for element at [row,col {unknown-source}]: [53,88] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:685) at com.ctc.wstx.sr.BasicStreamReader.throwUnexpectedEOF(BasicStreamReader.java:5519) at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2722) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1073) I have turned on CXFLogging on the endpoint and I see the entire message. I opened in an XML editor and it is schema valid and well formed. I tried different streamcache options on the route and context but those didn't make a difference. I have debugged into the DefaultCxfBinding. I find some interesting results here. When it calls the method to get the payload body elements, the soap body is empty: else if (dataFormat == DataFormat.PAYLOAD) { List headers = CastUtils.cast((List)message.get(Header.HEADER_LIST)); MapnsMap = new HashMap (); *answer = new CxfPayload(headers, getPayloadBodyElements(message, nsMap), nsMap);* } I confirm that in getPayloadBodyElements: protected static List getPayloadBodyElements(Message message, Map nsMap) { // take the namespace attribute from soap envelop Document soapEnv = (Document) message.getContent(Node.class); The soapEnv document is only the soap envelope, complete header, and empty body: http://schemas.xmlsoap.org/soap/envelope/;> http://www.w3.org/2005/08/addressing;>Submit-Entity-Merge http://www.w3.org/2005/08/addressing;>580417e4-8590-4c2a-8715-b5ac100d9e74 http://www.w3.org/2005/08/addressing;>http://localhost:18002/NIJ/EntityResolutionService http://www.w3.org/2005/08/addressing;> http://localhost:18003/OJB/MergeNotificationService/PersonSearchRequestServiceIntermediary Does anyone have any idea why the Soap Body is empty here? And why I am getting a woodstox parsing error? The simplest solution is that the payload is wrong when calling the service. However, the CXF logging interceptors confirm that the Soap message is complete and that the body is schema valid. Any ideas? Thanks! Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Am I using headers right?
That sounds sensible to me. The headers are for message and exchange metadata. Just be careful to not send them over the wire when you call an external component. -- View this message in context: http://camel.465427.n5.nabble.com/Am-I-using-headers-right-tp5774363p5774365.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel route - autostartup - no endpoint found
Hello All, I have a route with autoStartup set to 'false'. However, Camel will still try to resolve the endpoint in the 'from' URI on the route. For example: camel:route id=myRoute autoStartup=false from uri=myCXFServiceEndpoint/ However, I don't have 'myCXFServiceEndpoint' defined because the Spring profile that I am using does not define that bean. There is a JIRA right now to not pre-warm/start the route: https://issues.apache.org/jira/browse/CAMEL-5695 which is discussed in this thread: http://camel.465427.n5.nabble.com/autoStartup-and-Endpoints-td5718204.html I was thinking that I could use the route policy that is referenced in this thread, however, the exception is thrown before I can get at the route. For example, overriding this method doesn't have any effect: @Override public void onInit(Route route) { LOG.info(Route Init for + route.getId()); } Is there any technique that I can use to tell Camel that when I set autoStartup to 'false' that I don't want it to try to resolve the 'from' endpoint? I can't think of any tricks offhand and am not able to do so with a route policy. I do have CamelContext autostartup to false and am manually only starting the routes that I will be using. Any help is most appreciated! Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-route-autostartup-no-endpoint-found-tp5764230.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel route - autostartup - no endpoint found
I tried injecting a Camel Context into the Route Policy, but it looks like the route isn't yet created so it can't be deleted: @Override protected void doStart() throws Exception { LOG.info(In custom do start); boolean removed = camelContext.removeRoute(myServiceRoute); LOG.info(Removed route + removed); } Any other ideas? Is it possible to conditionally import a route context based on a Spring profile? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-route-autostartup-no-endpoint-found-tp5764230p5764231.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel Route autostartup with Spring Profiles
Hello All, I am looking to dynamically start up routes based on Spring profiles properties. I am aware that you can control this via a boolean on the route and you can define a property to make it dynamic. route autoStartup=false I have a scenario where I would like to allow the implementer to choose which beans to dynamically start through a config file and I am already have the user specify Spring Profiles like this: environment.setDefaultProfiles(profilesActivatedFromPropertiesFile); Where the variable profilesActivatedFromPropertiesFile can be for example: ServiceA, ServiceB. I would prefer to not have to have additional configuration like this: autostartRouteServiceA=true autostartRouteServiceB=true autostartRouteServiceC=false This way the user activates beans using profiles and route startup using properties. Is there a way to bridge these concepts together and autostart a route based on a Spring profile? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Route-autostartup-with-Spring-Profiles-tp5764047.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Multicast Position and Exchange Properties
Thanks Claus, This is exactly what I am looking for. I will try to update the Multicast WIKI so it shows these Exchange properties like it does on the Splitter WIKI page. -Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Multicast-Position-and-Exchange-Properties-tp5763768p5764044.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Route autostartup with Spring Profiles
Hello All, I decided to set all routes autostart to false and then implement an ApplicationListener: @Component public class MyListener implements ApplicationListenerContextRefreshedEvent { @Autowired(required=false) private CamelContext camelContext; @Override public void onApplicationEvent(ContextRefreshedEvent event) { This gets a camel context wired into it and you can get the Spring profiles: event.getApplicationContext().getEnvironment().getActiveProfiles() From there you can selectively start routes as you like. Thanks! Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Route-autostartup-with-Spring-Profiles-tp5764047p5764062.html Sent from the Camel - Users mailing list archive at Nabble.com.
Multicast Position and Exchange Properties
Hello All, I am multicasting and need to alter the document before I send it to different endpoints. To do this, I use onPrepareRef=myProcessor. The issue that I am running into is that the copy of the Exchange that I get does not have much info other than a copy of the exchange. It would be helpful to have properties analogous to the splitter like: CamelSplitIndex CamelSplitSize CamelSplitComplete This is especially helpful for the recipient list. You do get the Exchange.TO_ENDPOINT. Other than that, you just get a copy of the original Exchange without any context. I think it would be useful to have extra properties on the exchange similar to the Split pattern. Does this make sense? Thanks! Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Multicast-Position-and-Exchange-Properties-tp5763768.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Exposing request/response Web Service that would interact with legacy system
Have you look into the Camel Aggregator pattern? http://camel.apache.org/aggregator.html If you have any mechanism in the request/response message to correlate a request to a response, you can set up the aggregator to collect your response from a separate route and match the request/response using something in the message or a header. You can also set it up to timeout as well. I use this pattern to aggregate asynchronous web services with timeouts. -- View this message in context: http://camel.465427.n5.nabble.com/Exposing-request-response-Web-Service-that-would-interact-with-legacy-system-tp5762229p5762391.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CamelDestinationOverrideUrl documentation
Hi Willem, Sorry to revive this old thread but it looks like this is supported in Camel CXF in addition to camel-cxfrs component. Would it be worthwhile to update the Camel CXF wiki page with this info? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/CamelDestinationOverrideUrl-documentation-tp5716369p5762368.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Problem with multiple CXF services using the same https port
Hi Christian, Can you provide an example of how to set this up? The situation I have is this, which I think is the exact same as you describe. I have a central broker server on it with many different bundles: bundle A bundle B bundle C Each bundle hosts a web service with a distinct WSDL and schema. Rather than host each bundle on a different port which creates a firewall nightmare, we want to set up a single port and host all service on it. I updated my pax config file like this: org.osgi.service.http.secure.enabled=true org.ops4j.pax.web.ssl.keystore=etc/my-keystore.jks org.ops4j.pax.web.ssl.password=my-keystore org.ops4j.pax.web.ssl.keypassword=my-key org.osgi.service.http.port.secure=8443 org.ops4j.pax.web.config.file=etc/jetty.xml org.osgi.service.http.port=8181 javax.servlet.context.tempdir=data/pax-web-jsp I installed the 'http' feature in ServiceMix and can see this page in a browser served up by Jetty: https://localhost:8443/ In my camel bundle, I set up a CXF endpoint with a URL like this: https://localhost:8443/MyService However, I can not start up my service in a simple Camel Context in a unit test and I get an error like this: java.lang.IllegalStateException: Port 8443 is configured with wrong protocol http for https://localhost:8443/MyService; My understanding is that I should set up my CXF endpoint as usual and then remove the embedded Jetty instance. That way the bundle doesn't attempt to start a standalone instance of Jetty. Originally in standalone mode i used a bean like this: httpj:engine-factory id=MyHttpsSettings bus=cxf Any ideas of how I can set up multiple bundles in the same SMX instance that use different WSDLs / schemas on the same port? Thanks! Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5762264.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Change property in unit test
Hi, I gave this a try but since I am using the plain spring configuration rather than extending a class with Camel Spring Support there isn't a method to override. My class signature looks like this: @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration(locations={ classpath:META-INF/spring/camel-context.xml}) public class MyClass { Any ideas? Thanks, Yogesh On Tue, Oct 28, 2014 at 2:39 AM, Charles Moulliard-2 [via Camel] ml-node+s465427n5758199...@n5.nabble.com wrote: Hi, Have you overrided the method as described in the doc of apache camel ( http://camel.apache.org/properties.html) ? @Override protected Properties useOverridePropertiesWithPropertiesComponent() { Properties extra = new Properties(); extra.put(destination, mock:extra); extra.put(greeting, Bye); return extra; } Regards, On Mon, Oct 27, 2014 at 3:40 PM, ychawla [hidden email] http://user/SendEmail.jtp?type=nodenode=5758199i=0 wrote: Hi Claus, I am using plain spring testing and annotating my custom class like this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class MyCamelTest { I don't think I am able to use useOverridePropertiesWithPropertiesComponent in this scenario. Is there a similar technique I can use with this testing methodology? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Change-property-in-unit-test-tp5758017p5758098.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io -- If you reply to this email, your message will be added to the discussion below: http://camel.465427.n5.nabble.com/Change-property-in-unit-test-tp5758017p5758199.html To unsubscribe from Change property in unit test, click here http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5758017code=cHJlbWllcmdlbmVyYXRpb25AZ21haWwuY29tfDU3NTgwMTd8MjQwNzY1OTI3 . NAML http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://camel.465427.n5.nabble.com/Change-property-in-unit-test-tp5758017p5758236.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Mail CC and BCC headers
Thanks Willem, Looks great. -Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943p5758097.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Change property in unit test
Hi Claus, I am using plain spring testing and annotating my custom class like this: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class MyCamelTest { I don't think I am able to use useOverridePropertiesWithPropertiesComponent in this scenario. Is there a similar technique I can use with this testing methodology? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Change-property-in-unit-test-tp5758017p5758098.html Sent from the Camel - Users mailing list archive at Nabble.com.
Change property in unit test
Hello All, I have a unit test and I want to change a camel property. I am only a single version of the configuration file to test against so I would like to change the property in code. For example, I thought I could do something like this: context.getProperties().put(myProperty, false); However, that didn't do it. I see that I can resolve a property like this: context.resolvePropertyPlaceholders(property); However it doesn't look like I can change its value. Is there a way to dynamically change a property in a Camel Context unit test? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Change-property-in-unit-test-tp5758017.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel Mail CC and BCC headers
Hello All, I recently had a production issue where there was an exception thrown when the CC or the BCC headers were set to : com.sun.mail.smtp.SMTPAddressFailedException: 554 5.1.1 Invalid recipient address Is this the expected behavior in Camel or would it be possible for camel to check for a blank string and not attempt to set these headers when sending the email. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Getting entire Soap Message with header and body in Payload mode
Hi Guys, Thanks for the help. I found a CXF interceptor online based off of the logging interceptor that gets the message: public SoapMessageInterceptor () { super(Phase.RECEIVE); } @Override public void handleMessage ( SoapMessage message ) throws Fault { String entireSoapMessage = ; try { // now get the request xml InputStream is = message.getContent ( InputStream.class ); CachedOutputStream os = new CachedOutputStream ( ); IOUtils.copy ( is, os ); os.flush ( ); message.setContent ( InputStream.class, os.getInputStream ( ) ); is.close ( ); entireSoapMessage = IOUtils.toString ( os.getInputStream ( )); log.debug (The request is: + entireSoapMessage); os.close ( ); } catch ( Exception ex ) { ex.printStackTrace ( ); } message.getExchange().put(entireSoapMessage, entireSoapMessage); } Then in your camel route, you can get that header where we stuffed the entire soap message as follows: Message cxfMessage = exchange.getIn().getHeader(CxfConstants.CAMEL_CXF_MESSAGE, Message.class); String entireSoapMessage = (String)cxfMessage.get(entireSoapMessage); and then add the interceptor to your CXF bean: cxf:inInterceptors ref bean=soapMessageInterceptor/ /cxf:inInterceptors Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Getting-entire-Soap-Message-with-header-and-body-in-Payload-mode-tp5753162p5753732.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Concurrent problem with message Body using WireTap
Thanks Guys, The detailed solution that Stanislaw outlined worked perfectly. In ServiceMix, you will need to install the following libraries: install -s mvn:uk.com.robust-it/cloning install -s mvn:org.objenesis/objenesis/1.4 Thanks for the assistance! -- View this message in context: http://camel.465427.n5.nabble.com/Concurrent-problem-with-message-Body-using-WireTap-tp5502505p5753648.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: ws-security
Can you try to create a new exchange or use the out exchange when calling the proxied service? In my code, I have a special processor which copies a few headers to the out exchange and then calls it. This will remove all the exchange headers from the original exchange and remove a lot of the Camel headers which cause problems downstream. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/ws-security-tp5753430p5753649.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Concurrent problem with message Body using WireTap
Hi Guys, Any hints on writing a processor that will do a deep clone? I am running into the same issue. I have a CXF Payload on my Exchange. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Concurrent-problem-with-message-Body-using-WireTap-tp5502505p5753471.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Concurrent problem with message Body using WireTap
Hi Guys, Any hints on writing a processor that will do a deep clone? I am running into the same issue. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Concurrent-problem-with-message-Body-using-WireTap-tp5502505p5753470.html Sent from the Camel - Users mailing list archive at Nabble.com.
Getting entire Soap Message with header and body in Payload mode
Hello All, We use payload mode to process our CXF messages. It is very convenient and will properly process the Soap Headers, SAML assertions, WS-Security headers etc. I have a requirements to get the entire raw Soap message in my camel route and call a processor with it. There are other ways to do this, but the requirement explicitly states that the raw soap message is required. How can I get the entire raw soap message in Payload mode? I guess I could reconstruct it manually by looping through the soap headers and re-creating the DOM but is there another way to get at it? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Getting-entire-Soap-Message-with-header-and-body-in-Payload-mode-tp5753162.html Sent from the Camel - Users mailing list archive at Nabble.com.
Intercept - Log Message EIP for testing
Hello All, I am writing a Camel Context test and I want to intercept a logging endpoint to verify that a message is being logged. Here is a snippet from my route: camel:choice camel:when camel:method bean=accessControlProcessor method=authorize / camel:log message=access control returned true/ /camel:when camel:otherwise camel:log message=access control returned false/ /camel:otherwise /camel:choice I want to intercept this log: camel:log message=access control returned true/ I tried this but couldn't get it to work: context.getRouteDefinition(myRoute).adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { interceptSendToEndpoint(log*).to(mock:accessControlLog); } }); However, my 'mock:accessControlLog' does not receive any messages. I know I can call a 'direct' endpoint and then intercept that direct endpoint, but I would prefer not to do that. Is there any way to intercept or mock the log message instead? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Intercept-Log-Message-EIP-for-testing-tp5752513.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel Filter Bean when return value is false
Hello All, I have a bean that will return a boolean of true or false. When the value is false, I want to go in a camel filter. Filter looks for 'true', like below: camel:filter camel:method bean=accessControlProcessor method=authorize / camel:log message=access control returned true/ /camel:filter However, when this method returns false, I want to do something specific like camel:filter camel:method bean=accessControlProcessor method=authorize / camel:log message=Not authorized/ camel:stop/ /camel:filter I now I can set a header in my authorize method and run a camel choice on that header. However, is there a way to do this using the simple language or the content based router? I would rather not disrupt the processor with camel specific code. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Filter-Bean-when-return-value-is-false-tp5752457.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Filter Bean when return value is false
I can do this: camel:choice camel:when camel:method bean=accessControlProcessor method=authorize / camel:log message=access control returned true/ /camel:when camel:otherwise camel:log message=access control returned false/ /camel:otherwise /camel:choice Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Filter-Bean-when-return-value-is-false-tp5752457p5752458.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel Validation Relative Paths
Hello All, I see that an issue was reported validating XML documents with relative paths: https://issues.apache.org/jira/browse/CAMEL-6572 Judging by the schema that was attempting to be imported, it looks like a NIEM document. I am seeing the same issue using SMX 4.5.2 / Camel 2.10.6. I was wondering if this issue was backported to the Camel 2.10.x branch? I see a similar issue here that was backported but I it looks like although they are similar, there might be some nuances between them: https://issues.apache.org/jira/browse/CAMEL-5321 Any help would be appreciated. Thanks! Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Validation-Relative-Paths-tp5748475.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF consumer endpoint + XSLT + Tracer = EmptyStackException
Hi, You can also try to convert your body to a string prior to calling your XSLT. This worked for me when I had this issue: camel:convertBodyTo type=java.lang.String/ Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/CXF-consumer-endpoint-XSLT-Tracer-EmptyStackException-tp5741942p5743127.html Sent from the Camel - Users mailing list archive at Nabble.com.
Xpath parameter binding NodeList vs. Node
Hello All, I am using Camel Xpath parameter binding. I have a method that has an expression like this for example: public void process(Exchange exchange, @OJBCamelXPath(/foo:Container) NodeList containerNodeList) throws Exception I know that the Xpath will only return a single node, however, I need to bind to the parameter NodeList or else I get this exception: camel No type converter available to convert from type: org.apache.xml.dtm.ref.DTMNodeList to the required type: org.w3c.dom.Node I saw this Camel issue that was resolved: https://issues.apache.org/jira/browse/CAMEL-5403 This suggests that there is a type converter to go from a NodeList of size 1 to a Node. I am using Camel 2.10.3 so I should have this typeconverter. Is this typeconverter used with parameter binding or only in the Xpath in the DSL? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Xpath-parameter-binding-NodeList-vs-Node-tp5738067.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Xpath parameter binding NodeList vs. Node
Hi Raul, Thanks for you reply. The query returns exactly one node. To retrieve the node, I do something like this: Node containerNode = containerNodeList.item(0); The OJBCamelXpath annotation is a class like this: @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @LanguageAnnotation(language = xpath, factory = XPathAnnotationExpressionFactory.class) public @interface OJBCamelXpath { String value(); // You can add the namespaces as the default value of the annotation NamespacePrefix[] namespaces() default { @NamespacePrefix(prefix = foo, uri = http://someNamespace/1.0;) }; Class? resultType() default NodeList.class; } It allows you to do an Xpath bean parameter binding. It allows for Xpath injection as described on this page: http://camel.apache.org/xpath.html Thanks! Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Xpath-parameter-binding-NodeList-vs-Node-tp5738067p5738072.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Inject camel resources into Spring bean
Hello, To solve this issue, you can access the CXF message like this: Message message = PhaseInterceptorChain.getCurrentMessage(); Camel will copy Camel headers to CXF headers. You can set your 'key' to your map as a Camel Header and then grab it off the CXF message. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Inject-camel-resources-into-Spring-bean-tp5724524p5724572.html Sent from the Camel - Users mailing list archive at Nabble.com.
Inject camel resources into Spring bean
Hello All, I am working on a WS-Policy implementation that requires a SAML token to be passed in the security header. CXF provides a SAML callback handler to support adding the token. I am using an STS so I call a web service to obtain the token. I obtain the token and set it in a header: camel:setHeader headerName=token camel:xpath resultType=org.w3c.dom.Element//saml2:Assertion/camel:xpath /camel:setHeader I now want to obtain the token in my callback handler: entry key=ws-security.saml-callback-handler value-ref=mySamlCallbackHandler/ @Override public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i callbacks.length; i++) { if (callbacks[i] instanceof SAMLCallback) { SAMLCallback callback = (SAMLCallback) callbacks[i]; Element assertionElement; //I WANT TO GET THE ASSERTION HERE FROM A CAMEL HEADER OR OTHER MECHANISM callback.setAssertionElement(assertionElement); } } } Does anyone know how I can access the Camel header 'token' inside of my callback? I have tried injecting a bean into the callback handler that would read a hashmap to obtain the token, however, I have no messageID or other mechanism to use as the 'key' to the hashmap. I also injected a CamelContext thinking I could use that in some fashion. Any ideas on what I can do here? I want to use the CXF framework and not use a manual interceptor to somehow inject the token into the Soap header. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Inject-camel-resources-into-Spring-bean-tp5724524.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: Debugging Live Camel Routes
Hi Guys, The ServiceMix wiki also has a page on this. It says basically what Graham said : http://servicemix.apache.org/remote-debugging-servicemix-in-eclipse.html Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Debugging-Live-Camel-Routes-tp5718181p5718216.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XMLSecurity key recovery fails when keystore and key use different passwords
Hi Dominik, I think this is the default behavior in Java. Whenever I work with keystores, the keystore password must match the key password. This could be due to the KeyManagerFactory implementation: http://docs.oracle.com/javase/6/docs/api/javax/net/ssl/KeyManagerFactory.html#init%28java.security.KeyStore,%20char[]%29 It only allows for a single password. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/XMLSecurity-key-recovery-fails-when-keystore-and-key-use-different-passwords-tp5718094p5718217.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JsonEndpoint and Router
Hi Marco, I have had a similar situation. I grab the JSON input, unmarshall to a POJO, inspect the payload for a parameter, and then set a camel header for routing. I have also had cases where I could route directly based of information in the HTTP Headers. Handling this by setting a header based on the input message seems like a good approach. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/JsonEndpoint-and-Router-tp5717969p5717972.html Sent from the Camel - Users mailing list archive at Nabble.com.
JSON - Jackson return list rather than POJO
Hello All, I am unmarshalling data using Jackson. My dataFormats bean is set up as such: dataFormats json id=personSearchJacksonID library=Jackson unmarshalTypeName=model.PersonSearchResponse/ /dataFormats However, my return value isn't a simple POJO, it is a list of POJO's. For example this is a sample stripped down JSON response: [{last_name:xxx,,first_name:Heather},{last_name:xxx,first_name:Leah}] It returns a list of PersonSearchResponses rather than just a single PersonSearchResponse. In a JUnit test, I did this: ListPersonSearchResponse personSearchResponses = mapper.readValue(inputFile, new TypeReferenceListlt;PersonSearchResponse() { }); Is there an equivalent that I can do in the Spring DSL? Worse comes worse, I write a custom bean and pass the JSON response as the body and manually do 'mapper.readValue' and then process the list. I am on Camel 2.8.4 so I am not using camel-xmljson and converting my POJO to XML manually. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/JSON-Jackson-return-list-rather-than-POJO-tp5717341.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using Simple header notation to define where to send a message
Hello, You can also try using a recipient list and only have a single recipient on it. It can function as a dynamic router when you dynamically set a header. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Using-Simple-header-notation-to-define-where-to-send-a-message-tp5717318p5717343.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: exposing different operations under same service in camel + cxf routing.
Hi, Have you tried turning on the tracer to see what headers are on your exchange? A simple filter such as this should work: camel:filter camel:simple${in.headers.operationName} == 'SearchRequest'/camel:simple camel:log message=Search Request has been invoked/ /camel:filter Try looking at all the headers on your exchange and make sure the operationName exists. The framework should provide that header to you. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/exposing-different-operations-under-same-service-in-camel-cxf-routing-tp5716944p5717346.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JSON - Jackson return list rather than POJO
A simple workaround for this is a custom bean processor like so: public void processPersonSearchResponseJSON(Exchange exchange) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); ListPersonSearchResponse personSearchResponses = mapper.readValue(exchange.getIn().getBody(String.class), new TypeReferenceListlt;PersonSearchResponse() { }); exchange.getIn().setBody(personSearchResponses); } and in the camel context: camel:to uri=JSONEndpoint/ camel:convertBodyTo type=java.lang.String/ camel:log message=This is the JSON Response: ${body} / camel:to uri=bean:personSearchResponseJSONProcessor?method=processPersonSearchResponseJSON/ -- View this message in context: http://camel.465427.n5.nabble.com/JSON-Jackson-return-list-rather-than-POJO-tp5717341p5717347.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: problem in aggregation
Hi, Can you add some debug statements to your aggregator: newIn.setBody(oldBody + newBody); For example, what is oldBody and what is newBody? Based on the error you are receiving, you might be concatenating two XML documents like this: document1/ document2/ This will not create a valid XML document because there will be two top level elements. You might try something like: newIn.setBody(wrapper + oldBody + newBody + /wrapper); Then you can strip the wrapper off in an XSLT or processor and combine the two docs as they should be. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/problem-in-aggregation-tp5717293p5717348.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: way to convert multiple csv files to single xml file
Hi Matheen, Can you explain your problem a little more? Are all the files going to be available at the same time? Do you know how many files you need to aggregate? For example, in pseudo code: route from uri=file://TEST?fileName=order.csvnoop=true/ do all your bindy processing here but send to aggregator rather than 'file' set your correlation header to uri=direct:aggregateXML/ /route route from uri=direct:aggregateXML/ aggregate groupExchanges=true eagerCheckCompletion=true correlationExpression camel:headersomeheader/camel:header /correlationExpression completionTimeout camel:simple10/camel:simple /completionTimeout completionSize headersomeCompletionSizeHeader/header /completionSize write some bean to wrap all your exchange response bodies in the enclosing XML tag to uri=bean:combineExchangeResponses/ to uri=file://TESTOUT?fileName=orderLine.xml/ /aggregate /route You can correlate your CSV files you are processing by setting a common header among them to the same value. You can either complete processing by size or by a timeout. Once you aggregate, you will have a grouped exchange. You can have some a simple bean to iterate through your exchanges and then wrap them in the enclosing XML before writing ot the file system. This is all pseudo code and would have to be improved. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/way-to-convert-multiple-csv-files-to-single-xml-file-tp5717048p5717099.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: way to convert multiple csv files to single xml file
Here is an example method to aggregate: @SuppressWarnings(unchecked) public void aggregateGroupMessages(Exchange groupedExchange) { ListExchange grouped = groupedExchange.getProperty(Exchange.GROUPED_EXCHANGE, List.class); for (Exchange exchange : grouped) { //process exchanges here } groupedExchange.getOut.setBody(myAggregatedResult); } -- View this message in context: http://camel.465427.n5.nabble.com/way-to-convert-multiple-csv-files-to-single-xml-file-tp5717048p5717100.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: routing mail with camel on fuse esb
Hi Mathieu, Not sure why you are getting an unknownhostexception. Can you telnet to the URL: telnet smtp.gmail.com 587 Also, I think port 587 on gmail is running on TLS. Maybe you need to use smtps? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/routing-mail-with-camel-on-fuse-esb-tp5716754p5716765.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
I have something like this working in a unit test. Maybe you can try something similar: public static final String CXF_OPERATION_NAME = operation; public static final String CXF_OPERATION_NAMESPACE = http://opNamespace;; @Test @DirtiesContext public void myTest() throws Exception { String pathToFileForExchangeBody=src/test/resources/xmlInstances/mypayload.xml; Exchange senderExchange = createCXFExchange(pathToFileForExchangeBody); //Send the one-way exchange. Using template.send will send a one way message Exchange returnExchange = template.send(cxf:bean:mybean?dataFormat=PAYLOADloggingFeatureEnabled=truesynchronous=true, senderExchange); //Use getException to see if we received an exception if (returnExchange.getException() != null) { throw new Exception(returnExchange.getException()); } } private Exchange createCXFExchange(String pathToFileForExchangeBody) { //Create a new exchange Exchange senderExchange = new DefaultExchange(context); //Set the operation name and operation namespace for the CXF exchange senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, CXF_OPERATION_NAME); senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, CXF_OPERATION_NAMESPACE); //Read the icotns request file from the file system, this one has no endpoint to route to File inputFile = new File(pathToFileForExchangeBody); assertTrue(inputFile.exists()); log.debug(Does input file exist: + inputFile.exists()); //Set it as the message message body senderExchange.getIn().setBody(inputFile); return senderExchange; } -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716569.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Spring testing framework
Hi Sri, The Camel in Action book has great resources on testing. There is also a good WIKI page for Camel testing: http://camel.apache.org/testing.html Also check on the 'adviceWith' page. It has some great testing strategies: http://camel.apache.org/advicewith.html Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Spring-testing-framework-tp5716333p5716358.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Parallel processing using apache camel
Hi Nafees, Have you looked into using SEDA component? You can send from your file path to the SEDA component and set up your concurrency there: http://camel.apache.org/seda.html There is another Camel post that discussed how to do this: http://camel.465427.n5.nabble.com/Ability-to-process-multiple-files-file-endpoint-simultaneously-in-a-single-Application-td470713.html Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Parallel-processing-using-apache-camel-tp5716329p5716359.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to invoke CXF webservice from processor bean
Hi, I see that you set the operationName but did you set the operationNamespace. For example: senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, http://yourOperationNamespace;); Try setting that and see if you get the same results. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/How-to-invoke-CXF-webservice-from-processor-bean-tp5716272p5716360.html Sent from the Camel - Users mailing list archive at Nabble.com.
CamelDestinationOverrideUrl documentation
Hello All, There is a header that can be set called: CamelDestinationOverrideUrl. This is really cool because you can have a single CXF endpoint and set this header to set to different endpoints that implement this interface. For example, you can have 10 endpoints you send to that use the same WSDL and with a single CXF bean you can set this header in a route dynamically to send to any of them. I don't see this feature documented on the WIKI CXF page but it is on the CXFRS page. Can I update the CXF WIKI page with this documentation? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/CamelDestinationOverrideUrl-documentation-tp5716369.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel keeps dropping ActiveMQ connections
Hello All, I have an application running that has frequent lulls in activity. What I find is that the activemq consumers lose their connections. I have a read few posts about this and taken the suggestions to set keepAlive to true and use a connection pool: [1] keep alives http://camel.465427.n5.nabble.com/Camel-ActiveMQ-queue-listener-consumer-drops-after-inactivity-td3299709.html [2] pooled connection factory http://camel.465427.n5.nabble.com/Does-activemq-jms-component-have-keepalive-option-tc4282121.html#a4283140 Here are my activemq beans: bean id=jmsConnectionFactory class=org.apache.activemq.ActiveMQConnectionFactory property name=brokerURL value=tcp://0.0.0.0:61616?keepAlive=true / /bean bean id=pooledConnectionFactory class=org.apache.activemq.pool.PooledConnectionFactory property name=maxConnections value=8 / property name=maximumActive value=500 / property name=connectionFactory ref=jmsConnectionFactory / /bean bean id=jmsConfig class=org.apache.camel.component.jms.JmsConfiguration property name=connectionFactory ref=pooledConnectionFactory/ property name=transacted value=false/ property name=concurrentConsumers value=10/ /bean bean id=activemq class=org.apache.activemq.camel.component.ActiveMQComponent property name=configuration ref=jmsConfig/ /bean I am using Camel 2.2 and ActiveMQ 5.2. To confirm that the listeners stop, I go to the admin page and see no consumers: http://localhost:8161/admin/queues.jsp Any ideas? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-keeps-dropping-ActiveMQ-connections-tp5716255.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dynamic generation of Camel routes
Would a routing slip work for you? You can dynamically configure where your message is going, not necessarily what your input is. However, depending on your requirements, this could suffice: http://camel.apache.org/routing-slip.html -- View this message in context: http://camel.465427.n5.nabble.com/Dynamic-generation-of-Camel-routes-tp5716223p5716225.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cxf and HTTP BASIC authentication
Hi Christian, What about adding an HTTP Conduit to your CXF bean? http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html Is your requirement for inbound or outbound HTTP basic auth? Depending on your container, you might be able to do this at the Apache HTTPD or Tomcat layer as well. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716169.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cxf and HTTP BASIC authentication
Just re-read your message and you have a ServiceMix requirement so Tomcat and Apache HTTPD wouldn't work. I saw some blog entries that talks about an interceptor based approach that might help: http://chrisdail.com/2008/03/31/apache-cxf-with-http-basic-authentication/ http://chrisdail.com/2008/08/13/http-basic-authentication-with-apache-cxf-revisited/ Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/camel-cxf-and-HTTP-BASIC-authentication-tp5716163p5716173.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel CXF synchronous=true setting causes CXF bean invocation last for 60 seconds or more
Hi Igor, I am not sure what version of Camel and CXF that FUSE version uses. When using the 'synchronous=true' URI option in Camel 2.6.0, I wrote an interceptor to rethrow the exception so it would propogate back to my route. Something simple like: public class CamelExceptionInterceptor extends AbstractPhaseInterceptorMessage { public CamelExceptionInterceptor() { super(Phase.SETUP); } @Override public void handleFault(Message message) { Exception exception = message.getContent(Exception.class); throw new Fault(exception); } @Override public void handleMessage(Message message) throws Fault { } } Otherwise, I think my client was hanging as well. This is not an issue in later versions of Camel. On camel 2.8.x and higher, I took this interceptor out and this synchronous flag worked without it. Maybe this will help you out Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-synchronous-true-setting-causes-CXF-bean-invocation-last-for-60-seconds-or-more-tp5716160p5716178.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Best Practice for splitting on header?
Hi, Do you need to use a bean/producer template to do this? Some of this might be built right in to the Recipient List EIP. For example, in Spring: recipientList delimiter=| parallelProcessing=true strategyRef=aggregateResponses headerendpointsToCall/header /recipientList In the above snippet, you set a header with your endpoints, a delimiter of '|' and a strategy to aggregate all your responses (if you need to). This also give you the advantage of being able to call your endpoint in parallel to speed up your POST (if your requirements allow you to do so). In my test case, I needed to invoke a REST service so I used the HTTP Jetty component to do the POST. I used the recipient list because I was calling the service multiple times . My aggregator was simple as well: @Override public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { log.debug(Entering message aggregator); log.debug(Class of new exchange: + newExchange.getIn().getBody().getClass()); StringBuffer sb = new StringBuffer(); //If we have information in the old exchange, append the old and new exchange together //Another processor will put a thin wrapper around them if (oldExchange != null) { String oldMessage = oldExchange.getIn().getBody(String.class); //Remove the XML declaration if it exists because we are combining into a single message oldMessage = StringUtils.remove(oldMessage, ?xml version=\1.0\ encoding=\UTF-8\?); sb.append(oldMessage); } String newMessage = newExchange.getIn().getBody(String.class); newMessage = StringUtils.remove(newMessage, ?xml version=\1.0\ encoding=\UTF-8\?); sb.append(newMessage); newExchange.getIn().setBody(sb.toString()); return newExchange; } After that, I had a simple bean processor that wrapped the XML messages in a thin wrapper: public void wrapExchangeBody(Exchange exchange) { log.debug(Entering wrap exchange body); StringBuffer sb = new StringBuffer(); String aggregatedMessage = exchange.getIn().getBody(String.class); sb.append(Wrapper); sb.append(aggregatedMessage); sb.append(/Wrapper); exchange.getIn().setBody(sb.toString()); } After that I had all the rest responses wrapped and ran them through an XSLT to make the desired response message I needed. Would something like this help? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Best-Practice-for-splitting-on-header-tp5713433p5713571.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: xslt error with document('')
Hi Marco, Are you using the same XSLT processors in eclipse and in Camel? I like using Saxon and you can customize your XSLT processor like this: bean id=sFactory class=net.sf.saxon.TransformerFactoryImpl / camel:to uri=xslt:my.xsl?transformerFactory=sFactory/ Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/xslt-error-with-document-tp5713535p5713572.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Converting CSV to XML
Hi Amby, What about using a simple XSLT to go from the outputted format to your desired format? It should be a pretty straight forward transformation. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Converting-CSV-to-XML-tp5711086p5711598.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Converting CSV to XML
Hi Christian, You are correct that you can use XSLT on CSV, but he can get the data into this format: list java.util.Arrays_-ArrayList stringName/string stringAge/string stringSex/string stringZip/string /java.util.Arrays_-ArrayList java.util.Arrays_-ArrayList stringEdward/string string 22/string stringM/string string33639/string /java.util.Arrays_-ArrayList .. /List He can use an XSLT to go from that to this: List data NameEdward/Name Age22/Age SexM/Sex Zip33639/Zip /data data /data /List Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Converting-CSV-to-XML-tp5711086p5711610.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how to specify remote file name when using FTP endpoint
Hi, Did you try setting the camel file name header: camel:setHeader headerName=CamelFileName camel:simplesomeNewFileName.txt/camel:simple /camel:setHeader Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/how-to-specify-remote-file-name-when-using-FTP-endpoint-tp5697227p5698676.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Waiting for Routes to Finish
Hi, Camel offers some graceful shutdown functionality out of the box: http://camel.apache.org/graceful-shutdown.html Take a look and see if this fits your needs. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Waiting-for-Routes-to-Finish-tp5695837p5696383.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: dynamically creating directory with current date in yyyyMMdd format
Hi Mahesh, You can try setting your file name with the dynamic format: camel:setHeader headerName=CamelFileName camel:simple${date:now:MMdd}/someFileName.xml/camel:simple /camel:setHeader This will create a folder with the dynamic date and then put 'someFileName.xml' inside of it. This should work in the Java DSL as well. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/dynamically-creating-directory-with-current-date-in-MMdd-format-tp5670997p5696406.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF webservice asyn
Hi Deepthi, Claus has a blog post about concurrency that might point you in the right direction. Do you want a thread pool for your 'from' file endpoint? http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-concurrency-with.html Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/CXF-webservice-asyn-tp5695918p5696420.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: multicast and setting header
Hi Tyler, Are some of the headers in there but not all of them? If you want, you can use an aggregator with the multicast and set a custom aggregation strategy: http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/AggregationStrategy.html This way you can process each exchange in the multicast, grab your headers, and see them on the new exchange. See the multicast page for more details on a custom aggregator: http://camel.apache.org/multicast.html Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/multicast-and-setting-header-tp5691098p5692642.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Integration Testing Best Practices...
Hi James, I am working through the exact same issue as you are now. One thing that has been really worthwhile to look into is 'adviceWith': http://camel.apache.org/advicewith.html You can weave around particular endpoints and either replace the endpoint or intercept the messages in and out of them. Have you also been using any Continous Integration tools? If so, any tips you have would be great. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Integration-Testing-Best-Practices-tp5691310p5692651.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: If camel-jetty/camel-http can dynamically load keystore/trustsore changes
Hi Leng, The keystore/truststore updates should be infrequent, right? Do you have a production environment with load balancing/failover? If so, you can take one server out of commission and perform maintenance and then update the other server. Otherwise, you probably have to do it in a maintenance window. The other thing to look at if you control both client and server is having the client use a dead letter error handler to attempt retries after a connection failure. This way if the server is down, you can retry the request after a certain interval. -Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/If-camel-jetty-camel-http-can-dynamically-load-keystore-trustsore-changes-tp5684697p5685999.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-jaxb namespace prefix
Hi Thomas, You can use JaxB NameSpacePrefixMapper to customize what the namespaces look like. Basically it would take ns2 and set it to something more intuitive of your choosing. See here for details: http://stackoverflow.com/questions/1982977/is-it-possible-to-customize-the-namespace-prefix-that-jaxb-uses-when-marshalling Here is another example: http://blog.bdoughan.com/2011/11/jaxb-and-namespace-prefixes.html Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/camel-jaxb-namespace-prefix-tp5685354p5686544.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dynamic source endpoint
Hi, I would look into using a routing slip here as well. Depending on how dynamic your endpoints are you can poll the database using a timer, retrieve your endpoints, havw a bean processor that creates a routing slip header, and then send the exchange to the routing slip. This could work if you know what your endpoints are ahead of time but only need to send to a subset of them based on your database query. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Dynamic-source-endpoint-tp5682267p5686553.html Sent from the Camel - Users mailing list archive at Nabble.com.
Producer Template to Invoke HTTP Endpoint Request/Reply
Hello All, I have set up a simple HTTP service using Jetty that acts similar to a REST endpoint and servers up XML responses. The service works just fine and I am trying to add some unit tests to it. I have set up a simple producer template test and tried this: File inputFile = new File(someFile.xml); String returnValue = template.requestBody(http://localhost:8081/REST;, inputFile, String.class); log.debug(value: + returnValue + END); However, I get no return value. I have also tried to return an object and I get back : org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream If I try to cast this, I get this issue: org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream cannot be cast to org.apache.camel.converter.stream.CachedOutputStream I also tried setting the stream caching to true: context.setStreamCaching(true); but that has no affect. I know the service is getting invoked and is returning a proper return value. I just can't get at it with the producer template. Any idea how I can use the producer template to do a request/reply against an HTTP endpoint and get the response as a string, file, or other useable format? From what I understand, I need to use template.request. This would be easy enough to do in a Camel Route with a convertBodyTo java.lang.String, however I am writing a unit test so I just want to use the producer template. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Producer-Template-to-Invoke-HTTP-Endpoint-Request-Reply-tp5684220.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Producer Template to Invoke HTTP Endpoint Request/Reply
So I also tried with an exchange/processor and no luck: Exchange result = template.request(http://localhost:8081/REST;, new Processor() { public void process(Exchange exchange) { Message in = exchange.getIn(); in.setBody(inputFile); exchange.setPattern(ExchangePattern.InOut); } }); log.debug(value : + result.getOut().getBody(String.class) + END + result.getException()); I would expect this to give me the result as a string: result.getOut().getBody(String.class), but it is null. Any ideas? -- View this message in context: http://camel.465427.n5.nabble.com/Producer-Template-to-Invoke-HTTP-Endpoint-Request-Reply-tp5684220p5684682.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Producer Template to Invoke HTTP Endpoint Request/Reply
Hello All, Sorry for the bother. Please ignore this issue. I was setting the body of my response on my rest service as a buffered reader. This worked fined in the SMX container but was causing an issue in my unit test. I read a string from the buffered reader and set that as my service response and all is fine. The methods outlined above both work. Cheers, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Producer-Template-to-Invoke-HTTP-Endpoint-Request-Reply-tp5684220p5684796.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Problem with Camel,osgi-compendium and mvn camel:run
Hi Dinesh, You will see a similar error if you try to run Camel JUnit tests and are using OSGi for your properties file. To make this slightly less painful, you can put your PropertyPlaceHolder in its own file. For example, this file can be called properties-context.xml beans xmlns=http://www.springframework.org/schema/beans; ... osgix:cm-properties id=cfg-properties persistent-id=cfg.id/ ctx:property-placeholder properties-ref=cfg-properties/ /beans Then import this file in your camel-context.xml: import resource=properties-context.xml/ Then under src/test/resources/META-INF/spring add a different properties-context.xml: beans xmlns=http://www.springframework.org/schema/beans; ... ctx:property-placeholder location=file:///${conf.home}/my.cfg/ /beans This way you can set this up once and then write J-Unit tests without having to change anything. This doesn't help for camel:run. For this you can either set up ServiceMix debugging: http://www.ithoughts.de/servicemix-4-2-debugging-and-more-gotchas Or you can just comment out the OSGi properties and replace it with the spring file placeholder :-) -Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Camel-osgi-compendium-and-mvn-camel-run-tp4598536p5681080.html Sent from the Camel - Users mailing list archive at Nabble.com.
Retrieve Endpoint in Recipient List OnPrepareRef
Hello All, Consider a simple recipient list: camel:recipientList delimiter=, parallelProcessing=false onPrepareRef=prepareMessage camel:headerRecipientListHeader/camel:header /camel:recipientList The Recipient List header has the contents: endpoint1, endpoint2 The endpoints are defined as: endpoint id=endpoint1 uri=direct:a/ endpoint id=endpoint2 uri=direct:b/ In my 'prepareMessage' processor, I want to access the endpoint that I am calling. This is because I want to enrich this endpoint dynamically with headers for example operationName and operationNamespace. In the exchange properties, I can see 'direct:a' but not 'endpoint1'. Is there a way I can access the endpoint name rather than the endpoint URI in the OnPrepareRef processor? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Retrieve-Endpoint-in-Recipient-List-OnPrepareRef-tp5649956p5649956.html Sent from the Camel - Users mailing list archive at Nabble.com.
Recipient List Error Handler
Hello All, I have a simple recipient list in Camel 2.8.4: camel:route errorHandlerRef=deadLetterErrorHandler camel:setHeader headerName=routingSlipHeader camel:simplecxf:bean:someEndpoint?dataFormat=PAYLOADamp;amp;synchronous=true/camel:simple /camel:setHeader camel:recipientList inheritErrorHandler=true camel:headerroutingSlipHeader/camel:header /camel:recipientList /camel:route I have my dead letter error handler set up with a redelivery policy. However, the recipient list does not attempt redelivery on failure. I get a message like this: Message exchange has failed: so breaking out of pipeline for exchange However, the message appears to be only attempted once. I bumped up the redeliveryDelay to about a minute and waited to see if we would try to redeliver but it didn't. Any ideas on how to get the recipient list to use a redelivery policy? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Recipient-List-Error-Handler-tp5607371p5607371.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Recipient List Error Handler
Please ignore this question. The error was with the bindingOperationInfo so it was fatal to the point where it wasn't a delivery issue. Once I fixed that, the redelivery policy works fine. Thanks! Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Recipient-List-Error-Handler-tp5607371p5607411.html Sent from the Camel - Users mailing list archive at Nabble.com.
Dynamically set WSS4J interceptor properties
Hello All, I am using Camel/CXF to implement WS-Security Requirements, specifically in this case Signature Encrypt and Timestamp. I used an example that Camel distributed as a starting point and manually configured the WSS4J interceptors. My issue is that my service will call maybe 10 or 20 services. I don't want to configure one Interceptor per service I am calling because the only thing that is different is the encryptionUser. This is the alias of the public key you are using to encrypt the message. Here is the WSS4J interceptor: bean id=wss4jOutInterceptor class=org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor constructor-arg map entry key=action value=Signature Encrypt Timestamp / entry key=user value=client-key / entry key=encryptionUser value=server-1-cert / entry key=passwordCallbackRef ref bean=passwordCallbackBean / /entry entry key=signatureKeyIdentifier value=DirectReference / entry key=signatureParts value={Element}{http://schemas.xmlsoap.org/soap/envelope/}Body; / entry key=passwordType value=PasswordDigest / /map /constructor-arg /bean Notice that encryptionUser would have to be different for all requests. I don't want to recreate this bean multiple times. I did figure out a workaround for the properties files for WSS4J. I use a bean to set the request context and inject the values: bean id=cryptoPropertiesMessageProcessor class=org.myPackage.CryptoPropertiesMessageProcessor property name=cryptoProvider value=org.apache.ws.security.components.crypto.Merlin/ property name=keystoreType value=jks/ property name=signingKeystore value=client.jks/ property name=signingKeystorePassword value=password/ property name=signingKeystoreAlias value=client-key/ property name=encryptionKeystore value=serverTrustore.ts/ property name=encryptionKeystorePassword value=password/ property name=encryptionKeystoreAlias map entry key=endpoint1 value=server-1-cert / entry key=endpoint2 value=server-2-cert / /map /property /bean I set the key to the map as a Camel Header that I set in the route and then I can retrieve the alias. See this simple bean: public void addCryptoProperties(Exchange exchange) throws Exception { MapString, Object requestContext = new HashMapString, Object(); Properties cryptoPropertiesSignature = new Properties(); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.provider,cryptoProvider); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.keystore.password, signingKeystorePassword); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.file,signingKeystore); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.keystore.type, keystoreType); cryptoPropertiesSignature.put(org.apache.ws.security.crypto.merlin.keystore.alias, signingKeystoreAlias); requestContext.put(cryptoPropertiesSignature, cryptoPropertiesSignature); /** IMPORTANT, the below configuration will only work with WSS4J 1.6, you need to use 'SignaturePropRefId' for 1.5 **/ requestContext.put(signaturePropRefId,cryptoPropertiesSignature); Properties cryptoPropertiesEncryption = new Properties(); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.provider,cryptoProvider); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.keystore.password, encryptionKeystorePassword); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.file,encryptionKeystore); cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.keystore.type, keystoreType); String encryptionAliasEndpoint = (String)exchange.getIn().getHeader(endpointEncryptionAlias); String encryptionAlias = null; if (StringUtils.isNotBlank(encryptionAliasEndpoint)) { encryptionAlias = encryptionKeystoreAlias.get(encryptionAliasEndpoint); } else { throw new Exception(Camel Header endpointEncryptionAlias is not set); } cryptoPropertiesEncryption.put(org.apache.ws.security.crypto.merlin.keystore.alias, encryptionAlias); requestContext.put(cryptoPropertiesEncryption,
Re: Dynamically set WSS4J interceptor properties
Another idea here is to set the scope to 'request' on the WSS4J interceptor and override a method to set the encryption user. Has anyone done that before similar to this: http://forum.springsource.org/showthread.php?81311-Configuring-WSS4J-Encrypt-for-multiple-clients-how Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Dynamically-set-WSS4J-interceptor-properties-tp5551391p5551678.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Propogate CXF Exception to Camel
Hi Aki, I do have a one-way service. I added the 'synchronous=true' to the endpoint and now it is throwing the error without using my custom interceptor. Will setting this attribute affect other behavior of the one-way service? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5544347.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SMTP: sending file binary as attachment corrupted
Hello, I remember I had some issues attaching files so I added a processor that read them directly from the file system. For example: public void addEmailAttachment(Exchange ex) { String fileNameWritten = (String)ex.getIn().getHeader(CamelFileNameProduced); ex.getIn().addAttachment(filename.zip, new DataHandler(new FileDataSource(fileNameWritten))); } The Camel Header: CamelFileNameProduced is the actual path to the file on the file system. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/SMTP-sending-file-binary-as-attachment-corrupted-tp5543701p5544370.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Need help in Camel to send emails
Hi, The body of the email will be whatever you have as the current body of the Camel exchange. You can explicitly set the body as well: camel:setBodyconstantThis is my email body/constant/camel:setBody To control when the email is sent, you can split up your route: route from uri=smtp://${col_username}@${col_host}.com:${port}?password=${col_password}amp;filter=#errorBillingResponseEmailing/ to uri=file:someFolder/ /route Then you can use quartz to set up a timer to poll your folder: http://camel.465427.n5.nabble.com/Consuming-Files-using-Timer-Quartz-td3320330.html If you don't have complex requirements for when it is sent, the file URI syntax could be sufficient. You can tell Camel to delete all emails it consumes by configuration. Once you do this, you can BCC your mailbox and apply an email rule to put a copy of the email sent in the 'sent' folder. Cheers, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Need-help-in-Camel-to-send-emails-tp5541960p5542072.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Need help in Camel to send emails
Hi, Are you trying to set the 'to' field in your email. You can either set that on the smtp URI or in a header. For example: setHeader headerName=toconstantrecipi...@domain.com/constant/setHeader The body of your email is whatever is on your message body. If you want to set it as part of your route, try using a bean: to uri=bean:createEmailBodyBean?method=createEmailBody/ public String createEmailBody() { return Some email body string here; } Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Need-help-in-Camel-to-send-emails-tp5541960p5542525.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: http client cert verification
On your client, you can add a HTTP conduit: http:conduit name=*.http-conduit http:tlsClientParameters disableCNCheck=true sec:keyManagers keyPassword=password sec:keyStore type=JKS password=password file=my.jks / /sec:keyManagers sec:trustManagers sec:keyStore type=JKS password=password file=truststore.ts / /sec:trustManagers sec:cipherSuitesFilter sec:include.*_EXPORT_.*/sec:include sec:include.*_EXPORT1024_.*/sec:include sec:include.*_WITH_DES_.*/sec:include sec:include.*_WITH_NULL_.*/sec:include sec:exclude.*_DH_anon_.*/sec:exclude /sec:cipherSuitesFilter /http:tlsClientParameters http:client AutoRedirect=true Connection=Keep-Alive / /http:conduit On the server, you can set it up to require client auth: http:destination name={http://namespace}My-Service.http-destination/ httpj:engine-factory bus=cxf httpj:engine port=18052 httpj:tlsServerParameters sec:keyManagers keyPassword=password sec:keyStore type=JKS password=password file=keystore.jks/ /sec:keyManagers sec:trustManagers sec:keyStore type=JKS password=password file=truststore.ts/ /sec:trustManagers sec:cipherSuitesFilter sec:include.*_EXPORT_.*/sec:include sec:include.*_EXPORT1024_.*/sec:include sec:include.*_WITH_DES_.*/sec:include sec:include.*_WITH_NULL_.*/sec:include sec:exclude.*_DH_anon_.*/sec:exclude /sec:cipherSuitesFilter sec:clientAuthentication want=true required=true/ /httpj:tlsServerParameters /httpj:engine /httpj:engine-factory Check here for CXF configuration: http://cxf.apache.org/docs/jetty-configuration.html Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/http-client-cert-verification-tp5542079p5542552.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Does Camel supports dynamic routing by getting the routing info from database
The other way you can do this is by using the Recipient List pattern: http://camel.apache.org/recipient-list.html You can query your database, have a bean where you setup a recipient list Header, and then call the recipient list. -- View this message in context: http://camel.465427.n5.nabble.com/Does-Camel-supports-dynamic-routing-by-getting-the-routing-info-from-database-tp5537354p5538071.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: CXF endpoint's address dynamically modified?
Hello All, I think this would be a great feature to have available with a cxf bean URI configuration. Consider the use case where Camel is acting as an intermediary broker/facade for other services. The broker and the services it fronts all share the same WSDL and service definition. The only difference is the address. Currently, you can use the URI format of: cxf://someAddress[?options] However, then you have have to manually configure CXF features using the CXF bus. However, if you could have a URI interface like below, you can configure your CXF features and interceptors on the bean: cxf:myCXFBean?address=${in.headers.addressToSendTo} This header can be set dynamically and only one CXF bean would be need to act as a client for multiple services. For now, I will set up one cxf bean per address that I am sending to. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/CXF-endpoint-s-address-dynamically-modified-tp3349431p5539094.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel Properties Component Cache
Hello All, The Camel Properties component is very cool, however there are a few enhancements which would make it even better. First off the 'Cache' property is very nice. If Cache is set to false, then you can change your properties file and Camel will pick up the changes. The default on this is true and you can't update it under the CamelContext: camelContext ... propertyPlaceholder id=properties location=com/mycompany/myprop.properties/ /camelContext You can however update it by manually configuring the Spring Bean: bean id=properties class=org.apache.camel.component.properties.PropertiesComponent property name=location value=file:endpoint.properties/ property name=cache value=false/ /bean When doing this configuration on the Spring bean, it won't let you use the properties in the simple language: log message=${properties:cheese.quote}/ It would be great if 'cache' would be an attribute on 'propertyPlaceholder'. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Properties-Component-Cache-tp5539115p5539115.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Propogate CXF Exception to Camel
Hi Willem, I upgraded to Camel 2.8.4 and CXF 2.4.6 and I still see this behavior. Here is my route. It basically reads from a folder and calls a web service: endpoint id=foobarWebserviceEndpoint uri=cxf:bean:foobarRelocationService?dataFormat=PAYLOADamp;loggingFeatureEnabled=true / camel:route id=foobarRelocationHandlerConnector errorHandlerRef=foobarRelocationDeadLetterErrorHandler camel:from uri=foobarRelocationInputDir / camel:log message=Received file for foobar Relocations: ${file:name} / camel:setHeader headerName=operationName constantopName/constant /camel:setHeader camel:setHeader headerName=operationNamespace constanthttp://www.namespace.com//constant /camel:setHeader camel:to uri=foobarWebserviceEndpoint / camel:log message=Called foobar intermediary / /camel:route /camel:camelContext bean id=foobarRelocationDeadLetterErrorHandler class=org.apache.camel.builder.DeadLetterChannelBuilder property name=deadLetterUri value=foobarRelocationDeadLetterDir / property name=redeliveryPolicy ref=foobarRelocationRedeliveryPolicyConfig / /bean bean id=foobarRelocationRedeliveryPolicyConfig class=org.apache.camel.processor.RedeliveryPolicy property name=maximumRedeliveries value=3 / property name=redeliveryDelay value=5000 / /bean I get a connection refused error when I shut down the server: [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.interceptor.BareOutInterceptor@4320d68d [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor@5538615e [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.ws.addressing.soap.MAPCodec@465e34ce [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.interceptor.StaxOutInterceptor@5123ac44 [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.interceptor.AttachmentOutInterceptor@674a93a6 [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.interceptor.LoggingOutInterceptor@491f03e4 [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.interceptor.MessageSenderInterceptor@1338933d [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor@20e5e569 [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor@7d02cdf9 [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.ws.addressing.MAPAggregator@5c04e904 [rna/relocation/connector/input] PhaseInterceptorChain DEBUG Invoking handleFault on interceptor org.apache.cxf.ws.policy.PolicyOutInterceptor@7f1ef3e7 [rna/relocation/connector/input] PhaseInterceptorChain WARN Interceptor for {http://www.XXX.com}FOOBAR-Relocation#{http://www.XXX.com/1.0.0}SubmitFOOBARPackage has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused by: com.ctc.wstx.exc.WstxIOException: Connection refused. at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:91)[cxf-rt-core-2.4.6.jar:2.4.6] at org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:50)[cxf-rt-core-2.4.6.jar:2.4.6] at org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:101)[camel-cxf-2.8.4.jar:2.8.4] After this the route continues rather than trying redelivery. If I throw an exception processor in there: camel:to uri=bean:throwit/ bean id=throwit class=org.search.processor.Process/ Then I see the redelivery attempts happen. This does not happen with the web service 'connection refused' though... Any ideas? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5532402.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel log - part of body
Hello All, In my camel routes, I use the log component quite a bit. For example: camel:log message=This is the body: ${body}/ Is there a way with the simple language to only print out the first 100 characters or so of the body? I have some large XML file coming through that are really clogging up my logs. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Camel-log-part-of-body-tp5502660p5502660.html Sent from the Camel - Users mailing list archive at Nabble.com.
Propogate CXF Exception to Camel
Hello All, Consider a simple camel route like this that invokes a one way service: camel:route errorHandlerRef=myDeadLetterErrorHandler camel:from uri=inputDir/ camel:setHeader headerName=operationNameconstantopName/constant/camel:setHeader camel:setHeader headerName=operationNamespaceconstantopNamespace/constant/camel:setHeader camel:to uri=cxf:bean:myService?dataFormat=PAYLOAD/ /camel:route If the endpoint you are invoking is down, CXF will throw an exception: Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method)[:1.6.0_29] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)[:1.6.0_29] at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)[:1.6.0_29] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)[:1.6.0_29] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)[:1.6.0_29] I thought that the error handler that I set on the route would handle this for me and I could configure the retries and retry interval. However, this exception never makes it back to the exchange on the route. I tried to set up a CXF phase interceptor to handle this, but I was unable to put the CXF exception onto the Camel exchange. Please see this related post on the CXF list for more details on the interceptor configuration: http://cxf.547215.n5.nabble.com/CXF-Camel-JMS-Endpoint-exception-handling-td4471174.html#a5490748 I also tried to grab the out of band headers from the exchanges and check the HTTP status for a 200 response, but these appear to only be available in POJO mode. I figured I could throw an exception for a status other than 200 since I have a one way service. I find this strange. Should an exception thrown in the CXF interceptor chain makes it way back to the Camel exchange? Am I missing something here? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491102.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using Camel to as WS Broker
Hi Guys, It looks like you want to use a single service as a facade to the multiple services behind the scenes. Camel can do that. Does the service that you want to use as the facade have a WSDL/Service Spec? If yes, you can set up a CXF endpoint in either Payload or POJO mode for that service. Your route can then provide a content based router to route to your other services. I would start up configuring a simple route with your back end services and then put a facade in front of it. For example in payload mode: cxf:cxfEndpoint id=myBackendService address=http://localhost:8080/backend; wsdlURL=classpath:backend.wsdl serviceName=test:ServiceService endpointName=test:Service xmlns:test=http://www.test.com; / cxf:cxfEndpoint id=myFacadeService address=http://localhost:8080/backend; wsdlURL=classpath:facade.wsdl serviceName=test:ServiceService endpointName=test:Service xmlns:test=http://www.test.com; / camel:route errorHandlerRef=myDeadLetterErrorHandler camel:from uri=cxf:bean:myFacadeService?format=PAYLOAD/ insert content based router here based on operation name or using XPath filtering on content in message camel:to uri=cxf:bean:myBackendService?format=PAYLOAD/ /camel:route You can also set up other routes to feed your web service like a simple file drop. If you prefer to do that outside of Camel, a tool like Soap UI would help. Start off my exposing single service in your route and build up from there. You can use some of the existing Maven archetypes to get you up and running pretty fast. Cheers, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Using-Camel-to-as-WS-Broker-tp5489513p5491253.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Propogate CXF Exception to Camel
Hello All, I got Camel to see the exception by throwing a fault in my interceptor. This is probably not the preferred way to do this, but it seemed to work: public class CamelExceptionInterceptor extends AbstractPhaseInterceptorMessage { public CamelExceptionInterceptor() { super(Phase.SETUP); } @Override public void handleFault(Message message) { Exception exception = message.getContent(Exception.class); throw new Fault(exception); } @Override public void handleMessage(Message message) throws Fault { } } I then wired this interceptor into my Camel route. I had to hunt a while to see what phase it was bombing out on, but this worked: cxf:cxfEndpoint id=myService address=http://localhost/service; wsdlURL=service.wsdl serviceName=test:ServiceService endpointName=test:Service xmlns:test=http://test.com; cxf:outInterceptors ref bean=camelExceptionInterceptor/ /cxf:outInterceptors /cxf:cxfEndpoint Maybe this fault did not propogate because in my test scenario, a connection could not be established so it wasn't far enough in the CXF chain to propogate the exception? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491265.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Propogate CXF Exception to Camel
Hi Willem, Thanks for posting the unit test. I am wondering if I am getting the error because I am using a one-way exchange. For example, I also tried this with a producer template: senderExchange = new DefaultExchange(context, ExchangePattern.InOnly); enderExchange.getIn().setBody(exchange.getIn().getBody()); ProducerTemplate template = context.createProducerTemplate(); senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAME, getOperationName()); senderExchange.getIn().setHeader(CxfConstants.OPERATION_NAMESPACE, getOperationNamespace()); Exchange returnExchange = template.send(cxf:bean: + destinationEndpoint + ?dataFormat=PAYLOAD, senderExchange); With this InOnly pattern, the exception doesn't get back to me. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491276.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Propogate CXF Exception to Camel
Well Willem, You have solved the problem... It is a bug with Camel 2.6.0 that is corrected in Camel 2.8.4. I am on ServiceMix 4.3.0 and that ships with Camel 2.6.0. I changed my POM to use the newer version of Camel and CXF and ran it in Eclipse just fine. Thanks for helping with this. -Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Propogate-CXF-Exception-to-Camel-tp5491102p5491299.html Sent from the Camel - Users mailing list archive at Nabble.com.
TypeConverter GenericFile to InputStream
Hello All, It looks like in Camel 2.6.0 there is no TypeConverter from GenericFile to InputStream. It is easy enough to get an InputStream from a GenericFile: Object body = exchange.getIn().getBody(); InputStream inputStream = null; if (body instanceof GenericFile) { GenericFileFile file = (GenericFileFile) body; inputStream = new FileInputStream(file.getFile()); } Is this a TypeConverter that can be added or is it available in later release of Camel? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/TypeConverter-GenericFile-to-InputStream-tp5042415p5042415.html Sent from the Camel - Users mailing list archive at Nabble.com.
Persisting a variable over different exchanges
Hello All, I frequently set headers on an exchange so I can access them at different points on a route. Is there a way to persist a variable between different exchanges? I have a timer that will query a database every minute. I want to store the last record I queried so I only get new records. I don't have access to write to the database so I can't use that to persist this info. I could write it out to a text file and read/write it. Is there a way to store this information in Camel so it can be available to different exchanges? Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Persisting-a-variable-over-different-exchanges-tp4946317p4946317.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF component with WS-Addressing and one way messages
Hi Anton, Here is how you set the message ID: String requestID = MY_MESSAGE_ID if (StringUtils.isNotEmpty(requestID)) { // get Message Addressing Properties instance AddressingBuilder builder = AddressingBuilder.getAddressingBuilder(); AddressingProperties maps = builder.newAddressingProperties(); // set MessageID property AttributedURIType messageIDAttr = WSA_OBJECT_FACTORY.createAttributedURIType(); messageIDAttr.setValue(requestID); maps.setMessageID(messageIDAttr); MapString, Object requestContext = new HashMapString, Object(); requestContext.put(CLIENT_ADDRESSING_PROPERTIES, maps); senderExchange.getIn().setHeader(Client.REQUEST_CONTEXT , requestContext); } Cheers, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/CXF-component-with-WS-Addressing-and-one-way-messages-tp4370106p493.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Exception when configuring data source in imported file
Hi Claus, I tried with Spring 2.5.x and 3.0.x. I did read the Spring documentation here: http://static.springsource.org/spring/docs/2.5.x/reference/beans.html and they had some alternate syntax as well: bean id=dataSourceSQL class=com.mchange.v2.c3p0.ComboPooledDataSource destroy-method=close property name=driverClass value=com.mysql.jdbc.Driver property name=jdbcUrl value=jdbc:mysql://xxx.xxx.xxx.xxx:3306/schema_name ... (more properties below, omitted for brevity) /bean This did the trick. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Exception-when-configuring-data-source-in-imported-file-tp4643831p4648120.html Sent from the Camel - Users mailing list archive at Nabble.com.