Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Claus Ibsen
    @davsclaus
    Or change the type to be String instead of list, and then its implied that mulitple address / topics are separated via comma
    or semi-colon etc
    Simon Temple
    @simon-temple
    @davsclaus Sounds like a good plan :-)
    Tom Donohue
    @monodot
    Hello, I'm trying to use property expansion in an xpath clause, e.g. .xpath("{{foo}}") (where foo is an XPath expression). My var seems to be expanded if it's in a filter, e.g. .filter().xpath("{{foo}}"), but not if it's in a CBR, e.g. .choice().when().xpath("{{foo}}"). Am I doing it right?
    Claus Ibsen
    @davsclaus
    @monodot what Camel version do you use. And try with when(xpath(...)) as well
    Josh Long posted a video where he tries Apache Camel with Spring Boot
    Tom Donohue
    @monodot
    Thanks @davsclaus , this is in 2.21.0. I've tried also with .when(xpath(...)) and get the same result. Here's a test case of what I mean: https://github.com/monodot/camel-demos/blob/master/spring-boot-tests/src/test/java/com/cleverbuilder/cameldemos/springboot/XpathProperty.java . Possibly a ChoiceDefinition is treated differently from a FilterDefinition? Is it worth raising a bug for this? :)
    Claus Ibsen
    @davsclaus
    Could be try with 2.21.1
    Tom Donohue
    @monodot
    Thanks, just tried that and it's the same result: TransformerException: A location path was expected, but the following token was encountered: {{foo}}
    Claus Ibsen
    @davsclaus
    okay log a JIRA
    Claus Ibsen
    @davsclaus
    @monodot reproduced and logged a ticket: https://issues.apache.org/jira/browse/CAMEL-12532
    Tom Donohue
    @monodot
    Great, thankyou Claus!
    Dennis
    @dentych

    Question time. I want to do some content based routing. Following the "content based routing" guide in the camel documentation makes for a very long configuration, which could possibly be handled easier (see second example). Would the second example be equally good for content based routing, or is there some things unknown to me that should make me prefer the first option??

    Gist: https://gist.github.com/dentych/aa960b26f0ac59cbb00fd3f81ac6ceff

    kgpnit
    @kgpnit
    @Dennis , I think 1. static entities in camel and destinations are known already 2. don't know destinations and will be known at runtime
    Does stopOnException work in multicast parallel processing ?
    Can someone help me ?
    Cristian Toledo
    @ctoledo_gitlab
    Hi all, I have doubts with the implementation of Detached XML Signatures, I have mostly followed the example that appears here http://camel.apache.org/xml-security-component.html. My doubt is related to the validation that is done with the schema "test.xsd", I have not managed to generate it according to my needs.
    I have to sign the body, Timestamp and BinarySecurityToken of the request, which is encrypted (for the encryption I am using the implementation that appears in http://camel.apache.org/xmlsecurity-dataformat.html)
    Are there more examples to be able to implement Detached XML Signatures? I have also followed the examples that appear in https://github.com/apache/camel/tree/master/components/camel-xmlsecurity/src/test/resources/org/apache/camel/component/xmlsecurity and https://github.com/apache/camel/blob/master/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java
    DarkSavant
    @DarkSavant

    When I run this

    @RunWith(CamelSpringBootJUnit4ClassRunner.class)
    @SpringBootTest(
            classes = TestApplication.class
    )
    public class SampleCloudRequestResponseConfigurationCamelTest {
        @Autowired
        private CamelContext context;
        @Autowired
        private ProducerTemplate producer;
    
        @Test
        public void routeTest() {
            Assert.assertThat(true, Is.is(true));
        }
    }

    I get

    Caused by: java.lang.IllegalArgumentException: Cannot load an ApplicationContext with a NULL 'contextLoader'. Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.
        at org.springframework.util.Assert.notNull(Assert.java:115)
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:91)
        at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)

    Any ideas? I’m trying to follow chapter 9 of Camel in Action

    I don’t understand how CamelContext and ProducerTemplate would get injected when they are not annotated as components.
    DarkSavant
    @DarkSavant
    So my issue appears to be a version problem. The examples in the book use camel 2.18 but we’re stuck on 2.17.7 because we’re limited to Java 7 :(
    DarkSavant
    @DarkSavant
    Nope, my issue for Camel 2.17 is using @ContextConfiguration instead of @SpringBootTest
    txjmb
    @txjmb

    I'm not able to get camel-ahc-ws to work in Karaf on Camel 2.18 +. It works fine in 2.17.x. It appears to be an issue with Netty and dependencies. Everything installs into Karaf without issue, but when a route is instantiated, I get ClassDefNotFound Exceptions all related to Netty. To reproduce, you will need a WebSockets server, but I wasn't able to get it to work on any Netty 4 version of Camel.

    Caused by: java.lang.ClassNotFoundException: io.netty.channel.EventLoopGroup not found by wrap_file__C__Users_.m2_repository_org_asynchttpclient_async-http-client_2.0.32_async-http-client-2.0.32.jar_Export-Package_org.asynchttpclient.__version_2.0.32 [76] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639) ~[?:?] at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053) ~[?:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?] at org.asynchttpclient.DefaultAsyncHttpClient.<init>(DefaultAsyncHttpClient.java:85) ~[?:?] at org.apache.camel.component.ahc.ws.WsEndpoint.createClient(WsEndpoint.java:113) ~[?:?] at org.apache.camel.component.ahc.AhcEndpoint.doStart(AhcEndpoint.java:304) ~[?:?] at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[?:?] at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) ~[?:?] at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:157) ~[?:?] at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145) ~[?:?]

    Karaf 4.2 Java 1.8.0_162

    txjmb
    @txjmb

    Simple Karaf setup for repro:
    repo-add camel 2.x (>= 2.18) feature:install camel-blueprint aries-blueprint deployer camel-ahc camel-ahc-ws

    then:

    Add a route to deploy directory:

    <?xml version="1.0" encoding="UTF-8"?>
    <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:camelBlueprint="http://camel.apache.org/schema/blueprint"
        xsi:schemaLocation="http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint-2.19.1.xsd">
        <camelBlueprint:camelContext>
            <camelBlueprint:route>
                <camelBlueprint:from uri="ahc-wss://host"/>
                <camelBlueprint:to uri="file:d:\temp\"/>
            </camelBlueprint:route>
        </camelBlueprint:camelContext>
    </blueprint>
    txjmb
    @txjmb
    Then, try cleaning Karaf and repeating with Camel 2.17.x. It should work without issue.
    Willian Antunes
    @willianantunes

    .
    .
    Guys, I'm trying to use CxfRs component but I think there's a bug (I believe) concerning when it's used as producer with a custom bean provided by Spring. See an example:

    @Bean("serviceEndpoint")  
    public JAXRSClientFactoryBean serviceEndpoint() {  
    
        if (StringUtils.isEmpty(serenataJarbasEndpoint))  
            serenataJarbasEndpoint = JarbasAPI.API_DEFAULT_URL;  
    
        JAXRSClientFactoryBean clientFactoryBean = new JAXRSClientFactoryBean();  
        clientFactoryBean.setServiceClass(JarbasAPI.class);  
        clientFactoryBean.setProviders(Collections.singletonList(providerByCustomObjectMapper()));  
    
        return clientFactoryBean;  
    }

    OK! I'm gonna use as a client and JarbasAPI is the interface which has all the operations that I'm gonna consume. When I debug I can see the following:

    • The bean is correctly got here is CxfRsComponent.
    • When a message is sent and there is a to command with the URI cxfrs:bean:serviceEndpoint, I see the message arriving here in CxfRsProducer.
    • The method invokeProxyClient is called.
    • The JAXRSClientFactoryBean which I provided as bean is ignored and a new one is created here.

    Why is this happening? Did I miss something?

    Maybe I'm gonna post in StackOverflow, but I'll debug for more until there...

    Willem Jiang
    @WillemJiang
    @willianantunes The bean is supposed to help us setup cxfrs endpoint with the CXF provides customer setting. We normally don't use a java bean as you did, because we cannot tell if there are any properties missing setting. After checking the code of setting the client factory bean, I think you don't set the service address here.
    Willian Antunes
    @willianantunes
    .
    Guys, I can only make it works when I use XML.
    Willem Jiang
    @WillemJiang
    Hi @willianantunes , do we post the message at the same time?
    Willian Antunes
    @willianantunes
    I believe so, @WillemJiang.
    Btw... I solved with XML. Is there no way to use programmatically?
    Willem Jiang
    @WillemJiang
    OK, that's interesting, I was surprised you send the response so quickly. You may need to share the full code clientFactoryBean.
    Willian Antunes
    @willianantunes

    If I set up a XML with the following content:

    <beans xmlns="http://www.springframework.org/schema/beans"  
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
      xmlns:cxf="http://camel.apache.org/schema/cxf"  
      xmlns:jaxrs="http://cxf.apache.org/jaxrs"  
      xmlns:util="http://www.springframework.org/schema/util"  
      xsi:schemaLocation="  
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd ">  
    
        <cxf:rsClient id="serviceEndpoint" address="https://jarbas.serenata.ai"  
      serviceClass="br.com.willianantunes.serenata.JarbasAPI" />  
    
    </beans>

    Then it works as expected! But with the code below doesn't:

    @Bean("serviceEndpoint")  
    public SpringJAXRSClientFactoryBean serviceEndpoint() {  
    
        if (StringUtils.isEmpty(serenataJarbasEndpoint))  
            serenataJarbasEndpoint = JarbasAPI.API_DEFAULT_URL;  
    
        SpringJAXRSClientFactoryBean clientFactoryBean = new SpringJAXRSClientFactoryBean();  
        clientFactoryBean.setServiceClass(JarbasAPI.class);  
        clientFactoryBean.setProviders(Collections.singletonList(providerByCustomObjectMapper()));  
    
        return clientFactoryBean;  
    }

    I'm still debugging to understand why, @WillemJiang ...

    Willem Jiang
    @WillemJiang
    technically, we should setup the endpoint programmatically, but there maybe some missing point, such as the address
    Willian Antunes
    @willianantunes
    Hum... I'll test it.
    Willem Jiang
    @WillemJiang
    clientFactoryBean.setAddress(xxx);
    Can you add it in your serviceEndpoint?
    Willian Antunes
    @willianantunes
    Yep! I'm running right now to see it.
    @WillemJiang I tested with clientFactoryBean.setAddress(serenataJarbasEndpoint) and didn't work.
    Willem Jiang
    @WillemJiang
    How do you create the CxfRsEndpoint?
    I just found the code of setting address from the bean in CxfRsSpringEndpoint.
    Willian Antunes
    @willianantunes
    With the following:
    String uri = "cxfrs://bean://serviceEndpoint";
    
    CxfRsEndpoint endpoint = camelContext.getEndpoint(uri, CxfRsEndpoint.class);
    CxfRsProducer producer = (CxfRsProducer)endpoint.createProducer();
    
    Exchange exchange = new ExchangeBuilder(camelContext)
            .withBody(6470354)
            .withHeader(CxfConstants.OPERATION_NAME, "reimbursementByDocumentId")
            .withHeader(CxfConstants.CAMEL_CXF_RS_USING_HTTP_API, false)
            .withPattern(ExchangePattern.InOut).build();
    
    producer.process(exchange);
    Usually I first test the component before using it in a route.
    Willem Jiang
    @WillemJiang
    yeah, it should work, the bean:// should create a CxfRsSpringEndpoint for you.
    Willian Antunes
    @willianantunes
    Maybe there's a difference between XML and programmatically approach. I'm gonna debug more to understand why only XML works...
    Willian Antunes
    @willianantunes

    Content of SpringJAXRSClientFactoryBean (XML) :

    beanId = "serviceEndpointViaXML"
    loggingSizeLimit = 0
    loggingFeature = null
    username = null
    password = null
    inheritHeaders = false
    headers = null
    initialState = null
    threadSafe = false
    timeToKeepState = 0
    serviceClass = {Class@6832} "interface br.com.willianantunes.serenata.JarbasAPI"
    proxyLoader = null
    schemaLocations = null
    serviceFactory = {JAXRSServiceFactoryBean@8999} 
    entityProviders = {LinkedList@9000}  size = 0
    providerComparator = null
    bus = {SpringBus@9001} 
    address = "https://jarbas.serenata.ai"
    transportId = null
    bindingId = "http://apache.org/cxf/binding/jaxrs"
    dataBinding = null
    bindingFactory = null
    destinationFactory = null
    publishedEndpointUrl = null
    endpointName = null
    serviceName = null
    properties = {HashMap@9003}  size = 1
    features = null
    bindingConfig = null
    endpointReference = null
    conduitSelector = null
    in = {ModCountCopyOnWriteArrayList@9004}  size = 0
    out = {ModCountCopyOnWriteArrayList@9005}  size = 0
    outFault = {ModCountCopyOnWriteArrayList@9006}  size = 0
    inFault = {ModCountCopyOnWriteArrayList@9007}  size = 0

    Content of SpringJAXRSClientFactoryBean (programmatically) :

    beanId = "serviceEndpoint"
    loggingSizeLimit = 0
    loggingFeature = null
    username = null
    password = null
    inheritHeaders = false
    headers = null
    initialState = null
    threadSafe = false
    timeToKeepState = 0
    serviceClass = {Class@6834} "interface br.com.willianantunes.serenata.JarbasAPI"
    proxyLoader = null
    schemaLocations = null
    serviceFactory = {JAXRSServiceFactoryBean@8997} 
    entityProviders = {LinkedList@8998}  size = 0
    providerComparator = null
    bus = {SpringBus@8999} 
    address = "https://jarbas.serenata.ai"
    transportId = null
    bindingId = "http://apache.org/cxf/binding/jaxrs"
    dataBinding = null
    bindingFactory = null
    destinationFactory = null
    publishedEndpointUrl = null
    endpointName = null
    serviceName = null
    properties = null
    features = null
    bindingConfig = null
    endpointReference = null
    conduitSelector = null
    in = {ModCountCopyOnWriteArrayList@9001}  size = 0
    out = {ModCountCopyOnWriteArrayList@9002}  size = 0
    outFault = {ModCountCopyOnWriteArrayList@9003}  size = 0
    inFault = {ModCountCopyOnWriteArrayList@9004}  size = 0

    It's late and I do not know yet how to resolve this.

    Willem Jiang
    @WillemJiang
    yeah, I think I found the key. in XML spring can hold the properties of the clientFactoryBean, so it can work for the https://github.com/apache/camel/blob/834a59910e4b6b8d089e229b39f6c8673e7c3f9a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsSpringEndpoint.java#L77
    Willian Antunes
    @willianantunes
    @WillemJiang the only difference is the properties which in XML has a value and programmatically doesn't.
    Willem Jiang
    @WillemJiang
    @willianantunes Can you check the value of properties? I think that's the magic
    Willian Antunes
    @willianantunes
    @WillemJiang in XML approach the field properties is a HashMap with one entry: key = "beanId", value = "serviceEndpointViaXML".

    @WillemJiang look what I did:

    @Bean("serviceEndpoint")  
    public SpringJAXRSClientFactoryBean serviceEndpoint() {  
    
        if (StringUtils.isEmpty(serenataJarbasEndpoint))  
            serenataJarbasEndpoint = JarbasAPI.API_DEFAULT_URL;  
    
        SpringJAXRSClientFactoryBean clientFactoryBean = new SpringJAXRSClientFactoryBean();  
        clientFactoryBean.setAddress(serenataJarbasEndpoint);  
        clientFactoryBean.setBeanId("serviceEndpoint");  
        clientFactoryBean.setServiceClass(JarbasAPI.class);  
        Map<String, Object> properties = new HashMap<>();  
        properties.put("beanId", "serviceEndpoint");  
        clientFactoryBean.setProperties(properties);  
    
        return clientFactoryBean;  
    }

    And still nothing...