Apache Camel AHC component examples test-sources jar - asynchronous

I am creating a POC using Apache Camel 2.8 and its AHC component.
I could not find any examples on Apache Camel's website's Examples section for the same.
Also on the AHC component detail page http://camel.apache.org/ahc.html examples only show request being sent to a single URL.For sending requests to multiple URLs in aysnchronous manner and handling their callbacks and responses I cannot see any examples.
If anybody has worked on this and can point me to where I can find the desired examples I would be very much thankful.
Also I was looking out for the unit tests for Camel's AHC component in my local maven repository but could not find the test-sources JAR file.From where and how can I download the same? Unit tests would help in how to use the AHC component API.
I could find the test source code at this location
https://fisheye6.atlassian.com/browse/camel/trunk/components/camel-ahc/src/test/java/org/apache/camel/component/ahc
Is there any way in which I can download all the tests in the form of a JAR file?
Thanks,
Jignesh

The camel-ahc component is asynchronous by default.
See more details here and the links from that page: http://camel.apache.org/asynchronous-routing-engine.html
So if you for example have a Camel route that does a request/reply using AHC, then you can do route messages concurrently, and the camel-ahc runs asynchronously.

Related

Documentation of Hydra Config

Hydra provides a way to dynamically create a hierarchical configuration by composition and override it through config files and the command line, leveraging OmegaConf. I look for a recommended way to document the parameters but I could not find (a documented) one. What are best practices for that? Coming from argparse, I like the way of documenting the parameter inline, i.e. close to the code.
Excellent question! The answer is: parameter-by-parameter documentation is not yet implemented (as of Hydra v1.1, OmegaConf v2.1).
The future plans are:
in OmegaConf, expose an API allowing users to attach documentation (and other metadata) to each field of a structured config. See this open OmegaConf issue.
Once the above is complete, implement a Hydra feature allowing a parameter-specific help messages to be printed based on the parameter's metadata. See this open Hydra issue.
For now, the best we can do is to customize the general application help message (i.e. the --help command line flag).

How to create Elastic APM spans for each pipeline call

I would like a recommendation on how to instrument each pipeline call using Elastic APM API on Intershop 7.10.
I want to to create a separate span as described here:
https://www.elastic.co/guide/en/apm/agent/java/master/public-api.html#api-span-start-span
(Using try catch block with parent.startSpan())
For now I have tried looking into ICM knowledge base for topics regarding ELK stack (found none) and looked in Component Framework section on how to inject some code around PipelineProcessorImpl.executePipeline or put another pipeline processor implementation through component framewowrk but couldn't find nothing, it seems for now that pipeline processor implementation are not hooked through Component Framework.
General answer is, you should not bother replacing PipelineProcessor with your own implementation. Even for such a seemingly small task of feeding your own monitoring solution.
I (may) have a better solution for you. Haven't tested it though. Have a look at the detailed answer to this intershop question: Adding a servlet to run in Intershop 7.4 application server context
You don't want to add a new servlet but you want to bind a new javax.servlet.Filter implementation that hooks into the Application Server request chain. You can do that the same way as described, but invoke method filter("/servlet/Beehive/*") instead of serve("/servlet/DEMO/*")

Missing rest resource for certain requests in ready api project

I have created a composite project to test rest api using ready api tool and commited to git. Then someone imports that project from git, some api endpoints missed under api section, also some test steps missed under test cases. Here, once I added endpoints under APIs, i renamed services and gave the refering test suite name or meaning full name.
https://support.smartbear.com/readyapi/docs/_images/apis/organize/rest-structure.png
I noticed that if I use the same for in both locations, that means test suite name and service, this error happens. How could I solve this problem?. Because I have already developed this project.
You might want to change the names to a different one instead of using the same in both location and do ensure that you SAVE your entire project before committing to GitHub.

Does Spring Cloud Contract support JavaScript and JMS?

I want to start using the framework Spring Cloud Contract for contract testing. But does Spring Cloud Contract support JavaScript and JMS?
I haven't found any information about this.
As for the JMS, we do support it either via spring-integration or Apache Camel. You can also write your own JMS support. It's enough to register a couple of beans.
As for Javascript and non-jvm languages. There's no out of the box support but we have a process for that. The workflow is described here (in those cases the consumer is a Java app but in the next section I'll describe how the flow would differ) - https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html#_common_repo_with_contracts or https://cloud.spring.io/spring-cloud-contract/spring-cloud-contract.html#_step_by_step_guide_to_cdc. We will try to obviously simplify the process but currently there's a bunch of manual tasks to be done (not very tedious though).
The consumer can very easily download and run the stubs. Just clone https://github.com/spring-cloud-samples/stub-runner-boot, build it and push the fat jar to your Nexus/Artifactory. This application will be used by the consumers to automatically download stubs and run them locally. As a consumer you can then call java -jar stub-runner-boot --stubrunner.ids="com.example.groupid:artifactid:classifier:version:8090" --stubrunner.repositoryRoot="http://localhost:8081/artifactory/libs-release-local" . That way the application will start, download the provided jar with stubs from the given address where your artifactory is. Now your front end application can call the stubs of the producer at localhost:8090.
Of course we will try to simplify the cloning and pushing process (https://github.com/spring-cloud/spring-cloud-contract/issues/37) etc. but for now you have to do those 2 steps manually.
UPDATE:
With this article https://spring.io/blog/2018/02/13/spring-cloud-contract-in-a-polyglot-world we're presenting a way how to work in a polyglot environment. It's enough to use the provided docker images to run contract tests against a running application and to run the stub runners too.

jax-rs url inside an ejb module

I created a tutorial that incorporates various components of J2EE in them. The app is an ear module that has an ejb project and a web project.
the project structure is
john-app
john-ear
john-ejb
john-web
the ejb project has a couple dao that perform basic crud operations using jpa. I'm trying to learn/understand jax-rs to gain a better understanding of json and handling json objects. the project is loosly based on
this project:
http://www.developer.com/java/creating-restful-web-services-with-jax-rs.html
so, i created my BookResource here and made it a stateless ejb. i have everything compiling and deploying without any obvious errors - other parts of the app work (the jpa stuff) but i can't get the jax-rs stuff to
work. i have a couple of"Books" that I created in my database and am wanting to test this by making a rest call through the browser.
so i deploy my .ear file in wildfly (v10) with no obvious errors, I see JNDI mappings for my EJB's...etc
initially, i'd like to be able to test this through my browser, but am not certain what url to use -- the class i have extending javax.ws.rs.core.Application has an application path of /rest and my
BookResource has a path of /library, and for getting all books from the library, the sub-resource is books. I've tried every combination of the url below,
http://localhost:8080/john-[app|ear|ejb|web]/rest/library/books
all to no avail. every call results in a 404 error, and the only time i got ANYTHING is when i tried john-web combination, it threw some ugly exception in the browser. so the questions is with a rest service living inside an ejb module within an ear, what should the url be given the above information. nothing i've tried
seems to work!??
I've not included any code samples to try and keep the explanation short -- i didn't want to include every java file in my little project, but can add anything as requested.
Thanks,
JG

Resources