...
This example shows a client and a server in action. The client sends 100 messages to the server over HTTP which the server processes and returns a reply.
The client is working using a single threaded to route the messages to the point where they are send to the HTTP server. As we use non blocking asynchronous request/ Request reply this single thread will terminate its current task and be ready immediately to route the next message. This allows us to have higher throughput as the single thread can go as fast as it can, it does not have to wait for the HTTP server to reply (i.e. its not blocking).
You can see the difference if you change the async=true
option to async=false
in the src/main/resources/META-INF/spring/camel-client.xml
file.
...
Code Block |
---|
[ main] +++ request +++ INFO Exchange[BodyType:String, Body:Message 4] [ main] +++ reply +++ INFO Exchange[BodyType:String, Body:Bye Message 4] [ main] +++ request +++ INFO Exchange[BodyType:String, Body:Message 5] [ main] +++ reply +++ INFO Exchange[BodyType:String, Body:Bye Message 5] [ main] +++ request +++ INFO Exchange[BodyType:String, Body:Message 6] [ main] +++ reply +++ INFO Exchange[BodyType:String, Body:Bye Message 6] [ main] +++ request +++ INFO Exchange[BodyType:String, Body:Message 7] [ main] +++ reply +++ INFO Exchange[BodyType:String, Body:Bye Message 7] [ main] +++ request +++ INFO Exchange[BodyType:String, Body:Message 8] [ main] +++ reply +++ INFO Exchange[BodyType:String, Body:Bye Message 8] |